- Set "type": "module" in package.json to enable ESM throughout the project. - Changed "main" in package.json to "dist/index.js" to point to the bundled output generated by ncc. - Updated Jest configuration (jest.config.js) to ESM format and to use babel-jest for TypeScript transformation. - Added/updated babel.config.js in ESM format to support TypeScript and ESM for Jest. - Ensured test scripts use NODE_OPTIONS=--experimental-vm-modules for Jest ESM compatibility.
15 lines
356 B
JavaScript
15 lines
356 B
JavaScript
import babel from 'babel-jest';
|
|
|
|
export default {
|
|
testEnvironment: 'node',
|
|
extensionsToTreatAsEsm: ['.ts'],
|
|
transform: {
|
|
'^.+\\.ts$': ['babel-jest', { configFile: './babel.config.js' }]
|
|
},
|
|
moduleNameMapper: {},
|
|
verbose: true,
|
|
collectCoverage: true,
|
|
coverageDirectory: 'coverage',
|
|
testMatch: ['**/*.test.ts'],
|
|
resolver: undefined,
|
|
}; |