2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Vitest でデフォルトの exclude ルールをベースに Project のルールを設定する。

Last updated at Posted at 2024-10-28

はじめに

  • Vitest を導入した Project で Vitest に参照してほしくない path が出てきた
    • 今回はテストカバレッジの集計から除外したかった
  • デフォルトの設定を維持しつつ設定を追加したい場合以下のように設定すれば良い

default 設定を維持したまま除外する

coverageConfigDefaults を import し、 Other exclude config here ... と記載している場所に設定を追加すれば良い。

vite.config.ts
  import { defineConfig } from "vite";
+ import { coverageConfigDefaults } from "vitest/config";

  export default defineConfig({
    test: {
      exclude: [
+       ...coverageConfigDefaults.exclude,
        // Other exclude config here ...
      ]
    },
  });

Ref

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?