Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Projects must list all files or use an 'include' pattern.ts(6307) #55

Copy link
Copy link
Closed
@paparent

Description

@paparent
Issue body actions

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 with npm 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 the src folder I add a simple TS file:

export const add = (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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.