Advertisement
Guest User

Button.spec.tsx_FAIL

a guest
Oct 15th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.31 KB | None | 0 0
  1. ➜ npx jest
  2.  FAIL components/__tests__/Button.spec.tsx
  3.  ● Test suite failed to run
  4. Jest encountered an unexpected token
  5. This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
  6. By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
  7. Here's what you can do:
  8.  • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
  9.  • If you need a custom transformation specify a "transform" option in your config.
  10.  • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
  11. You'll find more details and examples of these config options in the docs:
  12. https://jestjs.io/docs/en/configuration.html
  13. Details:
  14. /Users/kjaer/our-cool-nextjs-app/components/__tests__/Button.spec.tsx:9
  15. var wrapper = enzyme_1.mount(<p>Jest Hello World</p>);
  16. ^
  17. SyntaxError: Unexpected token <
  18. at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:537:17)
  19. at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:579:25)
  20. Test Suites: 1 failed, 1 total
  21. Tests: 0 total
  22. Snapshots: 0 total
  23. Time: 1.522s
  24. Ran all test suites.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement