Skip to content

Error on import to test file when using @wordpress/scripts to run tests #16262

Description

@Shelob9

Describe the bug
When running yarn test:unit in a plugin using @wordpress/scripts I get errors like this:
Cannot find module 'core-js/modules/es.date.to-json' from 'Form.test.js' It is triggered by the first import in any test files.

I fixed it by adding @core-js after reading this: TryGhost/gatsby-starter-ghost#29 (comment)

To reproduce
Steps to reproduce the behavior:

  1. Add a test
  2. yarn test:unit
  3. See error described above
  4. See error

Expected behavior
This should not be required.

Desktop (please complete the following information):

  • OS: Windows 10
  • Version "@wordpress/scripts@3.3.0"
  • Node v10.16.0

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Metadata

Metadata

Assignees

Labels

[Status] In ProgressTracking issues with work in progress[Tool] WP Scripts/packages/scripts[Type] BugAn existing feature does not function as intended

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions