-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrading to 3.7.0 #113
Comments
My bad, forgot to add |
Thanks! That removed the linting errors, but my tests still fail. |
Okay managed to get rid of
|
Looks like in if (promise == null)
promise = hasAsyncInitializer(service) ? readyMap.get(service).then(() => target) : Promise.resolve(target);
|
Are you building ESM? |
I weren't able to make work ESM+TS+Jest so in one of my projects I switched to tap and mocha in ESM example |
Hope in Jest 27 it will work |
I am building for commonjs and everything works, except for tests. So I created a separate tsconfig for tests:
Now I just realized, that while Following apporach doesn't seem to work either: jest.config.ts: preset: 'ts-jest/presets/js-with-ts',
transform: {
'^.+\\.(j|t)s?$': 'ts-jest',
},
transformIgnorePatterns: ['<rootDir>/node_modules/(?!fastify-decorators)'], tsconfig.spec.json: {
"compilerOptions": {
"lib": [
"es2019",
"es2020.promise",
"es2020.bigint",
"es2020.string"
],
"module": "commonjs",
"target": "es2019",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": "./",
"paths": {
"@/*": [
"src/*"
]
},
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"noImplicitAny": true,
"noUnusedLocals": true,
"strictNullChecks": true,
"allowJs": true
}
} |
Can you explain further what are the obstacles here? |
I'm going to create and investigate sample repository tomorrow, for a moment you can try to build your application and tests and then run tests on transpiled code or switch to another test framework (I think you would like avoid it) |
Thanks! Actually building tests and testing against dist might make sence. I can't afford to switch to another testing FW atm... |
Update: I ended up reverting all the changes and kept my original ts-config (module: 'commonjs') by simply hard-mapping js to cjs in moduleNameMapper: {
// ...
'fastify-decorators/testing': 'fastify-decorators/testing/index.cjs',
// ...
}, |
Very nice! I think this should be noticed here |
Here's PR about adding support for TS + ESM: jestjs/jest#10823, it's already merged but I didn't managed how to make it work yet, for a while I added section to documentation about configuring Jest |
Thanks, will check this soon. |
I think this can be closed now |
I'm having a bit of trouble upgrading to latest (after esm/cjs changes), some of my tests (ts-jest) now fail with:
Linting tests also fails:
I'm not entirely sure what needs to be changed here... Any help will be appreciated.
Update:
Might not be related, but in package.json I can see
however, there is no
index.cjs
present...The text was updated successfully, but these errors were encountered: