Conversation
hollabaq86
left a comment
There was a problem hiding this comment.
Great stuff! Excited for this work
| isPotentiallyValid: boolean; | ||
| }; | ||
|
|
||
| export type CreditCardType = { |
jplukarski
left a comment
There was a problem hiding this comment.
A couple questions, and it looks like the tests are failing for what might be a Common.js issue?
Great stuff!
src/__tests__/tsconfig.json
Outdated
| @@ -1,5 +1,6 @@ | |||
| { | |||
| "compilerOptions": { | |||
| "moduleResolution": "nodenext", | |||
There was a problem hiding this comment.
Curious, what does this do?
There was a problem hiding this comment.
It instructs TypeScript to use Node.js-style module resolution for the tests.
Changed to "node"
| month: string | null; | ||
| year: string | null; | ||
| } | ||
| import type { ExpirationDateVerification } from "./types"; |
There was a problem hiding this comment.
Love the renaming of this variable
There was a problem hiding this comment.
is this rename a breaking change?
| }; | ||
|
|
||
| export = cardValidator; | ||
| export default cardValidator; |
There was a problem hiding this comment.
Does changing this to have a default export change the way consumers of this module import it?
There was a problem hiding this comment.
Yes, you can see the change in the __tests__/credit-card-type.ts file
Before: import cardValidator = require("../")
After:import cardValidator from "../"
There was a problem hiding this comment.
Got it! Would this be a breaking change?
There was a problem hiding this comment.
same concern here, would this be a breaking change?
https://www.typescriptlang.org/tsconfig#moduleResolution
|
Quick PR Summary
Why
Vitest is a "blazingly fast" unit test framework, and allows us to leave the test suite running in a watch-mode environment while we continue to make changes to our code. Only the necessary tests will re-run depending on what files were changed, making it much quicker to make changes without having to wait for the entire test suite to re-run.
Vitest has also been designed with a Jest compatible API, in order to make the migration from Jest as simple as possible. The API is essentially the same as Jest with some very minor differences.