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
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
Show 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) {
...
@@ -12,8 +12,16 @@ if (webpackConfig.plugins) {
plugin
instanceof
webpack
.
DefinePlugin
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
'
;
webpackConfig
.
devtool
=
'
cheap-inline-source-map
'
;
// Karma configuration
// Karma configuration
...
...
spec/javascripts/test_bundle.js
View file @
daa6195f
...
@@ -6,6 +6,7 @@ import '~/commons';
...
@@ -6,6 +6,7 @@ import '~/commons';
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
VueResource
from
'
vue-resource
'
;
import
VueResource
from
'
vue-resource
'
;
import
Translate
from
'
~/vue_shared/translate
'
;
const
isHeadlessChrome
=
/
\b
HeadlessChrome
\/
/
.
test
(
navigator
.
userAgent
);
const
isHeadlessChrome
=
/
\b
HeadlessChrome
\/
/
.
test
(
navigator
.
userAgent
);
Vue
.
config
.
devtools
=
!
isHeadlessChrome
;
Vue
.
config
.
devtools
=
!
isHeadlessChrome
;
...
@@ -24,6 +25,7 @@ Vue.config.errorHandler = function (err) {
...
@@ -24,6 +25,7 @@ Vue.config.errorHandler = function (err) {
};
};
Vue
.
use
(
VueResource
);
Vue
.
use
(
VueResource
);
Vue
.
use
(
Translate
);
// enable test fixtures
// enable test fixtures
jasmine
.
getFixtures
().
fixturesPath
=
'
/base/spec/javascripts/fixtures
'
;
jasmine
.
getFixtures
().
fixturesPath
=
'
/base/spec/javascripts/fixtures
'
;
...
@@ -61,11 +63,20 @@ beforeEach(() => {
...
@@ -61,11 +63,20 @@ beforeEach(() => {
Vue
.
http
.
interceptors
=
builtinVueHttpInterceptors
.
slice
();
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$/
);
const
testsContext
=
require
.
context
(
'
.
'
,
true
,
/_spec$/
);
testsContext
.
keys
().
forEach
(
function
(
path
)
{
testsContext
.
keys
().
forEach
(
function
(
path
)
{
try
{
try
{
if
(
!
testFile
||
path
.
indexOf
(
testFile
)
>
-
1
)
{
testsContext
(
path
);
testsContext
(
path
);
}
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
[ERROR] Unable to load spec:
'
,
path
);
console
.
error
(
'
[ERROR] Unable to load spec:
'
,
path
);
describe
(
'
Test bundle
'
,
function
()
{
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