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
63f6fcd0
Commit
63f6fcd0
authored
Mar 28, 2019
by
Winnie Hellmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set gon.ee in Jest
parent
5a2d7bf2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
jest.config.js
jest.config.js
+4
-9
spec/frontend/environment.js
spec/frontend/environment.js
+6
-0
No files found.
jest.config.js
View file @
63f6fcd0
const
fs
=
require
(
'
fs
'
);
const
path
=
require
(
'
path
'
);
const
ROOT_PATH
=
__dirname
;
const
IS_EE
=
process
.
env
.
EE
!==
undefined
?
JSON
.
parse
(
process
.
env
.
EE
)
:
fs
.
existsSync
(
path
.
join
(
ROOT_PATH
,
'
ee
'
));
const
IS_EE
=
require
(
'
./config/helpers/is_ee_env
'
);
const
reporters
=
[
'
default
'
];
...
...
@@ -46,4 +38,7 @@ module.exports = {
transformIgnorePatterns
:
[
'
node_modules/(?!(@gitlab/ui)/)
'
],
timers
:
'
fake
'
,
testEnvironment
:
'
<rootDir>/spec/frontend/environment.js
'
,
testEnvironmentOptions
:
{
IS_EE
,
},
};
spec/frontend/environment.js
View file @
63f6fcd0
...
...
@@ -6,6 +6,7 @@ const JSDOMEnvironment = require('jest-environment-jsdom');
class
CustomEnvironment
extends
JSDOMEnvironment
{
constructor
(
config
,
context
)
{
super
(
config
,
context
);
Object
.
assign
(
context
.
console
,
{
error
(...
args
)
{
throw
new
ErrorWithStack
(
...
...
@@ -21,6 +22,11 @@ class CustomEnvironment extends JSDOMEnvironment {
);
},
});
const
{
testEnvironmentOptions
}
=
config
;
this
.
global
.
gon
=
{
ee
:
testEnvironmentOptions
.
IS_EE
,
};
}
}
...
...
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