Having a problem while running Jest in my TypeScript project. The TypeScript file is located at rootDir/src/_services/index.ts and Jest is throwing an error:
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){export * from './auth.service'; ^^^^^^
SyntaxError: Unexpected token 'export'
The issue seems to be with the statement export * from './auth.service';
in index.ts that Jest is having trouble parsing.
My Jest configuration is custom and uses ts-jest. Here is a snippet from the Jest configuration file:
const createJestConfig = nextJest({
dir: './',
});
const customJestConfig = {
// ... other configurations ...
transformIgnorePatterns: [
'/node_modules/',
'/@bufbuild/protobuf/',
'/src/_services/index\\.ts$', // Ignoring this path
],
// ... other configurations ...
};
module.exports = createJestConfig(customJestConfig);