Closed
Description
Upgraded to react-scripts@^2.0.0-next.47d2d941 and get this error now:
PS C:\Users\jason\code\public\react-app-rewire-typescript-babel-preset\example> yarn test
yarn run v1.4.0
$ react-app-rewired test --env=jsdom
C:\Users\jason\code\public\react-app-rewire-typescript-babel-preset\example\node_modules\react-scripts\scripts\utils\createJestConfig.js:35
roots: srcRoots.map(toRelRootDir),
^
TypeError: srcRoots.map is not a function
at module.exports (C:\Users\jason\code\public\react-app-rewire-typescript-babel-preset\example\node_modules\react-scripts\scripts\utils\createJestConfig.js:35:21)
at Object.<anonymous> (C:\Users\jason\code\public\react-app-rewire-typescript-babel-preset\example\node_modules\react-app-rewired\scripts\test.js:16:16)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Some changes were made here that are relevant:
facebook/create-react-app#3741
The next
branch for react-app-rewired
has a change to address this:
timarney/react-app-rewired@fe7a9d5
Using the next branch from react-app-rewired leads to this error:
PS C:\Users\jason\code\public\react-app-rewire-typescript-babel-preset\example> yarn test --watchAll
yarn run v1.4.0
$ react-app-rewired test --env=jsdom --watchAll
FAIL src\App.test.tsx
● Test suite failed to run
TypeError: Cannot read property 'loose' of undefined (While processing preset: "C:\\Users\\jason\\code\\public\\react-app-rewire-typescript-babel-preset\\rewirePreset.js")
at _default (node_modules/@babel/plugin-transform-destructuring/lib/index.js:9:32)
at Function.memoisePluginContainer (node_modules/babel-core/lib/transformation/file/options/option-manager.js:113:13)
at Function.normalisePlugin (node_modules/babel-core/lib/transformation/file/options/option-manager.js:146:32)
at node_modules/babel-core/lib/transformation/file/options/option-manager.js:184:30
at Array.map (<anonymous>)
at Function.normalisePlugins (node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
at OptionManager.mergeOptions (node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
at node_modules/babel-core/lib/transformation/file/options/option-manager.js:265:14
at node_modules/babel-core/lib/transformation/file/options/option-manager.js:323:22
at Array.map (<anonymous>)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 2.612s
Ran all test suites.
Watch Usage
› Press f to run only failed tests.
› Press o to only run tests related to changed files.
› Press p to filter by a filename regex pattern.
› Press t to filter by a test name regex pattern.
› Press q to quit watch mode.
› Press Enter to trigger a test run.
Done in 8.15s.
Attempting to run tests with latest react-scripts and and react-app-rewired next branch in one my projects yields this error:
yarn run v1.4.0
$ react-app-rewired test --env=jsdom --watchAll
FAIL src\localization\loadTranslations.spec.ts
● Test suite failed to run
Cannot find module 'C:\code\project\node_modules\jest-message-util\node_modules\react-scripts\config\paths'
at Object.<anonymous> (node_modules/react-app-rewire-typescript-babel-preset/resolvedImports.js:29:33)