Trying to figure out how to run vitest on compiled javascript. Right now I'm getting a bunch of errors that look like:
TypeError: Cannot read properties of undefined (reading 'spyOn')
TypeError: Cannot read properties of undefined (reading 'mock')
etc...
Which are being thrown by references to vi in my code, eg in index.test.ts:
import { vi, it, describe, beforeAll, expect, afterEach } from 'vitest'
vi.mock('some module')
Here is the relevant compilerOptions from the tsconfig in the module:
"compilerOptions": {
"lib": [
"es2020",
"es2015",
"dom"
],
"module": "commonjs",
"target": "es2020",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"incremental": true,
"noImplicitAny": false,
"moduleResolution": "node",
"sourceMap": true,
"outDir": "./dist",
"strictNullChecks": true,
"types": [
"vitest/globals"
]
}
Any help would be greatly appreciated. Not even sure if this is possible! I'm new to typescript!
Best
from Running vitest on compiled javascript
No comments:
Post a Comment