vitest-config-silverwind 8.0.0 → 8.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +9 -7
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -2,7 +2,9 @@ import {join, dirname, basename, relative, sep} from "node:path";
2
2
  import {fileURLToPath} from "node:url";
3
3
  import {stringPlugin} from "vite-string-plugin";
4
4
 
5
- const base = ({url, test = {}, plugins = [], ...other} = {}) => ({
5
+ const uniq = arr => Array.from(new Set(arr));
6
+
7
+ const base = ({url, test: {setupFiles = [], ...otherTest}, plugins = [], ...other} = {}) => ({
6
8
  test: {
7
9
  include: [
8
10
  "**/?(*.)test.?(c|m)[jt]s?(x)",
@@ -11,10 +13,10 @@ const base = ({url, test = {}, plugins = [], ...other} = {}) => ({
11
13
  "**/{node_modules,dist,e2e,snapshots}/**",
12
14
  "**/.{air,git,github,gitea,swc,ruff_cache,venv,vscode}/**",
13
15
  ],
14
- setupFiles: [
16
+ setupFiles: uniq([
15
17
  fileURLToPath(new URL("vitest.setup.js", import.meta.url)),
16
- ...(test.setupFiles || []),
17
- ],
18
+ ...setupFiles,
19
+ ]),
18
20
  testTimeout: 30000,
19
21
  pool: "forks", // https://github.com/vitest-dev/vitest/issues/2008
20
22
  cache: false, // https://github.com/vitest-dev/vitest/issues/2008
@@ -32,12 +34,12 @@ const base = ({url, test = {}, plugins = [], ...other} = {}) => ({
32
34
  return join(dirname(path), "snapshots", `${basename(path)}${extension}`);
33
35
  }
34
36
  },
35
- ...test,
37
+ ...otherTest,
36
38
  },
37
- plugins: [
39
+ plugins: uniq([
38
40
  stringPlugin,
39
41
  ...plugins,
40
- ],
42
+ ]),
41
43
  ...other,
42
44
  });
43
45
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitest-config-silverwind",
3
- "version": "8.0.0",
3
+ "version": "8.0.2",
4
4
  "description": "Shared vitest configuration",
5
5
  "author": "silverwind <me@silverwind.io>",
6
6
  "repository": "silverwind/vitest-config-silverwind",