Skip to content
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

Improve commonjs compatibility #15

Merged
merged 1 commit into from
Nov 29, 2023
Merged

Improve commonjs compatibility #15

merged 1 commit into from
Nov 29, 2023

Conversation

bsdelf
Copy link
Contributor

@bsdelf bsdelf commented Nov 21, 2023

Recently, we encountered following error in unit test:

Testing...
 FAIL  src/sms-auth/sms-auth.service.spec.ts
  ● Test suite failed to run

    src/sms-auth/sms-auth.service.spec.ts:44:15 - error TS2749: 'Bunyan' refers to a value, but is being used as a type here. Did you mean 'typeof Bunyan'?

    44   let logger: Bunyan;
                     ~~~~~~

it turns out we need to enable esModuleInterop for this library, so ts-jest can transform the imports correctly.

Reference: https://github.com/kulshekhar/ts-jest/wiki/Troubleshooting#commonjs-compatibility

package.json Outdated
@@ -33,6 +33,7 @@
"dependencies": {
"@nestjs/common": "^9.3.12",
"@nestjs/core": "^9.3.12",
"@types/supertest": "^2.0.16",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't be devDependencies?

@bsdelf bsdelf merged commit 244da40 into master Nov 29, 2023
1 check passed
@bsdelf bsdelf deleted the feat-commonjs-compat branch November 29, 2023 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants