🐛 Bug Report
I am getting this error when I configure ts-jest to process a ESM module with the .js extension.
Unable to process '/Users/newuser/forks/aws-mobile-appsync-sdk-js/packages/aws-appsync/node_modules/@apollo/client/utilities/utilities.cjs.js'. Please make sure that `outDir` in your tsconfig is neither `''` or `'.'`.
at compileFn (../../node_modules/ts-jest/dist/compiler/language-service.js:508:15)
at Object.compile (../../node_modules/ts-jest/dist/compiler/instance.js:39:21)
at TsJestTransformer.process (../../node_modules/ts-jest/dist/ts-jest-transformer.js:85:41)
at ScriptTransformer.transformSource (../../node_modules/@jest/transform/build/ScriptTransformer.js:464:35)
at ScriptTransformer._transformAndBuildScript (../../node_modules/@jest/transform/build/ScriptTransformer.js:569:40)
at ScriptTransformer.transform (../../node_modules/@jest/transform/build/ScriptTransformer.js:607:25)
To Reproduce
Steps to reproduce the behavior:
This is my jest.config.js file
const esModules = ['@apollo/.*'].join('|');
module.exports = {
transform: {
'^.+\\.tsx?$': 'ts-jest',
'^.+\\.jsx?$': 'ts-jest',
},
transformIgnorePatterns: [`/node_modules/(?!${esModules})`],
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
collectCoverageFrom: ['src/**/*', '!src/vendor/**'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
testEnvironment: 'node',
preset: 'ts-jest/presets/js-with-ts',
globals: {
'ts-jest': {
tsconfig: 'tsconfig.test.json',
},
},
};
And my tsconfig.test.json file:
{
"compilerOptions": {
"outDir": "lib",
"rootDir": "src",
"module": "commonjs",
"target": "es5",
"moduleResolution": "node",
"declaration": true,
"lib": ["dom", "es6", "esnext.asynciterable", "es2017.object"],
"skipLibCheck": true,
"allowJs": true
},
"exclude": ["lib", "__tests__"],
"compileOnSave": true
}
Expected behavior
I expect the file to compile.
Here is the repo. Use yarn to install the dependencies and run the tests under packages/aws-appsync
https://github.com/volkanunsal/aws-mobile-appsync-sdk-js
envinfo
System:
OS: Mac
Node version: 15.4
Npm packages:
jest: 26.6.3
ts-jest: 26.5
typescript: 4.2.2
babel(optional): 7.13.1
TS_JEST_LOG:
It gets cut off. So I'm copying the last line, which seems to be the most relevant.
{"context":{"fileName":"/Users/newuser/forks/aws-mobile-appsync-sdk-js/packages/aws-appsync/node_modules/@apollo/client/utilities/utilities.cjs.js","logLevel":20,"namespace":"ts-compiler","package":"ts-jest","version":"26.5.2"},"message":"compileFn(): computing diagnostics using language service","sequence":2142,"time":"2021-02-27T20:34:09.856Z"}
🐛 Bug Report
I am getting this error when I configure ts-jest to process a ESM module with the .js extension.
To Reproduce
Steps to reproduce the behavior:
This is my
jest.config.jsfileAnd my
tsconfig.test.jsonfile:{ "compilerOptions": { "outDir": "lib", "rootDir": "src", "module": "commonjs", "target": "es5", "moduleResolution": "node", "declaration": true, "lib": ["dom", "es6", "esnext.asynciterable", "es2017.object"], "skipLibCheck": true, "allowJs": true }, "exclude": ["lib", "__tests__"], "compileOnSave": true }Expected behavior
I expect the file to compile.
Here is the repo. Use yarn to install the dependencies and run the tests under
packages/aws-appsynchttps://github.com/volkanunsal/aws-mobile-appsync-sdk-js
envinfo
TS_JEST_LOG:
It gets cut off. So I'm copying the last line, which seems to be the most relevant.