Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jest tests aren't working #30

Open
grigory-bogush opened this issue Jul 13, 2021 · 3 comments
Open

Jest tests aren't working #30

grigory-bogush opened this issue Jul 13, 2021 · 3 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@grigory-bogush
Copy link
Contributor

grigory-bogush commented Jul 13, 2021

Compilation of the project works fine but as soon as try to run tests it fails with an odd syntax error that is not present when the craco-esbuild is disabled in craco.config.js.
Perhaps there is a way to add this plugin for build & start leaving tests as is?
Any help would be appreciated.

yarn test
yarn run v1.22.10
$ craco test --watchAll=false
 FAIL  src/utils/__test__/utils.spec.ts
  ● Test suite failed to run

    Transform failed with 1 error:
    <stdin>:59:4: error: Expected "}" but found ":"

      at failureErrorWithLog (node_modules/esbuild/lib/main.js:1443:15)
      at node_modules/esbuild/lib/main.js:1254:29
      at node_modules/esbuild/lib/main.js:606:9
      at handleIncomingPacket (node_modules/esbuild/lib/main.js:703:9)
      at readFromStdout (node_modules/esbuild/lib/main.js:573:7)
      at runServiceSync (node_modules/esbuild/lib/main.js:1808:3)
      at Object.transformSync (node_modules/esbuild/lib/main.js:1650:3)
      at Object.process (node_modules/esbuild-jest/esbuild-jest.js:54:36)
      at ScriptTransformer.transformSource (node_modules/@jest/transform/build/ScriptTransformer.js:464:35)
      at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:569:40)
      at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:607:25)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        1.565 s
Ran all test suites.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I am using react-scripts 4.0.3

@pradel
Copy link
Owner

pradel commented Jul 25, 2021

Happy to accept a pr to add an option for this :)

@pradel pradel added bug Something isn't working enhancement New feature or request labels Jul 25, 2021
@pradel
Copy link
Owner

pradel commented Jul 25, 2021

Published as 0.3.3 thanks for the pr @grigory-bogush

@yaronya
Copy link
Contributor

yaronya commented Aug 15, 2021

hey @grigory-bogush
did you have any lead on why transformation fails? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants