Skip to content

Commit

Permalink
fix: jest configuration changes to allow is-plain-obj esm
Browse files Browse the repository at this point in the history
  • Loading branch information
rjchow committed Aug 16, 2022
1 parent d6224d8 commit 83d6e01
Show file tree
Hide file tree
Showing 22 changed files with 2,477 additions and 2,853 deletions.
4 changes: 4 additions & 0 deletions packages/js/components/changelog/fix-add-babel-jest
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Added babel-jest to allow jest to process esm dependencies during test runs
1 change: 1 addition & 0 deletions packages/js/components/package.json
Expand Up @@ -114,6 +114,7 @@
"rimraf": "^3.0.2",
"sass-loader": "^10.2.1",
"ts-jest": "^27.1.3",
"babel-jest": "^28.1.3",
"typescript": "^4.6.2",
"webpack": "^5.70.0",
"webpack-cli": "^3.3.12"
Expand Down
4 changes: 4 additions & 0 deletions packages/js/csv-export/changelog/fix-add-babel-jest
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Added babel-jest to allow jest to process esm dependencies during test runs
1 change: 1 addition & 0 deletions packages/js/csv-export/package.json
Expand Up @@ -50,6 +50,7 @@
"jest-cli": "^27.5.1",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"babel-jest": "^28.1.3",
"typescript": "^4.6.2"
},
"lint-staged": {
Expand Down
4 changes: 4 additions & 0 deletions packages/js/currency/changelog/fix-add-babel-jest
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Added babel-jest to allow jest to process esm dependencies during test runs
1 change: 1 addition & 0 deletions packages/js/currency/package.json
Expand Up @@ -53,6 +53,7 @@
"jest-cli": "^27.5.1",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"babel-jest": "^28.1.3",
"typescript": "^4.6.2"
},
"lint-staged": {
Expand Down
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Added babel-jest to allow jest to process esm dependencies during test runs
1 change: 1 addition & 0 deletions packages/js/customer-effort-score/package.json
Expand Up @@ -53,6 +53,7 @@
"rimraf": "^3.0.2",
"sass-loader": "^10.2.1",
"ts-jest": "^27.1.3",
"babel-jest": "^28.1.3",
"typescript": "^4.6.2",
"webpack": "^5.70.0",
"webpack-cli": "^3.3.12"
Expand Down
4 changes: 4 additions & 0 deletions packages/js/data/changelog/fix-add-babel-jest
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Added babel-jest to allow jest to process esm dependencies during test runs
1 change: 1 addition & 0 deletions packages/js/data/package.json
Expand Up @@ -63,6 +63,7 @@
"redux": "^4.1.0",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"babel-jest": "^28.1.3",
"typescript": "^4.6.2"
},
"peerDependencies": {
Expand Down
4 changes: 4 additions & 0 deletions packages/js/date/changelog/fix-add-babel-jest
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Added babel-jest to allow jest to process esm dependencies during test runs
1 change: 1 addition & 0 deletions packages/js/date/package.json
Expand Up @@ -40,6 +40,7 @@
"jest-cli": "^27.5.1",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"babel-jest": "^28.1.3",
"typescript": "^4.6.2"
},
"peerDependencies": {
Expand Down
4 changes: 4 additions & 0 deletions packages/js/experimental/changelog/fix-add-babel-jest
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Added babel-jest to allow jest to process esm dependencies during test runs
1 change: 1 addition & 0 deletions packages/js/experimental/package.json
Expand Up @@ -66,6 +66,7 @@
"rimraf": "^3.0.2",
"sass-loader": "^10.2.1",
"ts-jest": "^27.1.3",
"babel-jest": "^28.1.3",
"typescript": "^4.6.2",
"webpack": "^5.70.0",
"webpack-cli": "^3.3.12"
Expand Down
4 changes: 4 additions & 0 deletions packages/js/explat/changelog/fix-add-babel-jest
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Added babel-jest to allow jest to process esm dependencies during test runs
1 change: 1 addition & 0 deletions packages/js/explat/package.json
Expand Up @@ -45,6 +45,7 @@
"jest-cli": "^27.5.1",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"babel-jest": "^28.1.3",
"typescript": "^4.6.2"
},
"scripts": {
Expand Down
16 changes: 10 additions & 6 deletions packages/js/internal-js-tests/jest.config.js
Expand Up @@ -3,6 +3,8 @@
*/
const path = require( 'path' );

const esModules = [ 'is-plain-obj' ].join( '|' ); // these esm packages need to be transpiled to be used in jest

module.exports = {
moduleNameMapper: {
tinymce: path.resolve( __dirname, 'build/mocks/tinymce' ),
Expand All @@ -14,10 +16,8 @@ module.exports = {
__dirname,
'../../../plugins/woocommerce-admin/client/$1'
),
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': path.resolve(
__dirname,
'build/mocks/static'
),
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
path.resolve( __dirname, 'build/mocks/static' ),
'\\.(scss|css)$': path.resolve(
__dirname,
'build/mocks/style-mock.js'
Expand All @@ -42,9 +42,13 @@ module.exports = {
'<rootDir>/.*/build-module/',
'<rootDir>/tests/e2e/',
],
transformIgnorePatterns: [ '/node_modules', '/build/' ],
transformIgnorePatterns: [
`node_modules/(?!.pnpm/${ esModules }|${ esModules })`, // do not apply transforms to anything in node_modules except for the esm packages we need to transpile
'/build/',
],
transform: {
'^.+\\.[jt]sx?$': 'ts-jest',
'^.+\\.tsx?$': 'ts-jest',
'^.+\\.jsx?$': 'babel-jest',
},
testEnvironment: 'jest-environment-jsdom',
timers: 'modern',
Expand Down
4 changes: 4 additions & 0 deletions packages/js/navigation/changelog/fix-add-babel-jest
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Added babel-jest to allow jest to process esm dependencies during test runs
1 change: 1 addition & 0 deletions packages/js/navigation/package.json
Expand Up @@ -63,6 +63,7 @@
"jest-cli": "^27.5.1",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"babel-jest": "^28.1.3",
"typescript": "^4.6.2"
},
"lint-staged": {
Expand Down
4 changes: 4 additions & 0 deletions packages/js/number/changelog/fix-add-babel-jest
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Added babel-jest to allow jest to process esm dependencies during test runs
1 change: 1 addition & 0 deletions packages/js/number/package.json
Expand Up @@ -49,6 +49,7 @@
"jest-cli": "^27.5.1",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"babel-jest": "^28.1.3",
"typescript": "^4.6.2"
},
"lint-staged": {
Expand Down

0 comments on commit 83d6e01

Please sign in to comment.