Skip to content

Commit

Permalink
chore: move jest configuration into config files (#6861)
Browse files Browse the repository at this point in the history
* chore: move jest configuration into config files

* move reporter config into the js file

* moar coverage

* Update jest.config.js
  • Loading branch information
SimenB authored and rickhanlonii committed Aug 17, 2018
1 parent 5206280 commit c5389cb
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 68 deletions.
8 changes: 0 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ jobs:
- save-cache: *save-cache
- run:
command: yarn test-ci-partial
environment:
JEST_JUNIT_OUTPUT: 'reports/junit/js-test-results.xml'
- store_test_results:
path: reports/junit

Expand All @@ -68,8 +66,6 @@ jobs:
- save-cache: *save-cache
- run:
command: JEST_CIRCUS=1 yarn test-ci-partial
environment:
JEST_JUNIT_OUTPUT: 'reports/junit/js-test-results.xml'
- store_test_results:
path: reports/junit

Expand All @@ -84,8 +80,6 @@ jobs:
- save-cache: *save-cache
- run:
command: yarn test-ci
environment:
JEST_JUNIT_OUTPUT: 'reports/junit/js-test-results.xml'
- store_test_results:
path: reports/junit

Expand All @@ -100,8 +94,6 @@ jobs:
- save-cache: *save-cache
- run:
command: yarn test-ci-partial
environment:
JEST_JUNIT_OUTPUT: 'reports/junit/js-test-results.xml'
- store_test_results:
path: reports/junit

Expand Down
12 changes: 12 additions & 0 deletions jest.config.ci.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict';

// TODO: Configure the reporter directly: https://github.com/rickhanlonii/jest-silent-reporter/commit/e9a306210f89fa22705823f4c920ed4eecdfb83d#r30109923
process.env.JEST_SILENT_REPORTER_DOTS = true;

// Object spread is just node 8
module.exports = Object.assign({}, require('./jest.config'), {
reporters: [
['jest-junit', {output: 'reports/junit/js-test-results.xml'}],
'jest-silent-reporter',
],
});
53 changes: 53 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
'use strict';

module.exports = {
collectCoverageFrom: [
'**/packages/*/**/*.js',
'!**/bin/**',
'!**/cli/**',
'!**/perf/**',
'!**/__mocks__/**',
'!**/__tests__/**',
'!e2e/**',
],
coverageReporters: ['json'],
modulePathIgnorePatterns: [
'examples/.*',
'packages/.*/build',
'packages/.*/build-es5',
'packages/jest-runtime/src/__tests__/test_root.*',
'website/.*',
'e2e/runtime-internal-module-registry/__mocks__',
],
projects: ['<rootDir>', '<rootDir>/examples/*/'],
setupTestFrameworkScriptFile: '<rootDir>/testSetupFile.js',
snapshotSerializers: [
'<rootDir>/packages/pretty-format/build/plugins/convert_ansi.js',
],
testEnvironment: './packages/jest-environment-node',
testPathIgnorePatterns: [
'/node_modules/',
'/examples/',
'/e2e/.*/__tests__',
'\\.snap$',
'/packages/.*/build',
'/packages/.*/build-es5',
'/packages/.*/src/__tests__/expect_util.js',
'/packages/jest-cli/src/__tests__/test_root',
'/packages/jest-cli/src/__tests__/__fixtures__/',
'/packages/jest-cli/src/lib/__tests__/fixtures/',
'/packages/jest-haste-map/src/__tests__/haste_impl.js',
'/packages/jest-resolve-dependencies/src/__tests__/__fixtures__/',
'/packages/jest-runtime/src/__tests__/defaultResolver.js',
'/packages/jest-runtime/src/__tests__/module_dir/',
'/packages/jest-runtime/src/__tests__/NODE_PATH_dir',
'/packages/jest-snapshot/src/__tests__/plugins',
'/packages/jest-validate/src/__tests__/fixtures/',
'/packages/jest-worker/src/__performance_tests__',
'/packages/pretty-format/perf/test.js',
'/e2e/__tests__/iterator-to-null-test.js',
],
transform: {
'^.+\\.js$': '<rootDir>/packages/babel-jest',
},
};
62 changes: 2 additions & 60 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@
"postinstall": "opencollective postinstall && yarn build",
"publish": "yarn build-clean && yarn build && lerna publish --silent",
"test-ci-es5-build-in-browser": "karma start --single-run",
"test-ci": "JEST_SILENT_REPORTER_DOTS=true yarn jest-coverage -i --reporters jest-silent-reporter jest-junit && yarn test-leak && node scripts/mapCoverage.js && codecov",
"test-ci-partial": "JEST_SILENT_REPORTER_DOTS=true yarn jest -i --reporters jest-silent-reporter jest-junit",
"test-ci": "yarn jest-coverage -i --config jest.config.ci.js && yarn test-leak && node scripts/mapCoverage.js && codecov",
"test-ci-partial": "yarn jest -i --config jest.config.ci.js",
"test-pretty-format-perf": "node packages/pretty-format/perf/test.js",
"test-leak": "yarn jest -i --detectLeaks jest-mock jest-diff jest-repl",
"test": "yarn typecheck && yarn lint && yarn jest",
Expand All @@ -103,64 +103,6 @@
"website",
"examples/*"
],
"jest": {
"modulePathIgnorePatterns": [
"examples/.*",
"packages/.*/build",
"packages/.*/build-es5",
"packages/jest-runtime/src/__tests__/test_root.*",
"website/.*",
"e2e/runtime-internal-module-registry/__mocks__"
],
"collectCoverageFrom": [
"**/packages/jest-*/**/*.js",
"**/packages/eslint-*/**/*.js",
"**/packages/pretty-format/**/*.js",
"!**/bin/**",
"!**/cli/**",
"!**/perf/**",
"!**/__mocks__/**",
"!**/__tests__/**",
"!e2e/**"
],
"coverageReporters": [
"json"
],
"projects": [
"<rootDir>",
"<rootDir>/examples/*/"
],
"transform": {
"^.+\\.js$": "<rootDir>/packages/babel-jest"
},
"setupTestFrameworkScriptFile": "<rootDir>/testSetupFile.js",
"snapshotSerializers": [
"<rootDir>/packages/pretty-format/build/plugins/convert_ansi.js"
],
"testEnvironment": "./packages/jest-environment-node",
"testPathIgnorePatterns": [
"/node_modules/",
"/examples/",
"/e2e/.*/__tests__",
"\\.snap$",
"/packages/.*/build",
"/packages/.*/build-es5",
"/packages/.*/src/__tests__/expect_util.js",
"/packages/jest-cli/src/__tests__/test_root",
"/packages/jest-cli/src/__tests__/__fixtures__/",
"/packages/jest-cli/src/lib/__tests__/fixtures/",
"/packages/jest-haste-map/src/__tests__/haste_impl.js",
"/packages/jest-resolve-dependencies/src/__tests__/__fixtures__/",
"/packages/jest-runtime/src/__tests__/defaultResolver.js",
"/packages/jest-runtime/src/__tests__/module_dir/",
"/packages/jest-runtime/src/__tests__/NODE_PATH_dir",
"/packages/jest-snapshot/src/__tests__/plugins",
"/packages/jest-validate/src/__tests__/fixtures/",
"/packages/jest-worker/src/__performance_tests__",
"/packages/pretty-format/perf/test.js",
"/e2e/__tests__/iterator-to-null-test.js"
]
},
"prettier": {
"bracketSpacing": false,
"proseWrap": "never",
Expand Down

0 comments on commit c5389cb

Please sign in to comment.