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
Léo-Paul Géneau
gitlab-ce
Commits
b0e26ed5
Commit
b0e26ed5
authored
Mar 27, 2019
by
Winnie Hellmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Karma-style fixture helpers to Jest
parent
9c223756
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
2 deletions
+17
-2
spec/frontend/.eslintrc.yml
spec/frontend/.eslintrc.yml
+7
-2
spec/frontend/environment.js
spec/frontend/environment.js
+1
-0
spec/frontend/test_setup.js
spec/frontend/test_setup.js
+9
-0
No files found.
spec/frontend/.eslintrc.yml
View file @
b0e26ed5
...
@@ -2,8 +2,13 @@
...
@@ -2,8 +2,13 @@
env
:
env
:
jest/globals
:
true
jest/globals
:
true
plugins
:
plugins
:
-
jest
-
jest
settings
:
settings
:
import/resolver
:
import/resolver
:
jest
:
jest
:
jestConfigFile
:
"
jest.config.js"
jestConfigFile
:
'
jest.config.js'
globals
:
getJSONFixture
:
false
loadFixtures
:
false
preloadFixtures
:
false
setFixtures
:
false
spec/frontend/environment.js
View file @
b0e26ed5
...
@@ -6,6 +6,7 @@ const JSDOMEnvironment = require('jest-environment-jsdom');
...
@@ -6,6 +6,7 @@ const JSDOMEnvironment = require('jest-environment-jsdom');
class
CustomEnvironment
extends
JSDOMEnvironment
{
class
CustomEnvironment
extends
JSDOMEnvironment
{
constructor
(
config
,
context
)
{
constructor
(
config
,
context
)
{
super
(
config
,
context
);
super
(
config
,
context
);
Object
.
assign
(
context
.
console
,
{
Object
.
assign
(
context
.
console
,
{
error
(...
args
)
{
error
(...
args
)
{
throw
new
ErrorWithStack
(
throw
new
ErrorWithStack
(
...
...
spec/frontend/test_setup.js
View file @
b0e26ed5
...
@@ -2,6 +2,7 @@ import Vue from 'vue';
...
@@ -2,6 +2,7 @@ import Vue from 'vue';
import
Translate
from
'
~/vue_shared/translate
'
;
import
Translate
from
'
~/vue_shared/translate
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
initializeTestTimeout
}
from
'
./helpers/timeout
'
;
import
{
initializeTestTimeout
}
from
'
./helpers/timeout
'
;
import
{
getJSONFixture
,
loadHTMLFixture
,
setHTMLFixture
}
from
'
./helpers/fixtures
'
;
// wait for pending setTimeout()s
// wait for pending setTimeout()s
afterEach
(()
=>
{
afterEach
(()
=>
{
...
@@ -32,3 +33,11 @@ Object.defineProperty(global.Element.prototype, 'innerText', {
...
@@ -32,3 +33,11 @@ Object.defineProperty(global.Element.prototype, 'innerText', {
},
},
configurable
:
true
,
// make it so that it doesn't blow chunks on re-running tests with things like --watch
configurable
:
true
,
// make it so that it doesn't blow chunks on re-running tests with things like --watch
});
});
// convenience wrapper for migration from Karma
Object
.
assign
(
global
,
{
loadFixtures
:
loadHTMLFixture
,
loadJSONFixtures
:
getJSONFixture
,
preloadFixtures
()
{},
setFixtures
:
setHTMLFixture
,
});
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