firecms
firecms copied to clipboard
Following Quickstart, yarn test fails
On top of and while pursuing fixes for https://github.com/Camberi/firecms/issues/340 , I ran yarn test
on a project created by following https://firecms.co/docs/quickstart/ on Tuesday 2022.7.26 , with the minor exception of naming the app test-cms
instead of my-cms
.
- New Firebase project, with Google auth, Firestore, and Storage enabled.
- Installed yarn and react via npm for the first time just prior to setting up FireCMS.
- Copy-pasted the provided App.tsx code, including swapping in the correct Firebase credentials.
- Made the cited issues/340 fixes to the start & build commands (which shouldn't have affected test, but is how I noticed test).
- ran
yarn test
with the following output:
D:\NN_D\FireCMS_test\test-cms>yarn test
yarn run v1.22.19
$ react-scripts test
FAIL src/App.test.tsx
● Test suite failed to run
Jest encountered an unexpected token
Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.
Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.
By default "node_modules" folder is ignored by transformers.
Here's what you can do:
• If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it.
• If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript
• 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/configuration
For information about custom transformations, see:
https://jestjs.io/docs/code-transformation
Details:
D:\NN_D\FireCMS_test\test-cms\node_modules\react-markdown\index.js:6
export {uriTransformer} from './lib/uri-transformer.js'
^^^^^^
SyntaxError: Unexpected token 'export'
at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1728:14)
at Object.<anonymous> (node_modules/@uiw/react-markdown-preview/src/index.tsx:2:1)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 211.53 s
Ran all test suites related to changed files.
Watch Usage
› Press a to run all tests.
› Press f to run only failed tests.
› Press q to quit watch mode.
› Press p to filter by a filename regex pattern.
› Press t to filter by a test name regex pattern.
› Press Enter to trigger a test run.
Are there additional configuration steps not listed in the quickstart (e.g. I doubt this is related to test, but I think you need to set up firebase to use /build as its public html directory, or else configure FireCMS to build to /public in order for seamless build-deploy to work)? Are there additional dependencies here that would be obvious to a long-time user of react/yarn but not to someone following a guide for the first time?
Update: after following https://jestjs.io/docs/getting-started#using-typescript for literal hours (each yarn add needs to review some 90k dependencies........), jest still can't make sense of the export command. Not sure where to explore next.
This is a testing issue related to React and typescript. Closing this since it is not directly related to FireCMS