From 822701d3a87f83fefe508334aa4f42c59e7e2e52 Mon Sep 17 00:00:00 2001 From: James Newell Date: Thu, 30 Jan 2020 11:41:50 +1100 Subject: [PATCH 1/2] use require.resolve() instead of --- packages/jest-preset-default/jest-preset.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/jest-preset-default/jest-preset.js b/packages/jest-preset-default/jest-preset.js index badc6fc70efb9b..3bddded067e987 100644 --- a/packages/jest-preset-default/jest-preset.js +++ b/packages/jest-preset-default/jest-preset.js @@ -1,16 +1,16 @@ module.exports = { moduleNameMapper: { '\\.(scss|css)$': - '/node_modules/@wordpress/jest-preset-default/scripts/style-mock.js', + require.resolve('@wordpress/jest-preset-default/scripts/style-mock.js'), }, modulePaths: [ '' ], setupFiles: [ - '/node_modules/@wordpress/jest-preset-default/scripts/setup-globals.js', + require.resolve('@wordpress/jest-preset-default/scripts/setup-globals.js'), ], setupFilesAfterEnv: [ - '/node_modules/@wordpress/jest-preset-default/scripts/setup-test-framework.js', + require.resolve('@wordpress/jest-preset-default/scripts/setup-test-framework.js'), ], - snapshotSerializers: [ '/node_modules/enzyme-to-json/serializer.js' ], + snapshotSerializers: [ require.resolve('enzyme-to-json/serializer.js') ], testMatch: [ '**/__tests__/**/*.[jt]s', '**/test/*.[jt]s', @@ -19,13 +19,13 @@ module.exports = { testPathIgnorePatterns: [ '/node_modules/', '/wordpress/' ], timers: 'fake', transform: { - '^.+\\.[jt]sx?$': '/node_modules/babel-jest', + '^.+\\.[jt]sx?$': require.resolve('babel-jest'), }, verbose: true, reporters: 'TRAVIS' in process.env && 'CI' in process.env ? [ - '../../../@wordpress/jest-preset-default/scripts/travis-fold-passes-reporter.js', + require.resolve('@wordpress/jest-preset-default/scripts/travis-fold-passes-reporter.js'), ] : undefined, }; From 544ead310ea1a8a2368cd3bf8cdad7312cbd1f69 Mon Sep 17 00:00:00 2001 From: James Newell Date: Thu, 30 Jan 2020 16:22:58 +1100 Subject: [PATCH 2/2] formatted --- packages/jest-preset-default/jest-preset.js | 31 +++++++++------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/packages/jest-preset-default/jest-preset.js b/packages/jest-preset-default/jest-preset.js index 3bddded067e987..0e5d04f5f6e53b 100644 --- a/packages/jest-preset-default/jest-preset.js +++ b/packages/jest-preset-default/jest-preset.js @@ -1,31 +1,26 @@ module.exports = { moduleNameMapper: { - '\\.(scss|css)$': - require.resolve('@wordpress/jest-preset-default/scripts/style-mock.js'), + '\\.(scss|css)$': require.resolve( '@wordpress/jest-preset-default/scripts/style-mock.js' ), }, modulePaths: [ '' ], - setupFiles: [ - require.resolve('@wordpress/jest-preset-default/scripts/setup-globals.js'), - ], + setupFiles: [ require.resolve( '@wordpress/jest-preset-default/scripts/setup-globals.js' ) ], setupFilesAfterEnv: [ - require.resolve('@wordpress/jest-preset-default/scripts/setup-test-framework.js'), - ], - snapshotSerializers: [ require.resolve('enzyme-to-json/serializer.js') ], - testMatch: [ - '**/__tests__/**/*.[jt]s', - '**/test/*.[jt]s', - '**/?(*.)test.[jt]s', + require.resolve( '@wordpress/jest-preset-default/scripts/setup-test-framework.js' ), ], + snapshotSerializers: [ require.resolve( 'enzyme-to-json/serializer.js' ) ], + testMatch: [ '**/__tests__/**/*.[jt]s', '**/test/*.[jt]s', '**/?(*.)test.[jt]s' ], testPathIgnorePatterns: [ '/node_modules/', '/wordpress/' ], timers: 'fake', transform: { - '^.+\\.[jt]sx?$': require.resolve('babel-jest'), + '^.+\\.[jt]sx?$': require.resolve( 'babel-jest' ), }, verbose: true, reporters: - 'TRAVIS' in process.env && 'CI' in process.env ? - [ - require.resolve('@wordpress/jest-preset-default/scripts/travis-fold-passes-reporter.js'), - ] : - undefined, + 'TRAVIS' in process.env && 'CI' in process.env + ? [ + require.resolve( + '@wordpress/jest-preset-default/scripts/travis-fold-passes-reporter.js' + ), + ] + : undefined, };