Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Meta
create-react-app
Commits
15c20f17
Commit
15c20f17
authored
8 years ago
by
Boris Serdiuk
Committed by
Dan Abramov
8 years ago
Browse files
Options
Download
Email Patches
Plain Diff
load setupTests file at setupTestFramework stage (#846)
fixes facebookincubator/create-react-app#824
parent
11c9bdc6
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/react-scripts/utils/createJestConfig.js
+5
-7
packages/react-scripts/utils/createJestConfig.js
with
5 additions
and
7 deletions
+5
-7
packages/react-scripts/utils/createJestConfig.js
+
5
-
7
View file @
15c20f17
...
@@ -13,12 +13,9 @@ const pathExists = require('path-exists');
...
@@ -13,12 +13,9 @@ const pathExists = require('path-exists');
const
paths
=
require
(
'
../config/paths
'
);
const
paths
=
require
(
'
../config/paths
'
);
module
.
exports
=
(
resolve
,
rootDir
,
isEjecting
)
=>
{
module
.
exports
=
(
resolve
,
rootDir
,
isEjecting
)
=>
{
const
setupFiles
=
[
resolve
(
'
config/polyfills.js
'
)];
// Use this instead of `paths.testsSetup` to avoid putting
if
(
pathExists
.
sync
(
paths
.
testsSetup
))
{
// an absolute filename into configuration after ejecting.
// Use this instead of `paths.testsSetup` to avoid putting
const
setupTestsFile
=
pathExists
.
sync
(
paths
.
testsSetup
)
?
'
<rootDir>/src/setupTests.js
'
:
undefined
;
// an absolute filename into configuration after ejecting.
setupFiles
.
push
(
'
<rootDir>/src/setupTests.js
'
);
}
const
config
=
{
const
config
=
{
moduleFileExtensions
:
[
'
jsx
'
,
'
js
'
,
'
json
'
],
moduleFileExtensions
:
[
'
jsx
'
,
'
js
'
,
'
json
'
],
...
@@ -26,7 +23,8 @@ module.exports = (resolve, rootDir, isEjecting) => {
...
@@ -26,7 +23,8 @@ module.exports = (resolve, rootDir, isEjecting) => {
'
^.+
\\
.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$
'
:
resolve
(
'
config/jest/FileStub.js
'
),
'
^.+
\\
.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$
'
:
resolve
(
'
config/jest/FileStub.js
'
),
'
^.+
\\
.css$
'
:
resolve
(
'
config/jest/CSSStub.js
'
)
'
^.+
\\
.css$
'
:
resolve
(
'
config/jest/CSSStub.js
'
)
},
},
setupFiles
:
setupFiles
,
setupFiles
:
[
resolve
(
'
config/polyfills.js
'
)],
setupTestFrameworkScriptFile
:
setupTestsFile
,
testPathIgnorePatterns
:
[
'
<rootDir>/(build|docs|node_modules)/
'
],
testPathIgnorePatterns
:
[
'
<rootDir>/(build|docs|node_modules)/
'
],
testEnvironment
:
'
node
'
,
testEnvironment
:
'
node
'
,
testRegex
:
'
(/__tests__/.*|
\\
.(test|spec))
\\
.(js|jsx)$
'
,
testRegex
:
'
(/__tests__/.*|
\\
.(test|spec))
\\
.(js|jsx)$
'
,
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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
Menu
Explore
Projects
Groups
Snippets