36 lines
No EOL
955 B
JavaScript
36 lines
No EOL
955 B
JavaScript
module.exports = {
|
|
preset: 'ts-jest/presets/default-esm',
|
|
testEnvironment: 'node',
|
|
|
|
// Tell Jest where to look for source code and tests
|
|
roots: ['<rootDir>/src', '<rootDir>/tests'],
|
|
|
|
// Explicitly match files in the tests folder
|
|
testMatch: [
|
|
'<rootDir>/tests/**/*.test.ts',
|
|
'<rootDir>/tests/**/*.spec.ts'
|
|
],
|
|
|
|
// Tell Jest to treat .ts files as ESM modules
|
|
extensionsToTreatAsEsm: ['.ts'],
|
|
|
|
// Fixes the "Cannot find module" error
|
|
moduleNameMapper: {
|
|
// If the import starts with . or .. and ends with .js, strip the .js
|
|
'^(\\.{1,2}/.*)\\.js$': '$1',
|
|
|
|
// Map the library to mock file
|
|
// This tells Jest to load simple JS file instead of parsing the complex node_module
|
|
//'^@BridgemanAccessible/ba-auth$': '<rootDir>/tests/__mocks__/ba-auth.js'
|
|
},
|
|
|
|
// Configure the transformer to enable ESM support
|
|
transform: {
|
|
'^.+\\.tsx?$': [
|
|
'ts-jest',
|
|
{
|
|
useESM: true,
|
|
}
|
|
]
|
|
}
|
|
}; |