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

Babel error when running Jest tests #26

Open
Shelob9 opened this issue Apr 8, 2021 · 0 comments
Open

Babel error when running Jest tests #26

Shelob9 opened this issue Apr 8, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@Shelob9
Copy link

Shelob9 commented Apr 8, 2021

Describe the bug

When using the npm run test command, from the root of the repo or the root of the theme, I get errors like this and the tests fail:

[BABEL] /home/josh/wp-scaffold/themes/10up-theme/includes/blocks/example-block/test.test.js: Unknown option: .wordpress. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.
    - Maybe you meant to use
    "preset": [
      ["@10up/babel-preset-default", {
      "wordpress": true
    }]
    ]
    To be a valid preset, its name and options should be wrapped in a pair of brackets

      at throwUnknownError (node_modules/@babel/core/lib/config/validation/options.js:131:27)
      at node_modules/@babel/core/lib/config/validation/options.js:116:5
          at Array.forEach (<anonymous>)
      at validateNested (node_modules/@babel/core/lib/config/validation/options.js:92:21)
      at validate (node_modules/@babel/core/lib/config/validation/options.js:83:10)
      at node_modules/@babel/core/lib/config/full.js:320:36
      at cachedFunction (node_modules/@babel/core/lib/config/caching.js:52:27)
          at cachedFunction.next (<anonymous>)
      at evaluateSync (node_modules/gensync/index.js:251:28)
      at sync (node_modules/gensync/index.js:89:14)

Steps to Reproduce

  1. Download wp-scaffold
  2. Add "themes/10up-theme/includes/blocks/example-block/test.test.js"
  3. Add any test to that dir test( 'something', ()=> { expect(1).toBe(1);
  4. See error
  5. Run npm run test from the theme's directory.
  6. Add a test to the mu-plugin
  7. See two of the same error

Environment information

  • Device: Window Laptop
  • OS: Windows 10 Pro with WSL/2. Issue is happening with Ubuntu 20.04.2 LTS
  • Tested with Node 12 and Node 14.
  • NPM 6.14.11
@Shelob9 Shelob9 added the bug Something isn't working label Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant