- Notifications
You must be signed in to change notification settings - Fork478
Closed
Description
Hi!
I'm trying to get unit tests to work properly and don't know how to deal with the following situation:
I started a new project withnpm init vue@3
like so:
✔ Add TypeScript? … No /Yes
✔ Add JSX Support? …No / Yes
✔ Add Vue Router for Single Page Application development? …No / Yes
✔ Add Pinia for state management? …No / Yes
✔ Add Vitest for Unit Testing? … No /Yes
✔ Add Cypress for End-to-End testing? …No / Yes
✔ Add ESLint for code quality? … No /Yes
✔ Add Prettier for code formatting? …No / Yes
At root of thesrc
folder I add a simple TS file:
exportconstadd=(a:number,b:number)=>a+b;
And in my test, when I import it:
import{add}from'../utils';
I get the following error message:
module "...../src/utils"File '..../src/utils.ts' is not listed within the file list of project '..../tsconfig.vitest.json'. Projects must list all files or use an 'include' pattern.ts(6307)
I left the tsconfigs file untouched, but here there are:
{ "extends": "@vue/tsconfig/tsconfig.web.json", "include": ["env.d.ts", "src/**/*", "src/**/*.vue"], "exclude": ["src/**/__tests__/*"], "compilerOptions": { "baseUrl": ".", "paths": { "@/*": ["./src/*"] } }, "references": [ { "path": "./tsconfig.vite-config.json" }, { "path": "./tsconfig.vitest.json" } ]}
{ "extends": "@vue/tsconfig/tsconfig.node.json", "include": ["src/**/__tests__/*"], "compilerOptions": { "composite": true, "baseUrl": ".", "paths": { "@/*": ["./src/*"] }, "types": ["node", "jsdom"] }}
Metadata
Metadata
Assignees
Labels
No labels