Skip to content
This repository has been archived by the owner on Oct 18, 2023. It is now read-only.

feat: jest with esm support #3911

Merged
merged 35 commits into from
Jun 29, 2023
Merged

Conversation

sublimator
Copy link
Member

@sublimator sublimator commented Jun 27, 2023

Changes

  1. Unified jest.config.cjs: We've simplified our Jest setup by deploying one jest.config.cjs file in each workspace. This file now treats .mts files as ESM by adding them to extensionsToTreatAsEsm and moduleFileExtensions. The configuration now also collects all workspace Jest configurations as projects.

  2. Removal of jest-e2e.config.cjs: We've deleted the jest-e2e.config.cjs files, further streamlining the configuration process.

  3. Usage of PROJECT_JEST Variable: The PROJECT_JEST environment variable should be set in the package.json scripts in each workspace. This signals to Jest when workspace tests are run directly, rather than being collected from the monorepo root.

  4. Update in package.json Test Scripts: In the test scripts of the root package.json, we've set the NODE_OPTIONS variable to --experimental-vm-modules.

  5. Removal of @types/jest: We've removed @types/jest and now import globals from @jest/globals instead.

By employing this strategy, we've streamlined the Jest configuration process for ESM support, improved the manageability of Jest setup for each workspace, and facilitated a smoother, more gradual transition from CJS to ESM.

jest.config.mjs Outdated Show resolved Hide resolved
@sublimator sublimator marked this pull request as ready for review June 29, 2023 01:05
@sublimator sublimator merged commit fe83957 into main Jun 29, 2023
18 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant