Replies: 1 comment 4 replies
-
You need to add your source code files to // vitest.config.ts
export default {
test: {
includeSource: ['src/**/utils.ts']
}
} And use export function add(...args: number[]) {
return args.reduce((a, b) => a + b, 0)
}
if (import.meta.vitest) {
const { it, expect } = import.meta.vitest
it('add', () => {
expect(add()).toBe(0)
expect(add(1)).toBe(1)
expect(add(1, 2, 3)).toBe(6)
})
} |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How do I set up
vitest
forin-source
testing, so that I can usereflect-metadata
and prototype extensions for example?Beta Was this translation helpful? Give feedback.
All reactions