-
Notifications
You must be signed in to change notification settings - Fork 44
feat: add unit test framework #13
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
Conversation
Don't have strong feelings about this but we might have a better time using https://vitest.dev/ as it has built-in TypeScript and ESM support |
no strong opinions on my side as well, is it something we use in other js repos within MDB? if so I'm happy to shift! |
@blva It's newer so doesn't seem to be used by other projects much; I originally was gonna suggest mocha as that's what we use in other repos but actually jest seems simpler to setup for our purpose right now. Thinking more, maybe let's just stick to jest since the basic configuration looks already done anyhow |
cool! I'll continue with this then, I'd rather stick with technologies we've been working with for now, so jest it is and we can revisit! |
jest.config.js
Outdated
@@ -0,0 +1,207 @@ | |||
/** | |||
* For a detailed explanation regarding each configuration property, visit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto-generated via npm init jest@latest
, we can clean up the comments
}; | ||
}); | ||
|
||
describe("Server initialization", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding a smalll test for now so that we can add tests in next PRs and I'll slowly backfill tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 6 out of 8 changed files in this pull request and generated 1 comment.
Files not reviewed (2)
- package.json: Language not supported
- tsconfig.jest.json: Language not supported
tsconfig.jest.json
Outdated
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"module": "commonjs", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is actually contradicting main tsconfig.json, do we need it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need the module, but I can update to esnext
as it seems to work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry actually, we can't use nodenext
here, it doesn't work well w/ isolated modules, but esnext
works
@blva https://jestjs.io/docs/ecmascript-modules Seems like ESM support is experimental in Jest. |
@gagik works for me, can you fix the tests in the PR so we can merge to start adding mroe tests |
@blva Actually upon further investigation, I think this is actually the best experience after all, mocha isn't much different 😅 Sorry for the bunch of back and forth, was just trying to make sure we're not regressing the TS setup but this should work best. If we can rename |
Uh oh!
There was an error while loading. Please reload this page.