At the end of the tutorial, test files created by the generator can't actually run
See original GitHub issue FAIL api api/src/services/contacts/contacts.test.js
● Console
console.warn
warn prisma.disconnect() is deprecated, please use prisma.$disconnect() instead
at NewPrismaClient.disconnect (../node_modules/@prisma/client/src/runtime/getPrismaClient.ts:472:15)
at Object.<anonymous> (../node_modules/@redwoodjs/core/dist/configs/node/jest.setup.js:27:12)
● contacts › returns true
TypeError: Cannot read property 'datamodel' of undefined
at Object.<anonymous> (../node_modules/@redwoodjs/core/dist/configs/node/jest.setup.js:22:29)
FAIL api api/src/services/posts/posts.test.js
● Console
console.warn
warn prisma.disconnect() is deprecated, please use prisma.$disconnect() instead
at NewPrismaClient.disconnect (../node_modules/@prisma/client/src/runtime/getPrismaClient.ts:472:15)
at Object.<anonymous> (../node_modules/@redwoodjs/core/dist/configs/node/jest.setup.js:27:12)
● posts › returns true
TypeError: Cannot read property 'datamodel' of undefined
at Object.<anonymous> (../node_modules/@redwoodjs/core/dist/configs/node/jest.setup.js:22:29)
FAIL web web/src/pages/ContactPage/ContactPage.test.js
● Test suite failed to run
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
Here's what you can do:
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/en/configuration.html
Details:
/Users/rob/Sites/redwoodjs/redwood-tutorial/node_modules/@apollo/client/react/hooks/useSubscription.js:1
import { __assign } from "tslib";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at compileFunction (<anonymous>)
at Runtime._execModule (../node_modules/jest-runtime/build/index.js:1179:56)
at Object.<anonymous> (../node_modules/@redwoodjs/web/dist/index.js:78:24)
at Object.<anonymous> (../node_modules/@redwoodjs/testing/dist/MockProviders.js:15:12)
at Object.<anonymous> (../node_modules/@redwoodjs/testing/dist/customRender.js:17:22)
at Object.<anonymous> (../node_modules/@redwoodjs/testing/dist/index.js:48:21)
at Object.<anonymous> (../node_modules/@redwoodjs/core/dist/configs/browser/jest.setup.js:16:5)
FAIL web web/src/layouts/BlogLayout/BlogLayout.test.js
● Test suite failed to run
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
Here's what you can do:
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/en/configuration.html
Details:
/Users/rob/Sites/redwoodjs/redwood-tutorial/node_modules/@apollo/client/react/hooks/useSubscription.js:1
import { __assign } from "tslib";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at compileFunction (<anonymous>)
at Runtime._execModule (../node_modules/jest-runtime/build/index.js:1179:56)
at Object.<anonymous> (../node_modules/@redwoodjs/web/dist/index.js:78:24)
at Object.<anonymous> (../node_modules/@redwoodjs/testing/dist/MockProviders.js:15:12)
at Object.<anonymous> (../node_modules/@redwoodjs/testing/dist/customRender.js:17:22)
at Object.<anonymous> (../node_modules/@redwoodjs/testing/dist/index.js:48:21)
at Object.<anonymous> (../node_modules/@redwoodjs/core/dist/configs/browser/jest.setup.js:16:5)
FAIL web web/src/pages/BlogPostPage/BlogPostPage.test.js
● Test suite failed to run
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
Here's what you can do:
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/en/configuration.html
Details:
/Users/rob/Sites/redwoodjs/redwood-tutorial/node_modules/@apollo/client/react/hooks/useSubscription.js:1
import { __assign } from "tslib";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at compileFunction (<anonymous>)
at Runtime._execModule (../node_modules/jest-runtime/build/index.js:1179:56)
at Object.<anonymous> (../node_modules/@redwoodjs/web/dist/index.js:78:24)
at Object.<anonymous> (../node_modules/@redwoodjs/testing/dist/MockProviders.js:15:12)
at Object.<anonymous> (../node_modules/@redwoodjs/testing/dist/customRender.js:17:22)
at Object.<anonymous> (../node_modules/@redwoodjs/testing/dist/index.js:48:21)
at Object.<anonymous> (../node_modules/@redwoodjs/core/dist/configs/browser/jest.setup.js:16:5)
FAIL web web/src/pages/HomePage/HomePage.test.js
● Test suite failed to run
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
Here's what you can do:
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/en/configuration.html
Details:
/Users/rob/Sites/redwoodjs/redwood-tutorial/node_modules/@apollo/client/react/hooks/useSubscription.js:1
import { __assign } from "tslib";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at compileFunction (<anonymous>)
at Runtime._execModule (../node_modules/jest-runtime/build/index.js:1179:56)
at Object.<anonymous> (../node_modules/@redwoodjs/web/dist/index.js:78:24)
at Object.<anonymous> (../node_modules/@redwoodjs/testing/dist/MockProviders.js:15:12)
at Object.<anonymous> (../node_modules/@redwoodjs/testing/dist/customRender.js:17:22)
at Object.<anonymous> (../node_modules/@redwoodjs/testing/dist/index.js:48:21)
at Object.<anonymous> (../node_modules/@redwoodjs/core/dist/configs/browser/jest.setup.js:16:5)
FAIL web web/src/components/BlogPost/BlogPost.test.js
● Test suite failed to run
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
Here's what you can do:
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/en/configuration.html
Details:
/Users/rob/Sites/redwoodjs/redwood-tutorial/node_modules/@apollo/client/react/hooks/useSubscription.js:1
import { __assign } from "tslib";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at compileFunction (<anonymous>)
at Runtime._execModule (../node_modules/jest-runtime/build/index.js:1179:56)
at Object.<anonymous> (../node_modules/@redwoodjs/web/dist/index.js:78:24)
at Object.<anonymous> (../node_modules/@redwoodjs/testing/dist/MockProviders.js:15:12)
at Object.<anonymous> (../node_modules/@redwoodjs/testing/dist/customRender.js:17:22)
at Object.<anonymous> (../node_modules/@redwoodjs/testing/dist/index.js:48:21)
at Object.<anonymous> (../node_modules/@redwoodjs/core/dist/configs/browser/jest.setup.js:16:5)
FAIL web web/src/pages/AboutPage/AboutPage.test.js
● Test suite failed to run
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
Here's what you can do:
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/en/configuration.html
Details:
/Users/rob/Sites/redwoodjs/redwood-tutorial/node_modules/@apollo/client/react/hooks/useSubscription.js:1
import { __assign } from "tslib";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at compileFunction (<anonymous>)
at Runtime._execModule (../node_modules/jest-runtime/build/index.js:1179:56)
at Object.<anonymous> (../node_modules/@redwoodjs/web/dist/index.js:78:24)
at Object.<anonymous> (../node_modules/@redwoodjs/testing/dist/MockProviders.js:15:12)
at Object.<anonymous> (../node_modules/@redwoodjs/testing/dist/customRender.js:17:22)
at Object.<anonymous> (../node_modules/@redwoodjs/testing/dist/index.js:48:21)
at Object.<anonymous> (../node_modules/@redwoodjs/core/dist/configs/browser/jest.setup.js:16:5)
FAIL web web/src/components/BlogPostsCell/BlogPostsCell.test.js
● Test suite failed to run
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
Here's what you can do:
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/en/configuration.html
Details:
/Users/rob/Sites/redwoodjs/redwood-tutorial/node_modules/@apollo/client/react/hooks/useSubscription.js:1
import { __assign } from "tslib";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at compileFunction (<anonymous>)
at Runtime._execModule (../node_modules/jest-runtime/build/index.js:1179:56)
at Object.<anonymous> (../node_modules/@redwoodjs/web/dist/index.js:78:24)
at Object.<anonymous> (../node_modules/@redwoodjs/testing/dist/MockProviders.js:15:12)
at Object.<anonymous> (../node_modules/@redwoodjs/testing/dist/customRender.js:17:22)
at Object.<anonymous> (../node_modules/@redwoodjs/testing/dist/index.js:48:21)
at Object.<anonymous> (../node_modules/@redwoodjs/core/dist/configs/browser/jest.setup.js:16:5)
FAIL web web/src/components/BlogPostCell/BlogPostCell.test.js
● Test suite failed to run
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
Here's what you can do:
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/en/configuration.html
Details:
/Users/rob/Sites/redwoodjs/redwood-tutorial/node_modules/@apollo/client/react/hooks/useSubscription.js:1
import { __assign } from "tslib";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at compileFunction (<anonymous>)
at Runtime._execModule (../node_modules/jest-runtime/build/index.js:1179:56)
at Object.<anonymous> (../node_modules/@redwoodjs/web/dist/index.js:78:24)
at Object.<anonymous> (../node_modules/@redwoodjs/testing/dist/MockProviders.js:15:12)
at Object.<anonymous> (../node_modules/@redwoodjs/testing/dist/customRender.js:17:22)
at Object.<anonymous> (../node_modules/@redwoodjs/testing/dist/index.js:48:21)
at Object.<anonymous> (../node_modules/@redwoodjs/core/dist/configs/browser/jest.setup.js:16:5)
Test Suites: 10 failed, 10 total
Tests: 2 failed, 2 total
Snapshots: 0 total
Time: 4.066 s
Ran all test suites in 2 projects.
Watch Usage: Press w to show more.
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (12 by maintainers)
Top Results From Across the Web
Tackle-test: An Automatic Unit-level Test Case Generator
It performs automatic unit test generation for Java applications. It auto... ... Your browser can't play this video.
Read more >Unit testing tutorial | CLion Documentation - JetBrains
This tutorial gives an overview of the unit testing approach and discusses four frameworks supported by CLion: Google Test, Boost.
Read more >Advanced googletest Topics
This document will show you more assertions as well as how to construct complex failure messages, propagate fatal failures, reuse and speed up...
Read more >Django Tutorial Part 10: Testing a Django web application
Django uses the unittest module's built-in test discovery, which will discover tests under the current working directory in any file named ...
Read more >Testing Rails Applications - Ruby on Rails Guides
Testing Rails ApplicationsThis guide covers built-in mechanisms in Rails for ... By requiring this file, test_helper.rb the default configuration to run our ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Confirmed fixed by https://github.com/redwoodjs/redwood/pull/1376
Ahhh yep looks like the same thing. Fix that please. 😉