Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
7f2244ee
Commit
7f2244ee
authored
Apr 10, 2018
by
Lukas Eipert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move TEST_FILES variable to `process.env`
parent
a8bf6a30
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
config/karma.config.js
config/karma.config.js
+1
-1
spec/javascripts/test_bundle.js
spec/javascripts/test_bundle.js
+6
-7
No files found.
config/karma.config.js
View file @
7f2244ee
...
@@ -21,7 +21,7 @@ var testFiles = process.argv.slice(ignoreUpTo).filter(arg => {
...
@@ -21,7 +21,7 @@ var testFiles = process.argv.slice(ignoreUpTo).filter(arg => {
webpackConfig
.
plugins
.
push
(
webpackConfig
.
plugins
.
push
(
new
webpack
.
DefinePlugin
({
new
webpack
.
DefinePlugin
({
TEST_FILES
:
JSON
.
stringify
(
testFiles
)
,
'
process.env.TEST_FILES
'
:
JSON
.
stringify
(
testFiles
)
,
})
})
);
);
...
...
spec/javascripts/test_bundle.js
View file @
7f2244ee
...
@@ -71,21 +71,20 @@ beforeEach(() => {
...
@@ -71,21 +71,20 @@ beforeEach(() => {
const
axiosDefaultAdapter
=
getDefaultAdapter
();
const
axiosDefaultAdapter
=
getDefaultAdapter
();
// eslint-disable-next-line no-undef
let
testFiles
=
process
.
env
.
TEST_FILES
;
let
testFile
=
TEST_FILES
;
if
(
testFiles
instanceof
Array
&&
testFiles
.
length
>
0
)
{
if
(
testFile
instanceof
Array
&&
testFile
.
length
>
0
)
{
console
.
log
(
`Running only tests:
${
testFiles
}
`
);
console
.
log
(
`Running only tests:
${
testFile
}
`
);
testFiles
=
testFiles
.
map
(
path
=>
path
.
replace
(
/^spec
\/
javascripts
\/
/
,
''
).
replace
(
/
\.
js$/
,
''
));
testFile
=
testFile
.
map
(
path
=>
path
.
replace
(
/^spec
\/
javascripts
\/
/
,
''
).
replace
(
/
\.
js$/
,
''
));
}
else
{
}
else
{
console
.
log
(
'
Running all tests
'
);
console
.
log
(
'
Running all tests
'
);
testFile
=
[];
testFile
s
=
[];
}
}
// render all of our tests
// render all of our tests
const
testsContext
=
require
.
context
(
'
.
'
,
true
,
/_spec$/
);
const
testsContext
=
require
.
context
(
'
.
'
,
true
,
/_spec$/
);
testsContext
.
keys
().
forEach
(
function
(
path
)
{
testsContext
.
keys
().
forEach
(
function
(
path
)
{
try
{
try
{
if
(
testFile
.
length
===
0
||
testFile
.
some
(
p
=>
path
.
includes
(
p
)))
{
if
(
testFile
s
.
length
===
0
||
testFiles
.
some
(
p
=>
path
.
includes
(
p
)))
{
testsContext
(
path
);
testsContext
(
path
);
}
}
}
catch
(
err
)
{
}
catch
(
err
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment