firecmsco / firecms

Awesome Firebase/Firestore-based CMS. The missing admin panel for your Firebase project!
https://firecms.co
Other
1.15k stars 184 forks source link

Following Quickstart, yarn test fails #349

Closed NNskelly closed 1 year ago

NNskelly commented 2 years ago

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.

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?

NNskelly commented 2 years ago

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.

fgatti675 commented 1 year ago

This is a testing issue related to React and typescript. Closing this since it is not directly related to FireCMS