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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
daa6195f
Commit
daa6195f
authored
Dec 22, 2017
by
Winnie Hellmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add option to run a single Karma spec file
parent
539996f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
2 deletions
+21
-2
config/karma.config.js
config/karma.config.js
+8
-0
spec/javascripts/test_bundle.js
spec/javascripts/test_bundle.js
+13
-2
No files found.
config/karma.config.js
View file @
daa6195f
...
...
@@ -12,8 +12,16 @@ if (webpackConfig.plugins) {
plugin
instanceof
webpack
.
DefinePlugin
);
});
}
else
{
webpackConfig
.
plugins
=
[];
}
webpackConfig
.
plugins
.
push
(
new
webpack
.
DefinePlugin
({
TEST_FILE
:
JSON
.
stringify
(
process
.
env
.
TEST_FILE
),
})
);
webpackConfig
.
devtool
=
'
cheap-inline-source-map
'
;
// Karma configuration
...
...
spec/javascripts/test_bundle.js
View file @
daa6195f
...
...
@@ -6,6 +6,7 @@ import '~/commons';
import
Vue
from
'
vue
'
;
import
VueResource
from
'
vue-resource
'
;
import
Translate
from
'
~/vue_shared/translate
'
;
const
isHeadlessChrome
=
/
\b
HeadlessChrome
\/
/
.
test
(
navigator
.
userAgent
);
Vue
.
config
.
devtools
=
!
isHeadlessChrome
;
...
...
@@ -24,6 +25,7 @@ Vue.config.errorHandler = function (err) {
};
Vue
.
use
(
VueResource
);
Vue
.
use
(
Translate
);
// enable test fixtures
jasmine
.
getFixtures
().
fixturesPath
=
'
/base/spec/javascripts/fixtures
'
;
...
...
@@ -61,11 +63,20 @@ beforeEach(() => {
Vue
.
http
.
interceptors
=
builtinVueHttpInterceptors
.
slice
();
});
// render all of our tests
// eslint-disable-next-line no-undef
let
testFile
=
TEST_FILE
;
if
(
testFile
)
{
console
.
log
(
`Running only
${
testFile
}
`
);
testFile
=
testFile
.
replace
(
/^spec
\/
javascripts
\/
/
,
''
);
testFile
=
testFile
.
replace
(
/
\.
js$/
,
''
);
}
const
testsContext
=
require
.
context
(
'
.
'
,
true
,
/_spec$/
);
testsContext
.
keys
().
forEach
(
function
(
path
)
{
try
{
testsContext
(
path
);
if
(
!
testFile
||
path
.
indexOf
(
testFile
)
>
-
1
)
{
testsContext
(
path
);
}
}
catch
(
err
)
{
console
.
error
(
'
[ERROR] Unable to load spec:
'
,
path
);
describe
(
'
Test bundle
'
,
function
()
{
...
...
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