kentcdodds / testing-workshop

A workshop for learning how to test JavaScript applications
http://git.io/testing-workshop
1.36k stars 708 forks source link

Errors in `npm run test:react` #93

Closed Ibarra11 closed 5 years ago

Ibarra11 commented 5 years ago

Environment info:

Problem description: During the first exercise of the video, I ran npm run test:react. I then proceeded to change some code and save it to execute the test. When I did this, I encountered ReferenceError: Unknown plugin "syntax-dynamic-import" exactly like the error in the issue called "npm run dev fails in /calculator". I then tried the solution(npm i -D babel-plugin-syntax-dynamic-import) provided for that issue and it resolved that reference error, but a new ReferenceError: Unknown plugin "transform-class-properties" came up after I tried to run the test again.

---------- After running npm run test:react the first time ----------

`Jovonni@DESKTOP-RIF577T MINGW64 ~/devmtn/testing-workshop (master) $ npm run test:react

testing-workshop@2.0.0 test:react C:\Users\Jovonni\devmtn\testing-workshop jest --config ./other/simple-react/jest.config.js --watch No tests found related to files changed since last commit. Press a to run all tests, or run Jest with --watchAll.

Watch Usage › Press a to run all tests. › Press f to run only failed tests. › 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. FAIL react other/simple-react/tests/item-list.todo.js ● Test suite failed to run

ReferenceError: Unknown plugin "syntax-dynamic-import" specified in "C:\\Users\\Jovonni\\devmtn\\testing-workshop\\other\\configuration\\calculator.solution\\.babelrc.js" at 0, attempted to resolve relative to "C:\\Users\\Jovonni\\devmtn\\testing-workshop\\other\\configuration\\calculator.solution" (While processing preset: "C:\\Users\\Jovonni\\devmtn\\testing-workshop\\other\\configuration\\calculator.solution\\.babelrc.js")

  at ../../node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:17
      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>)
  at OptionManager.resolvePresets (../../node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
  at OptionManager.mergePresets (../../node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)
  at OptionManager.mergeOptions (../../node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)

Test Suites: 1 failed, 1 total Tests: 0 total Snapshots: 0 total Time: 5.162s Ran all test suites related to changed files. Watch Usage: Press w to show more.`

---------- Using the solution provided in issue called ""npm run dev fails in /calculator" ----------

Jovonni@DESKTOP-RIF577T MINGW64 ~/devmtn/testing-workshop (master) $ npm i -D babel-plugin-syntax-dynamic-import npm notice created a lockfile as package-lock.json. You should commit this file.

---------- Running npm run test:react again ----------

Jovonni@DESKTOP-RIF577T MINGW64 ~/devmtn/testing-workshop (master) $ npm run test:react

testing-workshop@2.0.0 test:react C:\Users\Jovonni\devmtn\testing-workshop jest --config ./other/simple-react/jest.config.js --watch FAIL react other/simple-react/tests/item-list.todo.js ● Test suite failed to run

ReferenceError: Unknown plugin "transform-class-properties" specified in "C:\\Users\\Jovonni\\devmtn\\testing-workshop\\other\\configuration\\calculator.solution\\.babelrc.js" at 1, attempted to resolve relative to "C:\\Users\\Jovonni\\devmtn\\testing-workshop\\other\\configuration\\calculator.solution" (While processing preset: "C:\\Users\\Jovonni\\devmtn\\testing-workshop\\other\\configuration\\calculator.solution\\.babelrc.js")
  at ../../node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:17
      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>)
  at OptionManager.resolvePresets (../../node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
  at OptionManager.mergePresets (../../node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)
  at OptionManager.mergeOptions (../../node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)

Test Suites: 1 failed, 1 total Tests: 0 total Snapshots: 0 total Time: 3.245s Ran all test suites related to changed files.

Watch Usage › Press a to run all tests. › Press f to run only failed tests. › 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. Suggested solution:

kentcdodds commented 5 years ago

Hi @Ibarra11,

My best guess is that your setup script failed somehow. Everything is working for me (I just tried), so there's probably something wrong with your local environment. Good luck.