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

npm test fails #162

Closed
JJ opened this issue Nov 1, 2020 · 2 comments · Fixed by #163
Closed

npm test fails #162

JJ opened this issue Nov 1, 2020 · 2 comments · Fixed by #163

Comments

@JJ
Copy link
Contributor

JJ commented Nov 1, 2020

Just following straight instructions I get this. This is an admittedly old node, 8.12

npm test

> [email protected] test /home/jmerelo/Code/js/typescript-action
> jest

 FAIL  __tests__/main.test.ts
  ● 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:

    /home/jmerelo/Code/js/typescript-action/node_modules/jest-circus/node_modules/jest-matcher-utils/build/index.js:136
      } catch {
              ^

    SyntaxError: Unexpected token {

      at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:537:17)
      at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:579:25)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.039s
Ran all test suites.
npm ERR! Test failed.  See above for more details.

Latest version. 14, does not have a problem (it issues another series of warnings though)

JJ added a commit to JJ/javascript-template that referenced this issue Nov 1, 2020
@Cyberbeni
Copy link
Contributor

Currently only node12 is supported for GitHub Actions and I don't expect any older versions will be supported in the future.

There is already an issue about supporting node14 if you are waiting to use that: actions/runner#772

@JJ
Copy link
Contributor Author

JJ commented Nov 14, 2020

I'm really not. My point (and PR) goes in the direction of making explicit versions you should be using locally to test your actions.

hross pushed a commit that referenced this issue Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants