diff --git a/src/config.js b/src/config.js index b815e20..4664545 100644 --- a/src/config.js +++ b/src/config.js @@ -28,20 +28,25 @@ function getCoveragePaths() { } const jestConfig = { - rootDir: PROJECT_ROOT, - moduleFileExtensions: ['js', 'html'], + // Inherited from @lwc/jest-preset + moduleFileExtensions: jestPreset.moduleFileExtensions || ['ts', 'js', 'html'], testEnvironment: jestPreset.testEnvironment || 'jsdom', transform: { - '^.+\\.(js|html|css)$': require.resolve('@lwc/jest-transformer'), + ...jestPreset.transform, + '^.+\\.(js|ts|html|css)$': require.resolve('@lwc/jest-transformer'), }, + setupFilesAfterEnv: jestPreset.setupFilesAfterEnv || [], + snapshotSerializers: jestPreset.snapshotSerializers || [ + require.resolve('@lwc/jest-serializer'), + ], + // Specific to sfdx-lwc-jest + collectCoverageFrom: getCoveragePaths(), + resolver: path.join(__dirname, './resolver.js'), + rootDir: PROJECT_ROOT, + testPathIgnorePatterns: ['/node_modules/', '/test/specs/'], transformIgnorePatterns: [ '/node_modules/(?!(.*@salesforce/sfdx-lwc-jest/src/lightning-stubs)/)', ], - setupFilesAfterEnv: jestPreset.setupFilesAfterEnv || [], - resolver: path.resolve(__dirname, './resolver.js'), - testPathIgnorePatterns: ['/node_modules/', '/test/specs/'], - collectCoverageFrom: getCoveragePaths(), - snapshotSerializers: [require.resolve('@lwc/jest-serializer')], }; const expectedApiVersion = '61.0';