From d17bd4bf637b516df8edd1ec745ce4e98b218d9f Mon Sep 17 00:00:00 2001 From: James Newell Date: Thu, 30 Jan 2020 17:15:04 +1100 Subject: [PATCH] Use require.resolve() instead of in @wordpress/jest-preset-default (#19957) * use require.resolve() instead of * 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 badc6fc70efb9b..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)$': - '/node_modules/@wordpress/jest-preset-default/scripts/style-mock.js', + '\\.(scss|css)$': require.resolve( '@wordpress/jest-preset-default/scripts/style-mock.js' ), }, modulePaths: [ '' ], - setupFiles: [ - '/node_modules/@wordpress/jest-preset-default/scripts/setup-globals.js', - ], + setupFiles: [ require.resolve( '@wordpress/jest-preset-default/scripts/setup-globals.js' ) ], setupFilesAfterEnv: [ - '/node_modules/@wordpress/jest-preset-default/scripts/setup-test-framework.js', - ], - snapshotSerializers: [ '/node_modules/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?$': '/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', - ] : - undefined, + 'TRAVIS' in process.env && 'CI' in process.env + ? [ + require.resolve( + '@wordpress/jest-preset-default/scripts/travis-fold-passes-reporter.js' + ), + ] + : undefined, };