@aryaemami59/vitest-config 0.0.6 → 0.0.8
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.
- package/dist/index.cjs +13 -269
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -9
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -251
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
- package/src/defaults.ts +0 -6
package/dist/index.cjs
CHANGED
|
@@ -1,37 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
4
|
let vite_tsconfig_paths = require("vite-tsconfig-paths");
|
|
3
5
|
let vitest_config = require("vitest/config");
|
|
4
6
|
|
|
5
|
-
//#region src/plugins.ts
|
|
6
|
-
/**
|
|
7
|
-
* Default configuration for {@linkcode tsconfigPaths}.
|
|
8
|
-
*
|
|
9
|
-
* @since 0.0.5
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
const tsconfigPathsOptions = {
|
|
13
|
-
configNames: ["tsconfig.json"],
|
|
14
|
-
projects: ["./tsconfig.json"]
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* plugins for {@linkcode vitestProjectDefaults}.
|
|
18
|
-
*
|
|
19
|
-
* @since 0.0.5
|
|
20
|
-
* @public
|
|
21
|
-
*/
|
|
22
|
-
const plugins = [/* @__PURE__ */ (0, vite_tsconfig_paths.default)(tsconfigPathsOptions)];
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
7
|
//#region src/defaults.ts
|
|
26
|
-
/**
|
|
27
|
-
* Default configuration for {@linkcode vitestProject}.
|
|
28
|
-
*
|
|
29
|
-
* @since 0.0.5
|
|
30
|
-
* @public
|
|
31
|
-
*/
|
|
32
8
|
const vitestProjectDefaults = {
|
|
33
9
|
define: { "import.meta.vitest": "undefined" },
|
|
34
|
-
plugins,
|
|
35
10
|
test: {
|
|
36
11
|
clearMocks: true,
|
|
37
12
|
globals: true,
|
|
@@ -43,12 +18,6 @@ const vitestProjectDefaults = {
|
|
|
43
18
|
unstubGlobals: true
|
|
44
19
|
}
|
|
45
20
|
};
|
|
46
|
-
/**
|
|
47
|
-
* Default configuration for {@linkcode vitestConfig}.
|
|
48
|
-
*
|
|
49
|
-
* @since 0.0.5
|
|
50
|
-
* @public
|
|
51
|
-
*/
|
|
52
21
|
const vitestConfigDefaults = {
|
|
53
22
|
...vitestProjectDefaults,
|
|
54
23
|
test: {
|
|
@@ -59,255 +28,30 @@ const vitestConfigDefaults = {
|
|
|
59
28
|
}
|
|
60
29
|
};
|
|
61
30
|
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/plugins.ts
|
|
33
|
+
const tsconfigPathsOptions = {
|
|
34
|
+
configNames: ["tsconfig.json"],
|
|
35
|
+
projects: ["./tsconfig.json"]
|
|
36
|
+
};
|
|
37
|
+
const plugins = [/* @__PURE__ */ (0, vite_tsconfig_paths.default)(tsconfigPathsOptions)];
|
|
38
|
+
|
|
62
39
|
//#endregion
|
|
63
40
|
//#region src/shareableConfigs.ts
|
|
64
|
-
/**
|
|
65
|
-
* Shareable {@link https://vitest.dev | **Vitest**}
|
|
66
|
-
* configuration tailored for projects using TypeScript.
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* <caption>#### __ECMAScript Modules (ESM) usage inside a file like `vitest.config.mts` or `vitest.config.mjs`__</caption>
|
|
70
|
-
*
|
|
71
|
-
* ```ts
|
|
72
|
-
* import { vitestConfig } from '@aryaemami59/vitest-config'
|
|
73
|
-
*
|
|
74
|
-
* export default vitestConfig
|
|
75
|
-
* ```
|
|
76
|
-
*
|
|
77
|
-
* @example
|
|
78
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using `require`)__</caption>
|
|
79
|
-
*
|
|
80
|
-
* ```ts
|
|
81
|
-
* const { vitestConfig } = require('@aryaemami59/vitest-config')
|
|
82
|
-
*
|
|
83
|
-
* module.exports = vitestConfig
|
|
84
|
-
* ```
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using dynamic import)__</caption>
|
|
88
|
-
*
|
|
89
|
-
* ```ts
|
|
90
|
-
* module.exports = (async () =>
|
|
91
|
-
* (await import('@aryaemami59/vitest-config')).vitestConfig)()
|
|
92
|
-
* ```
|
|
93
|
-
*
|
|
94
|
-
* @example
|
|
95
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` (using import and export assignment)__</caption>
|
|
96
|
-
*
|
|
97
|
-
* ```ts
|
|
98
|
-
* import vitestConfigModule = require('@aryaemami59/vitest-config')
|
|
99
|
-
* import vitestConfig = vitestConfigModule.vitestConfig
|
|
100
|
-
*
|
|
101
|
-
* export = vitestConfig
|
|
102
|
-
* ```
|
|
103
|
-
*
|
|
104
|
-
* @since 0.0.3
|
|
105
|
-
* @public
|
|
106
|
-
*/
|
|
107
41
|
const vitestConfig = /* @__PURE__ */ (0, vitest_config.defineConfig)(vitestConfigDefaults);
|
|
108
|
-
/**
|
|
109
|
-
* Shareable {@link https://vitest.dev | **Vitest**}
|
|
110
|
-
* configuration tailored for projects using TypeScript.
|
|
111
|
-
*
|
|
112
|
-
* @example
|
|
113
|
-
* <caption>#### __ECMAScript Modules (ESM) usage inside a file like `vitest.config.mts` or `vitest.config.mjs`__</caption>
|
|
114
|
-
*
|
|
115
|
-
* ```ts
|
|
116
|
-
* import { vitestProject } from '@aryaemami59/vitest-config'
|
|
117
|
-
*
|
|
118
|
-
* export default vitestProject
|
|
119
|
-
* ```
|
|
120
|
-
*
|
|
121
|
-
* @example
|
|
122
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using `require`)__</caption>
|
|
123
|
-
*
|
|
124
|
-
* ```ts
|
|
125
|
-
* const { vitestProject } = require('@aryaemami59/vitest-config')
|
|
126
|
-
*
|
|
127
|
-
* module.exports = vitestProject
|
|
128
|
-
* ```
|
|
129
|
-
*
|
|
130
|
-
* @example
|
|
131
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using dynamic import)__</caption>
|
|
132
|
-
*
|
|
133
|
-
* ```ts
|
|
134
|
-
* module.exports = (async () =>
|
|
135
|
-
* (await import('@aryaemami59/vitest-config')).vitestProject)()
|
|
136
|
-
* ```
|
|
137
|
-
*
|
|
138
|
-
* @example
|
|
139
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` (using import and export assignment)__</caption>
|
|
140
|
-
*
|
|
141
|
-
* ```ts
|
|
142
|
-
* import vitestConfigModule = require('@aryaemami59/vitest-config')
|
|
143
|
-
* import vitestProject = vitestConfigModule.vitestProject
|
|
144
|
-
*
|
|
145
|
-
* export = vitestProject
|
|
146
|
-
* ```
|
|
147
|
-
*
|
|
148
|
-
* @since 0.0.5
|
|
149
|
-
* @public
|
|
150
|
-
*/
|
|
151
42
|
const vitestProject = /* @__PURE__ */ (0, vitest_config.defineProject)(vitestConfigDefaults);
|
|
152
43
|
|
|
153
44
|
//#endregion
|
|
154
45
|
//#region src/utils.ts
|
|
155
|
-
/**
|
|
156
|
-
* A function that returns {@linkcode vitestConfig}
|
|
157
|
-
* along with optional additional overrides.
|
|
158
|
-
*
|
|
159
|
-
* @param [additionalOverrides={}] - **Optional** additional overrides to apply to the configuration.
|
|
160
|
-
* @returns An augmented version of the default {@linkcode vitestConfig}, incorporating any provided overrides.
|
|
161
|
-
*
|
|
162
|
-
* @example
|
|
163
|
-
* <caption>#### __ECMAScript Modules (ESM) usage inside a file like `vitest.config.mts` or `vitest.config.mjs`__</caption>
|
|
164
|
-
*
|
|
165
|
-
* ```ts
|
|
166
|
-
* import { createVitestConfig } from '@aryaemami59/vitest-config'
|
|
167
|
-
*
|
|
168
|
-
* export default createVitestConfig({
|
|
169
|
-
* test: {
|
|
170
|
-
* environment: 'jsdom',
|
|
171
|
-
* // Other additional overrides
|
|
172
|
-
* },
|
|
173
|
-
* })
|
|
174
|
-
* ```
|
|
175
|
-
*
|
|
176
|
-
* @example
|
|
177
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using `require`)__</caption>
|
|
178
|
-
*
|
|
179
|
-
* ```ts
|
|
180
|
-
* const { createVitestConfig } = require('@aryaemami59/vitest-config')
|
|
181
|
-
*
|
|
182
|
-
* module.exports = createVitestConfig({
|
|
183
|
-
* test: {
|
|
184
|
-
* environment: 'jsdom',
|
|
185
|
-
* // Other additional overrides
|
|
186
|
-
* },
|
|
187
|
-
* })
|
|
188
|
-
* ```
|
|
189
|
-
*
|
|
190
|
-
* @example
|
|
191
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using dynamic import)__</caption>
|
|
192
|
-
*
|
|
193
|
-
* ```ts
|
|
194
|
-
* module.exports = (async () =>
|
|
195
|
-
* (await import('@aryaemami59/vitest-config')).createVitestConfig({
|
|
196
|
-
* test: {
|
|
197
|
-
* environment: 'jsdom',
|
|
198
|
-
* // Other additional overrides
|
|
199
|
-
* },
|
|
200
|
-
* }))()
|
|
201
|
-
* ```
|
|
202
|
-
*
|
|
203
|
-
* @example
|
|
204
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` (using import and export assignment)__</caption>
|
|
205
|
-
*
|
|
206
|
-
* ```ts
|
|
207
|
-
* import vitestConfigModule = require('@aryaemami59/vitest-config')
|
|
208
|
-
* import createVitestConfig = vitestConfigModule.createVitestConfig
|
|
209
|
-
*
|
|
210
|
-
* export = createVitestConfig({
|
|
211
|
-
* test: {
|
|
212
|
-
* environment: 'jsdom',
|
|
213
|
-
* // Other additional overrides
|
|
214
|
-
* },
|
|
215
|
-
* })
|
|
216
|
-
* ```
|
|
217
|
-
*
|
|
218
|
-
* @since 0.0.3
|
|
219
|
-
* @public
|
|
220
|
-
*/
|
|
221
46
|
const createVitestConfig = (additionalOverrides = {}) => /* @__PURE__ */ (0, vitest_config.mergeConfig)(vitestConfig, additionalOverrides);
|
|
222
|
-
/**
|
|
223
|
-
* A function that returns {@linkcode vitestProject}
|
|
224
|
-
* along with optional additional overrides.
|
|
225
|
-
*
|
|
226
|
-
* @param [additionalOverrides={}] - **Optional** additional overrides to apply to the configuration.
|
|
227
|
-
* @returns An augmented version of the default {@linkcode vitestProject}, incorporating any provided overrides.
|
|
228
|
-
*
|
|
229
|
-
* @example
|
|
230
|
-
* <caption>#### __ECMAScript Modules (ESM) usage inside a file like `vitest.config.mts` or `vitest.config.mjs`__</caption>
|
|
231
|
-
*
|
|
232
|
-
* ```ts
|
|
233
|
-
* import { createVitestProject } from '@aryaemami59/vitest-config'
|
|
234
|
-
*
|
|
235
|
-
* export default createVitestProject({
|
|
236
|
-
* test: {
|
|
237
|
-
* environment: 'jsdom',
|
|
238
|
-
* // Other additional overrides
|
|
239
|
-
* },
|
|
240
|
-
* })
|
|
241
|
-
* ```
|
|
242
|
-
*
|
|
243
|
-
* @example
|
|
244
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using `require`)__</caption>
|
|
245
|
-
*
|
|
246
|
-
* ```ts
|
|
247
|
-
* const { createVitestProject } = require('@aryaemami59/vitest-config')
|
|
248
|
-
*
|
|
249
|
-
* module.exports = createVitestProject({
|
|
250
|
-
* test: {
|
|
251
|
-
* environment: 'jsdom',
|
|
252
|
-
* // Other additional overrides
|
|
253
|
-
* },
|
|
254
|
-
* })
|
|
255
|
-
* ```
|
|
256
|
-
*
|
|
257
|
-
* @example
|
|
258
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using dynamic import)__</caption>
|
|
259
|
-
*
|
|
260
|
-
* ```ts
|
|
261
|
-
* module.exports = (async () =>
|
|
262
|
-
* (await import('@aryaemami59/vitest-config')).createVitestProject({
|
|
263
|
-
* test: {
|
|
264
|
-
* environment: 'jsdom',
|
|
265
|
-
* // Other additional overrides
|
|
266
|
-
* },
|
|
267
|
-
* }))()
|
|
268
|
-
* ```
|
|
269
|
-
*
|
|
270
|
-
* @example
|
|
271
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` (using import and export assignment)__</caption>
|
|
272
|
-
*
|
|
273
|
-
* ```ts
|
|
274
|
-
* import vitestConfigModule = require('@aryaemami59/vitest-config')
|
|
275
|
-
* import createVitestProject = vitestConfigModule.createVitestProject
|
|
276
|
-
*
|
|
277
|
-
* export = createVitestProject({
|
|
278
|
-
* test: {
|
|
279
|
-
* environment: 'jsdom',
|
|
280
|
-
* // Other additional overrides
|
|
281
|
-
* },
|
|
282
|
-
* })
|
|
283
|
-
* ```
|
|
284
|
-
*
|
|
285
|
-
* @since 0.0.5
|
|
286
|
-
* @public
|
|
287
|
-
*/
|
|
288
47
|
const createVitestProject = (additionalOverrides = {}) => /* @__PURE__ */ (0, vitest_config.mergeConfig)(vitestProject, additionalOverrides);
|
|
289
48
|
|
|
290
49
|
//#endregion
|
|
291
50
|
exports.createVitestConfig = createVitestConfig;
|
|
292
51
|
exports.createVitestProject = createVitestProject;
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
return vitest_config.defineConfig;
|
|
297
|
-
}
|
|
298
|
-
});
|
|
299
|
-
Object.defineProperty(exports, 'defineProject', {
|
|
300
|
-
enumerable: true,
|
|
301
|
-
get: function () {
|
|
302
|
-
return vitest_config.defineProject;
|
|
303
|
-
}
|
|
304
|
-
});
|
|
305
|
-
Object.defineProperty(exports, 'mergeConfig', {
|
|
306
|
-
enumerable: true,
|
|
307
|
-
get: function () {
|
|
308
|
-
return vitest_config.mergeConfig;
|
|
309
|
-
}
|
|
310
|
-
});
|
|
52
|
+
exports.defineConfig = vitest_config.defineConfig;
|
|
53
|
+
exports.defineProject = vitest_config.defineProject;
|
|
54
|
+
exports.mergeConfig = vitest_config.mergeConfig;
|
|
311
55
|
exports.plugins = plugins;
|
|
312
56
|
exports.tsconfigPaths = vite_tsconfig_paths.default;
|
|
313
57
|
exports.tsconfigPathsOptions = tsconfigPathsOptions;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../src/plugins.ts","../src/defaults.ts","../src/shareableConfigs.ts","../src/utils.ts"],"sourcesContent":["import type { Plugin, PluginOptions } from './external.js'\nimport { tsconfigPaths } from './external.js'\n\n/**\n * Default configuration for {@linkcode tsconfigPaths}.\n *\n * @since 0.0.5\n * @public\n */\nexport const tsconfigPathsOptions = {\n configNames: ['tsconfig.json'],\n projects: ['./tsconfig.json'],\n} as const satisfies PluginOptions\n\n/**\n * plugins for {@linkcode vitestProjectDefaults}.\n *\n * @since 0.0.5\n * @public\n */\nexport const plugins = [\n /* @__PURE__ */ tsconfigPaths(tsconfigPathsOptions),\n] as const satisfies [Plugin] as [Plugin]\n","import type { UserWorkspaceConfig, ViteUserConfig } from './external.js'\nimport { plugins } from './plugins.js'\n\n/**\n * Default configuration for {@linkcode vitestProject}.\n *\n * @since 0.0.5\n * @public\n */\nexport const vitestProjectDefaults = {\n /**\n * @default { 'import.meta.vitest': 'undefined' }\n */\n define: {\n /**\n * @default 'undefined'\n */\n 'import.meta.vitest': 'undefined',\n },\n\n /**\n * @default [tsconfigPaths({ configNames: ['tsconfig.json'], projects: ['./tsconfig.json'] })]\n */\n plugins,\n\n test: {\n /**\n * @default true\n */\n clearMocks: true,\n\n /**\n * @default true\n */\n globals: true,\n\n /**\n * @default { enabled: true, tsconfig: './tsconfig.json' }\n */\n typecheck: {\n /**\n * @default true\n */\n enabled: true,\n\n /**\n * @default './tsconfig.json'\n */\n tsconfig: './tsconfig.json',\n },\n\n /**\n * @default true\n */\n unstubEnvs: true,\n\n /**\n * @default true\n */\n unstubGlobals: true,\n },\n} as const satisfies UserWorkspaceConfig\n\n/**\n * Default configuration for {@linkcode vitestConfig}.\n *\n * @since 0.0.5\n * @public\n */\nexport const vitestConfigDefaults = {\n ...vitestProjectDefaults,\n\n test: {\n ...vitestProjectDefaults.test,\n\n /**\n * @default { include: ['src/**\\/*.?(c|m)[jt]s?(x)'] }\n */\n coverage: {\n /**\n * @default ['src/**\\/*.?(c|m)[jt]s?(x)']\n */\n include: ['src/**/*.?(c|m)[jt]s?(x)'],\n },\n\n /**\n * @default process.env.GITHUB_ACTIONS ? [['default', { summary: false }], ['github-actions', {}]] : [['default', {}]]\n */\n reporters: process.env.GITHUB_ACTIONS\n ? ([\n ['default', { summary: false }],\n ['github-actions', {}],\n ] as const)\n : ([['default', {}]] as const),\n\n /**\n * @default false\n */\n watch: false,\n },\n} as const satisfies ViteUserConfig\n","import { vitestConfigDefaults } from './defaults.js'\nimport type { UserWorkspaceConfig, ViteUserConfig } from './external.js'\nimport { defineConfig, defineProject } from './external.js'\n\n/**\n * Shareable {@link https://vitest.dev | **Vitest**}\n * configuration tailored for projects using TypeScript.\n *\n * @example\n * <caption>#### __ECMAScript Modules (ESM) usage inside a file like `vitest.config.mts` or `vitest.config.mjs`__</caption>\n *\n * ```ts\n * import { vitestConfig } from '@aryaemami59/vitest-config'\n *\n * export default vitestConfig\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using `require`)__</caption>\n *\n * ```ts\n * const { vitestConfig } = require('@aryaemami59/vitest-config')\n *\n * module.exports = vitestConfig\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using dynamic import)__</caption>\n *\n * ```ts\n * module.exports = (async () =>\n * (await import('@aryaemami59/vitest-config')).vitestConfig)()\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` (using import and export assignment)__</caption>\n *\n * ```ts\n * import vitestConfigModule = require('@aryaemami59/vitest-config')\n * import vitestConfig = vitestConfigModule.vitestConfig\n *\n * export = vitestConfig\n * ```\n *\n * @since 0.0.3\n * @public\n */\nexport const vitestConfig: ViteUserConfig =\n /* @__PURE__ */ defineConfig(vitestConfigDefaults)\n\n/**\n * Shareable {@link https://vitest.dev | **Vitest**}\n * configuration tailored for projects using TypeScript.\n *\n * @example\n * <caption>#### __ECMAScript Modules (ESM) usage inside a file like `vitest.config.mts` or `vitest.config.mjs`__</caption>\n *\n * ```ts\n * import { vitestProject } from '@aryaemami59/vitest-config'\n *\n * export default vitestProject\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using `require`)__</caption>\n *\n * ```ts\n * const { vitestProject } = require('@aryaemami59/vitest-config')\n *\n * module.exports = vitestProject\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using dynamic import)__</caption>\n *\n * ```ts\n * module.exports = (async () =>\n * (await import('@aryaemami59/vitest-config')).vitestProject)()\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` (using import and export assignment)__</caption>\n *\n * ```ts\n * import vitestConfigModule = require('@aryaemami59/vitest-config')\n * import vitestProject = vitestConfigModule.vitestProject\n *\n * export = vitestProject\n * ```\n *\n * @since 0.0.5\n * @public\n */\nexport const vitestProject: UserWorkspaceConfig =\n /* @__PURE__ */ defineProject(vitestConfigDefaults)\n","import type { UserWorkspaceConfig, ViteUserConfig } from './external.js'\nimport { mergeConfig } from './external.js'\nimport { vitestConfig, vitestProject } from './shareableConfigs.js'\n\n/**\n * A function that returns {@linkcode vitestConfig}\n * along with optional additional overrides.\n *\n * @param [additionalOverrides={}] - **Optional** additional overrides to apply to the configuration.\n * @returns An augmented version of the default {@linkcode vitestConfig}, incorporating any provided overrides.\n *\n * @example\n * <caption>#### __ECMAScript Modules (ESM) usage inside a file like `vitest.config.mts` or `vitest.config.mjs`__</caption>\n *\n * ```ts\n * import { createVitestConfig } from '@aryaemami59/vitest-config'\n *\n * export default createVitestConfig({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * })\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using `require`)__</caption>\n *\n * ```ts\n * const { createVitestConfig } = require('@aryaemami59/vitest-config')\n *\n * module.exports = createVitestConfig({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * })\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using dynamic import)__</caption>\n *\n * ```ts\n * module.exports = (async () =>\n * (await import('@aryaemami59/vitest-config')).createVitestConfig({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * }))()\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` (using import and export assignment)__</caption>\n *\n * ```ts\n * import vitestConfigModule = require('@aryaemami59/vitest-config')\n * import createVitestConfig = vitestConfigModule.createVitestConfig\n *\n * export = createVitestConfig({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * })\n * ```\n *\n * @since 0.0.3\n * @public\n */\nexport const createVitestConfig = (\n additionalOverrides: ViteUserConfig = {},\n): ViteUserConfig =>\n /* @__PURE__ */ mergeConfig(vitestConfig, additionalOverrides)\n\n/**\n * A function that returns {@linkcode vitestProject}\n * along with optional additional overrides.\n *\n * @param [additionalOverrides={}] - **Optional** additional overrides to apply to the configuration.\n * @returns An augmented version of the default {@linkcode vitestProject}, incorporating any provided overrides.\n *\n * @example\n * <caption>#### __ECMAScript Modules (ESM) usage inside a file like `vitest.config.mts` or `vitest.config.mjs`__</caption>\n *\n * ```ts\n * import { createVitestProject } from '@aryaemami59/vitest-config'\n *\n * export default createVitestProject({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * })\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using `require`)__</caption>\n *\n * ```ts\n * const { createVitestProject } = require('@aryaemami59/vitest-config')\n *\n * module.exports = createVitestProject({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * })\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using dynamic import)__</caption>\n *\n * ```ts\n * module.exports = (async () =>\n * (await import('@aryaemami59/vitest-config')).createVitestProject({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * }))()\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` (using import and export assignment)__</caption>\n *\n * ```ts\n * import vitestConfigModule = require('@aryaemami59/vitest-config')\n * import createVitestProject = vitestConfigModule.createVitestProject\n *\n * export = createVitestProject({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * })\n * ```\n *\n * @since 0.0.5\n * @public\n */\nexport const createVitestProject = (\n additionalOverrides: UserWorkspaceConfig = {},\n): UserWorkspaceConfig =>\n /* @__PURE__ */ mergeConfig(vitestProject, additionalOverrides)\n"],"mappings":";;;;;;;;;;;AASA,MAAa,uBAAuB;CAClC,aAAa,CAAC,gBAAgB;CAC9B,UAAU,CAAC,kBAAkB;CAC9B;;;;;;;AAQD,MAAa,UAAU,CACL,iDAAc,qBAAqB,CACpD;;;;;;;;;;ACbD,MAAa,wBAAwB;CAInC,QAAQ,EAIN,sBAAsB,aACvB;CAKD;CAEA,MAAM;EAIJ,YAAY;EAKZ,SAAS;EAKT,WAAW;GAIT,SAAS;GAKT,UAAU;GACX;EAKD,YAAY;EAKZ,eAAe;EAChB;CACF;;;;;;;AAQD,MAAa,uBAAuB;CAClC,GAAG;CAEH,MAAM;EACJ,GAAG,sBAAsB;EAKzB,UAAU,EAIR,SAAS,CAAC,2BAA2B,EACtC;EAKD,WAAW,QAAQ,IAAI,iBAClB,CACC,CAAC,WAAW,EAAE,SAAS,OAAO,CAAC,EAC/B,CAAC,kBAAkB,EAAE,CAAC,CACvB,GACA,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;EAKtB,OAAO;EACR;CACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACrDD,MAAa,eACK,gDAAa,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CpD,MAAa,gBACK,iDAAc,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACxBrD,MAAa,sBACX,sBAAsC,EAAE,KAExB,+CAAY,cAAc,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoEhE,MAAa,uBACX,sBAA2C,EAAE,KAE7B,+CAAY,eAAe,oBAAoB"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../src/defaults.ts","../src/plugins.ts","../src/shareableConfigs.ts","../src/utils.ts"],"sourcesContent":["import type { UserWorkspaceConfig, ViteUserConfig } from './external.js'\n\n/**\n * Default configuration for {@linkcode vitestProject}.\n *\n * @since 0.0.5\n * @public\n */\nexport const vitestProjectDefaults = {\n /**\n * @default { 'import.meta.vitest': 'undefined' }\n */\n define: {\n /**\n * @default 'undefined'\n */\n 'import.meta.vitest': 'undefined',\n },\n\n test: {\n /**\n * @default true\n */\n clearMocks: true,\n\n /**\n * @default true\n */\n globals: true,\n\n /**\n * @default { enabled: true, tsconfig: './tsconfig.json' }\n */\n typecheck: {\n /**\n * @default true\n */\n enabled: true,\n\n /**\n * @default './tsconfig.json'\n */\n tsconfig: './tsconfig.json',\n },\n\n /**\n * @default true\n */\n unstubEnvs: true,\n\n /**\n * @default true\n */\n unstubGlobals: true,\n },\n} as const satisfies UserWorkspaceConfig\n\n/**\n * Default configuration for {@linkcode vitestConfig}.\n *\n * @since 0.0.5\n * @public\n */\nexport const vitestConfigDefaults = {\n ...vitestProjectDefaults,\n\n test: {\n ...vitestProjectDefaults.test,\n\n /**\n * @default { include: ['src/**\\/*.?(c|m)[jt]s?(x)'] }\n */\n coverage: {\n /**\n * @default ['src/**\\/*.?(c|m)[jt]s?(x)']\n */\n include: ['src/**/*.?(c|m)[jt]s?(x)'],\n },\n\n /**\n * @default process.env.GITHUB_ACTIONS ? [['default', { summary: false }], ['github-actions', {}]] : [['default', {}]]\n */\n reporters: process.env.GITHUB_ACTIONS\n ? ([\n ['default', { summary: false }],\n ['github-actions', {}],\n ] as const)\n : ([['default', {}]] as const),\n\n /**\n * @default false\n */\n watch: false,\n },\n} as const satisfies ViteUserConfig\n","import type { Plugin, PluginOptions } from './external.js'\nimport { tsconfigPaths } from './external.js'\n\n/**\n * Default configuration for {@linkcode tsconfigPaths}.\n *\n * @since 0.0.5\n * @public\n */\nexport const tsconfigPathsOptions = {\n configNames: ['tsconfig.json'],\n projects: ['./tsconfig.json'],\n} as const satisfies PluginOptions\n\n/**\n * plugins for {@linkcode vitestProjectDefaults}.\n *\n * @since 0.0.5\n * @public\n */\nexport const plugins = [\n /* @__PURE__ */ tsconfigPaths(tsconfigPathsOptions),\n] as const satisfies [Plugin] as [Plugin]\n","import { vitestConfigDefaults } from './defaults.js'\nimport type { UserWorkspaceConfig, ViteUserConfig } from './external.js'\nimport { defineConfig, defineProject } from './external.js'\n\n/**\n * Shareable {@link https://vitest.dev | **Vitest**}\n * configuration tailored for projects using TypeScript.\n *\n * @example\n * <caption>#### __ECMAScript Modules (ESM) usage inside a file like `vitest.config.mts` or `vitest.config.mjs`__</caption>\n *\n * ```ts\n * import { vitestConfig } from '@aryaemami59/vitest-config'\n *\n * export default vitestConfig\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using `require`)__</caption>\n *\n * ```ts\n * const { vitestConfig } = require('@aryaemami59/vitest-config')\n *\n * module.exports = vitestConfig\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using dynamic import)__</caption>\n *\n * ```ts\n * module.exports = (async () =>\n * (await import('@aryaemami59/vitest-config')).vitestConfig)()\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` (using import and export assignment)__</caption>\n *\n * ```ts\n * import vitestConfigModule = require('@aryaemami59/vitest-config')\n * import vitestConfig = vitestConfigModule.vitestConfig\n *\n * export = vitestConfig\n * ```\n *\n * @since 0.0.3\n * @public\n */\nexport const vitestConfig: ViteUserConfig =\n /* @__PURE__ */ defineConfig(vitestConfigDefaults)\n\n/**\n * Shareable {@link https://vitest.dev | **Vitest**}\n * configuration tailored for projects using TypeScript.\n *\n * @example\n * <caption>#### __ECMAScript Modules (ESM) usage inside a file like `vitest.config.mts` or `vitest.config.mjs`__</caption>\n *\n * ```ts\n * import { vitestProject } from '@aryaemami59/vitest-config'\n *\n * export default vitestProject\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using `require`)__</caption>\n *\n * ```ts\n * const { vitestProject } = require('@aryaemami59/vitest-config')\n *\n * module.exports = vitestProject\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using dynamic import)__</caption>\n *\n * ```ts\n * module.exports = (async () =>\n * (await import('@aryaemami59/vitest-config')).vitestProject)()\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` (using import and export assignment)__</caption>\n *\n * ```ts\n * import vitestConfigModule = require('@aryaemami59/vitest-config')\n * import vitestProject = vitestConfigModule.vitestProject\n *\n * export = vitestProject\n * ```\n *\n * @since 0.0.5\n * @public\n */\nexport const vitestProject: UserWorkspaceConfig =\n /* @__PURE__ */ defineProject(vitestConfigDefaults)\n","import type { UserWorkspaceConfig, ViteUserConfig } from './external.js'\nimport { mergeConfig } from './external.js'\nimport { vitestConfig, vitestProject } from './shareableConfigs.js'\n\n/**\n * A function that returns {@linkcode vitestConfig}\n * along with optional additional overrides.\n *\n * @param [additionalOverrides={}] - **Optional** additional overrides to apply to the configuration.\n * @returns An augmented version of the default {@linkcode vitestConfig}, incorporating any provided overrides.\n *\n * @example\n * <caption>#### __ECMAScript Modules (ESM) usage inside a file like `vitest.config.mts` or `vitest.config.mjs`__</caption>\n *\n * ```ts\n * import { createVitestConfig } from '@aryaemami59/vitest-config'\n *\n * export default createVitestConfig({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * })\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using `require`)__</caption>\n *\n * ```ts\n * const { createVitestConfig } = require('@aryaemami59/vitest-config')\n *\n * module.exports = createVitestConfig({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * })\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using dynamic import)__</caption>\n *\n * ```ts\n * module.exports = (async () =>\n * (await import('@aryaemami59/vitest-config')).createVitestConfig({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * }))()\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` (using import and export assignment)__</caption>\n *\n * ```ts\n * import vitestConfigModule = require('@aryaemami59/vitest-config')\n * import createVitestConfig = vitestConfigModule.createVitestConfig\n *\n * export = createVitestConfig({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * })\n * ```\n *\n * @since 0.0.3\n * @public\n */\nexport const createVitestConfig = (\n additionalOverrides: ViteUserConfig = {},\n): ViteUserConfig =>\n /* @__PURE__ */ mergeConfig(vitestConfig, additionalOverrides)\n\n/**\n * A function that returns {@linkcode vitestProject}\n * along with optional additional overrides.\n *\n * @param [additionalOverrides={}] - **Optional** additional overrides to apply to the configuration.\n * @returns An augmented version of the default {@linkcode vitestProject}, incorporating any provided overrides.\n *\n * @example\n * <caption>#### __ECMAScript Modules (ESM) usage inside a file like `vitest.config.mts` or `vitest.config.mjs`__</caption>\n *\n * ```ts\n * import { createVitestProject } from '@aryaemami59/vitest-config'\n *\n * export default createVitestProject({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * })\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using `require`)__</caption>\n *\n * ```ts\n * const { createVitestProject } = require('@aryaemami59/vitest-config')\n *\n * module.exports = createVitestProject({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * })\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using dynamic import)__</caption>\n *\n * ```ts\n * module.exports = (async () =>\n * (await import('@aryaemami59/vitest-config')).createVitestProject({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * }))()\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` (using import and export assignment)__</caption>\n *\n * ```ts\n * import vitestConfigModule = require('@aryaemami59/vitest-config')\n * import createVitestProject = vitestConfigModule.createVitestProject\n *\n * export = createVitestProject({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * })\n * ```\n *\n * @since 0.0.5\n * @public\n */\nexport const createVitestProject = (\n additionalOverrides: UserWorkspaceConfig = {},\n): UserWorkspaceConfig =>\n /* @__PURE__ */ mergeConfig(vitestProject, additionalOverrides)\n"],"mappings":";;;;;;;AAQA,MAAa,wBAAwB;CAInC,QAAQ,EAIN,sBAAsB,aACvB;CAED,MAAM;EAIJ,YAAY;EAKZ,SAAS;EAKT,WAAW;GAIT,SAAS;GAKT,UAAU;GACX;EAKD,YAAY;EAKZ,eAAe;EAChB;CACF;AAQD,MAAa,uBAAuB;CAClC,GAAG;CAEH,MAAM;EACJ,GAAG,sBAAsB;EAKzB,UAAU,EAIR,SAAS,CAAC,2BAA2B,EACtC;EAKD,WAAW,QAAQ,IAAI,iBAClB,CACC,CAAC,WAAW,EAAE,SAAS,OAAO,CAAC,EAC/B,CAAC,kBAAkB,EAAE,CAAC,CACvB,GACA,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;EAKtB,OAAO;EACR;CACF;;;;ACrFD,MAAa,uBAAuB;CAClC,aAAa,CAAC,gBAAgB;CAC9B,UAAU,CAAC,kBAAkB;CAC9B;AAQD,MAAa,UAAU,CACL,iDAAc,qBAAqB,CACpD;;;;ACyBD,MAAa,eACK,gDAAa,qBAAqB;AA6CpD,MAAa,gBACK,iDAAc,qBAAqB;;;;ACxBrD,MAAa,sBACX,sBAAsC,EAAE,KAExB,+CAAY,cAAc,oBAAoB;AAoEhE,MAAa,uBACX,sBAA2C,EAAE,KAE7B,+CAAY,eAAe,oBAAoB"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as vite from "vite";
|
|
2
1
|
import tsconfigPaths, { PluginOptions } from "vite-tsconfig-paths";
|
|
3
2
|
import { Plugin, UserWorkspaceConfig, ViteUserConfig, defineConfig, defineProject, mergeConfig } from "vitest/config";
|
|
4
3
|
|
|
@@ -19,10 +18,6 @@ declare const vitestProjectDefaults: {
|
|
|
19
18
|
*/
|
|
20
19
|
readonly 'import.meta.vitest': "undefined";
|
|
21
20
|
};
|
|
22
|
-
/**
|
|
23
|
-
* @default [tsconfigPaths({ configNames: ['tsconfig.json'], projects: ['./tsconfig.json'] })]
|
|
24
|
-
*/
|
|
25
|
-
readonly plugins: [vite.Plugin<any>];
|
|
26
21
|
readonly test: {
|
|
27
22
|
/**
|
|
28
23
|
* @default true
|
|
@@ -121,10 +116,6 @@ declare const vitestConfigDefaults: {
|
|
|
121
116
|
*/
|
|
122
117
|
readonly 'import.meta.vitest': "undefined";
|
|
123
118
|
};
|
|
124
|
-
/**
|
|
125
|
-
* @default [tsconfigPaths({ configNames: ['tsconfig.json'], projects: ['./tsconfig.json'] })]
|
|
126
|
-
*/
|
|
127
|
-
readonly plugins: [vite.Plugin<any>];
|
|
128
119
|
};
|
|
129
120
|
//#endregion
|
|
130
121
|
//#region src/plugins.d.ts
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/defaults.ts","../src/plugins.ts","../src/shareableConfigs.ts","../src/utils.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/defaults.ts","../src/plugins.ts","../src/shareableConfigs.ts","../src/utils.ts"],"mappings":";;;;;;;;AAQA;;cAAa,qBAAA;EA+C2B;;;EAAA;;;;;;;;;;;IAuCL;;;IAAA;;;;;;;;;;;;;;;;;;;;ACrFnC;;;;;AAWA;;;;;cD2Ca,oBAAA;EAAA;;AEhBb;;;MACoD;;AA6CpD;MA7CoD;;IA8CC;;;IAAA;;;ICrBW;;;IAAA;IAF9D;;;IAAA;IAsEW;;;IAAA;IACU;;;IAAA;MAE0C;;;MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AHxIjE;;;cCCa,oBAAA;EAAA,SAGqB,WAAA;EAAA,SAAA,QAAA;AAAA;;;;;;;cAQrB,OAAA,GAEqB,MAAA;;;;;;ADdlC;;;;;;;;;;;;;;;;AAuDA;;;;;;;;;;;;;;;;;;;;;;;;cEhBa,YAAA,EAAc,cAAA;;;;;AD3B3B;;;;;;;;AC2BA;;;;;AA8CA;;;;;;;;ACvBA;;;;;;;;;AAuEA;;;;;;;;;cDhDa,aAAA,EAAe,mBAAA;;;;;;AFrF5B;;;;;;;;;;;;;;;;AAuDA;;;;;;;;;;;;;;;;;;;;;;;;ACtDA;;;;;AAWA;;;;;;;;AC2BA;;;;;AA8CA;;;;;cCvBa,kBAAA,GACX,mBAAA,GAAqB,cAAA,KACpB,cAAA;;;AAFH;;;;;;;;;AAuEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,mBAAA,GACX,mBAAA,GAAqB,mBAAA,KACpB,mBAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import tsconfigPaths, { PluginOptions } from "vite-tsconfig-paths";
|
|
2
2
|
import { Plugin, UserWorkspaceConfig, ViteUserConfig, defineConfig, defineProject, mergeConfig } from "vitest/config";
|
|
3
|
-
import * as vite from "vite";
|
|
4
3
|
|
|
5
4
|
//#region src/defaults.d.ts
|
|
6
5
|
/**
|
|
@@ -19,10 +18,6 @@ declare const vitestProjectDefaults: {
|
|
|
19
18
|
*/
|
|
20
19
|
readonly 'import.meta.vitest': "undefined";
|
|
21
20
|
};
|
|
22
|
-
/**
|
|
23
|
-
* @default [tsconfigPaths({ configNames: ['tsconfig.json'], projects: ['./tsconfig.json'] })]
|
|
24
|
-
*/
|
|
25
|
-
readonly plugins: [vite.Plugin<any>];
|
|
26
21
|
readonly test: {
|
|
27
22
|
/**
|
|
28
23
|
* @default true
|
|
@@ -121,10 +116,6 @@ declare const vitestConfigDefaults: {
|
|
|
121
116
|
*/
|
|
122
117
|
readonly 'import.meta.vitest': "undefined";
|
|
123
118
|
};
|
|
124
|
-
/**
|
|
125
|
-
* @default [tsconfigPaths({ configNames: ['tsconfig.json'], projects: ['./tsconfig.json'] })]
|
|
126
|
-
*/
|
|
127
|
-
readonly plugins: [vite.Plugin<any>];
|
|
128
119
|
};
|
|
129
120
|
//#endregion
|
|
130
121
|
//#region src/plugins.d.ts
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/defaults.ts","../src/plugins.ts","../src/shareableConfigs.ts","../src/utils.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/defaults.ts","../src/plugins.ts","../src/shareableConfigs.ts","../src/utils.ts"],"mappings":";;;;;;;;AAQA;;cAAa,qBAAA;EA+C2B;;;EAAA;;;;;;;;;;;IAuCL;;;IAAA;;;;;;;;;;;;;;;;;;;;ACrFnC;;;;;AAWA;;;;;cD2Ca,oBAAA;EAAA;;AEhBb;;;MACoD;;AA6CpD;MA7CoD;;IA8CC;;;IAAA;;;ICrBW;;;IAAA;IAF9D;;;IAAA;IAsEW;;;IAAA;IACU;;;IAAA;MAE0C;;;MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AHxIjE;;;cCCa,oBAAA;EAAA,SAGqB,WAAA;EAAA,SAAA,QAAA;AAAA;;;;;;;cAQrB,OAAA,GAEqB,MAAA;;;;;;ADdlC;;;;;;;;;;;;;;;;AAuDA;;;;;;;;;;;;;;;;;;;;;;;;cEhBa,YAAA,EAAc,cAAA;;;;;AD3B3B;;;;;;;;AC2BA;;;;;AA8CA;;;;;;;;ACvBA;;;;;;;;;AAuEA;;;;;;;;;cDhDa,aAAA,EAAe,mBAAA;;;;;;AFrF5B;;;;;;;;;;;;;;;;AAuDA;;;;;;;;;;;;;;;;;;;;;;;;ACtDA;;;;;AAWA;;;;;;;;AC2BA;;;;;AA8CA;;;;;cCvBa,kBAAA,GACX,mBAAA,GAAqB,cAAA,KACpB,cAAA;;;AAFH;;;;;;;;;AAuEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,mBAAA,GACX,mBAAA,GAAqB,mBAAA,KACpB,mBAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,36 +1,9 @@
|
|
|
1
1
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
2
2
|
import { defineConfig, defineProject, mergeConfig } from "vitest/config";
|
|
3
3
|
|
|
4
|
-
//#region src/plugins.ts
|
|
5
|
-
/**
|
|
6
|
-
* Default configuration for {@linkcode tsconfigPaths}.
|
|
7
|
-
*
|
|
8
|
-
* @since 0.0.5
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
11
|
-
const tsconfigPathsOptions = {
|
|
12
|
-
configNames: ["tsconfig.json"],
|
|
13
|
-
projects: ["./tsconfig.json"]
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* plugins for {@linkcode vitestProjectDefaults}.
|
|
17
|
-
*
|
|
18
|
-
* @since 0.0.5
|
|
19
|
-
* @public
|
|
20
|
-
*/
|
|
21
|
-
const plugins = [/* @__PURE__ */ tsconfigPaths(tsconfigPathsOptions)];
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
4
|
//#region src/defaults.ts
|
|
25
|
-
/**
|
|
26
|
-
* Default configuration for {@linkcode vitestProject}.
|
|
27
|
-
*
|
|
28
|
-
* @since 0.0.5
|
|
29
|
-
* @public
|
|
30
|
-
*/
|
|
31
5
|
const vitestProjectDefaults = {
|
|
32
6
|
define: { "import.meta.vitest": "undefined" },
|
|
33
|
-
plugins,
|
|
34
7
|
test: {
|
|
35
8
|
clearMocks: true,
|
|
36
9
|
globals: true,
|
|
@@ -42,12 +15,6 @@ const vitestProjectDefaults = {
|
|
|
42
15
|
unstubGlobals: true
|
|
43
16
|
}
|
|
44
17
|
};
|
|
45
|
-
/**
|
|
46
|
-
* Default configuration for {@linkcode vitestConfig}.
|
|
47
|
-
*
|
|
48
|
-
* @since 0.0.5
|
|
49
|
-
* @public
|
|
50
|
-
*/
|
|
51
18
|
const vitestConfigDefaults = {
|
|
52
19
|
...vitestProjectDefaults,
|
|
53
20
|
test: {
|
|
@@ -58,232 +25,22 @@ const vitestConfigDefaults = {
|
|
|
58
25
|
}
|
|
59
26
|
};
|
|
60
27
|
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/plugins.ts
|
|
30
|
+
const tsconfigPathsOptions = {
|
|
31
|
+
configNames: ["tsconfig.json"],
|
|
32
|
+
projects: ["./tsconfig.json"]
|
|
33
|
+
};
|
|
34
|
+
const plugins = [/* @__PURE__ */ tsconfigPaths(tsconfigPathsOptions)];
|
|
35
|
+
|
|
61
36
|
//#endregion
|
|
62
37
|
//#region src/shareableConfigs.ts
|
|
63
|
-
/**
|
|
64
|
-
* Shareable {@link https://vitest.dev | **Vitest**}
|
|
65
|
-
* configuration tailored for projects using TypeScript.
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* <caption>#### __ECMAScript Modules (ESM) usage inside a file like `vitest.config.mts` or `vitest.config.mjs`__</caption>
|
|
69
|
-
*
|
|
70
|
-
* ```ts
|
|
71
|
-
* import { vitestConfig } from '@aryaemami59/vitest-config'
|
|
72
|
-
*
|
|
73
|
-
* export default vitestConfig
|
|
74
|
-
* ```
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using `require`)__</caption>
|
|
78
|
-
*
|
|
79
|
-
* ```ts
|
|
80
|
-
* const { vitestConfig } = require('@aryaemami59/vitest-config')
|
|
81
|
-
*
|
|
82
|
-
* module.exports = vitestConfig
|
|
83
|
-
* ```
|
|
84
|
-
*
|
|
85
|
-
* @example
|
|
86
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using dynamic import)__</caption>
|
|
87
|
-
*
|
|
88
|
-
* ```ts
|
|
89
|
-
* module.exports = (async () =>
|
|
90
|
-
* (await import('@aryaemami59/vitest-config')).vitestConfig)()
|
|
91
|
-
* ```
|
|
92
|
-
*
|
|
93
|
-
* @example
|
|
94
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` (using import and export assignment)__</caption>
|
|
95
|
-
*
|
|
96
|
-
* ```ts
|
|
97
|
-
* import vitestConfigModule = require('@aryaemami59/vitest-config')
|
|
98
|
-
* import vitestConfig = vitestConfigModule.vitestConfig
|
|
99
|
-
*
|
|
100
|
-
* export = vitestConfig
|
|
101
|
-
* ```
|
|
102
|
-
*
|
|
103
|
-
* @since 0.0.3
|
|
104
|
-
* @public
|
|
105
|
-
*/
|
|
106
38
|
const vitestConfig = /* @__PURE__ */ defineConfig(vitestConfigDefaults);
|
|
107
|
-
/**
|
|
108
|
-
* Shareable {@link https://vitest.dev | **Vitest**}
|
|
109
|
-
* configuration tailored for projects using TypeScript.
|
|
110
|
-
*
|
|
111
|
-
* @example
|
|
112
|
-
* <caption>#### __ECMAScript Modules (ESM) usage inside a file like `vitest.config.mts` or `vitest.config.mjs`__</caption>
|
|
113
|
-
*
|
|
114
|
-
* ```ts
|
|
115
|
-
* import { vitestProject } from '@aryaemami59/vitest-config'
|
|
116
|
-
*
|
|
117
|
-
* export default vitestProject
|
|
118
|
-
* ```
|
|
119
|
-
*
|
|
120
|
-
* @example
|
|
121
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using `require`)__</caption>
|
|
122
|
-
*
|
|
123
|
-
* ```ts
|
|
124
|
-
* const { vitestProject } = require('@aryaemami59/vitest-config')
|
|
125
|
-
*
|
|
126
|
-
* module.exports = vitestProject
|
|
127
|
-
* ```
|
|
128
|
-
*
|
|
129
|
-
* @example
|
|
130
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using dynamic import)__</caption>
|
|
131
|
-
*
|
|
132
|
-
* ```ts
|
|
133
|
-
* module.exports = (async () =>
|
|
134
|
-
* (await import('@aryaemami59/vitest-config')).vitestProject)()
|
|
135
|
-
* ```
|
|
136
|
-
*
|
|
137
|
-
* @example
|
|
138
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` (using import and export assignment)__</caption>
|
|
139
|
-
*
|
|
140
|
-
* ```ts
|
|
141
|
-
* import vitestConfigModule = require('@aryaemami59/vitest-config')
|
|
142
|
-
* import vitestProject = vitestConfigModule.vitestProject
|
|
143
|
-
*
|
|
144
|
-
* export = vitestProject
|
|
145
|
-
* ```
|
|
146
|
-
*
|
|
147
|
-
* @since 0.0.5
|
|
148
|
-
* @public
|
|
149
|
-
*/
|
|
150
39
|
const vitestProject = /* @__PURE__ */ defineProject(vitestConfigDefaults);
|
|
151
40
|
|
|
152
41
|
//#endregion
|
|
153
42
|
//#region src/utils.ts
|
|
154
|
-
/**
|
|
155
|
-
* A function that returns {@linkcode vitestConfig}
|
|
156
|
-
* along with optional additional overrides.
|
|
157
|
-
*
|
|
158
|
-
* @param [additionalOverrides={}] - **Optional** additional overrides to apply to the configuration.
|
|
159
|
-
* @returns An augmented version of the default {@linkcode vitestConfig}, incorporating any provided overrides.
|
|
160
|
-
*
|
|
161
|
-
* @example
|
|
162
|
-
* <caption>#### __ECMAScript Modules (ESM) usage inside a file like `vitest.config.mts` or `vitest.config.mjs`__</caption>
|
|
163
|
-
*
|
|
164
|
-
* ```ts
|
|
165
|
-
* import { createVitestConfig } from '@aryaemami59/vitest-config'
|
|
166
|
-
*
|
|
167
|
-
* export default createVitestConfig({
|
|
168
|
-
* test: {
|
|
169
|
-
* environment: 'jsdom',
|
|
170
|
-
* // Other additional overrides
|
|
171
|
-
* },
|
|
172
|
-
* })
|
|
173
|
-
* ```
|
|
174
|
-
*
|
|
175
|
-
* @example
|
|
176
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using `require`)__</caption>
|
|
177
|
-
*
|
|
178
|
-
* ```ts
|
|
179
|
-
* const { createVitestConfig } = require('@aryaemami59/vitest-config')
|
|
180
|
-
*
|
|
181
|
-
* module.exports = createVitestConfig({
|
|
182
|
-
* test: {
|
|
183
|
-
* environment: 'jsdom',
|
|
184
|
-
* // Other additional overrides
|
|
185
|
-
* },
|
|
186
|
-
* })
|
|
187
|
-
* ```
|
|
188
|
-
*
|
|
189
|
-
* @example
|
|
190
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using dynamic import)__</caption>
|
|
191
|
-
*
|
|
192
|
-
* ```ts
|
|
193
|
-
* module.exports = (async () =>
|
|
194
|
-
* (await import('@aryaemami59/vitest-config')).createVitestConfig({
|
|
195
|
-
* test: {
|
|
196
|
-
* environment: 'jsdom',
|
|
197
|
-
* // Other additional overrides
|
|
198
|
-
* },
|
|
199
|
-
* }))()
|
|
200
|
-
* ```
|
|
201
|
-
*
|
|
202
|
-
* @example
|
|
203
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` (using import and export assignment)__</caption>
|
|
204
|
-
*
|
|
205
|
-
* ```ts
|
|
206
|
-
* import vitestConfigModule = require('@aryaemami59/vitest-config')
|
|
207
|
-
* import createVitestConfig = vitestConfigModule.createVitestConfig
|
|
208
|
-
*
|
|
209
|
-
* export = createVitestConfig({
|
|
210
|
-
* test: {
|
|
211
|
-
* environment: 'jsdom',
|
|
212
|
-
* // Other additional overrides
|
|
213
|
-
* },
|
|
214
|
-
* })
|
|
215
|
-
* ```
|
|
216
|
-
*
|
|
217
|
-
* @since 0.0.3
|
|
218
|
-
* @public
|
|
219
|
-
*/
|
|
220
43
|
const createVitestConfig = (additionalOverrides = {}) => /* @__PURE__ */ mergeConfig(vitestConfig, additionalOverrides);
|
|
221
|
-
/**
|
|
222
|
-
* A function that returns {@linkcode vitestProject}
|
|
223
|
-
* along with optional additional overrides.
|
|
224
|
-
*
|
|
225
|
-
* @param [additionalOverrides={}] - **Optional** additional overrides to apply to the configuration.
|
|
226
|
-
* @returns An augmented version of the default {@linkcode vitestProject}, incorporating any provided overrides.
|
|
227
|
-
*
|
|
228
|
-
* @example
|
|
229
|
-
* <caption>#### __ECMAScript Modules (ESM) usage inside a file like `vitest.config.mts` or `vitest.config.mjs`__</caption>
|
|
230
|
-
*
|
|
231
|
-
* ```ts
|
|
232
|
-
* import { createVitestProject } from '@aryaemami59/vitest-config'
|
|
233
|
-
*
|
|
234
|
-
* export default createVitestProject({
|
|
235
|
-
* test: {
|
|
236
|
-
* environment: 'jsdom',
|
|
237
|
-
* // Other additional overrides
|
|
238
|
-
* },
|
|
239
|
-
* })
|
|
240
|
-
* ```
|
|
241
|
-
*
|
|
242
|
-
* @example
|
|
243
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using `require`)__</caption>
|
|
244
|
-
*
|
|
245
|
-
* ```ts
|
|
246
|
-
* const { createVitestProject } = require('@aryaemami59/vitest-config')
|
|
247
|
-
*
|
|
248
|
-
* module.exports = createVitestProject({
|
|
249
|
-
* test: {
|
|
250
|
-
* environment: 'jsdom',
|
|
251
|
-
* // Other additional overrides
|
|
252
|
-
* },
|
|
253
|
-
* })
|
|
254
|
-
* ```
|
|
255
|
-
*
|
|
256
|
-
* @example
|
|
257
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using dynamic import)__</caption>
|
|
258
|
-
*
|
|
259
|
-
* ```ts
|
|
260
|
-
* module.exports = (async () =>
|
|
261
|
-
* (await import('@aryaemami59/vitest-config')).createVitestProject({
|
|
262
|
-
* test: {
|
|
263
|
-
* environment: 'jsdom',
|
|
264
|
-
* // Other additional overrides
|
|
265
|
-
* },
|
|
266
|
-
* }))()
|
|
267
|
-
* ```
|
|
268
|
-
*
|
|
269
|
-
* @example
|
|
270
|
-
* <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` (using import and export assignment)__</caption>
|
|
271
|
-
*
|
|
272
|
-
* ```ts
|
|
273
|
-
* import vitestConfigModule = require('@aryaemami59/vitest-config')
|
|
274
|
-
* import createVitestProject = vitestConfigModule.createVitestProject
|
|
275
|
-
*
|
|
276
|
-
* export = createVitestProject({
|
|
277
|
-
* test: {
|
|
278
|
-
* environment: 'jsdom',
|
|
279
|
-
* // Other additional overrides
|
|
280
|
-
* },
|
|
281
|
-
* })
|
|
282
|
-
* ```
|
|
283
|
-
*
|
|
284
|
-
* @since 0.0.5
|
|
285
|
-
* @public
|
|
286
|
-
*/
|
|
287
44
|
const createVitestProject = (additionalOverrides = {}) => /* @__PURE__ */ mergeConfig(vitestProject, additionalOverrides);
|
|
288
45
|
|
|
289
46
|
//#endregion
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/plugins.ts","../src/defaults.ts","../src/shareableConfigs.ts","../src/utils.ts"],"sourcesContent":["import type { Plugin, PluginOptions } from './external.js'\nimport { tsconfigPaths } from './external.js'\n\n/**\n * Default configuration for {@linkcode tsconfigPaths}.\n *\n * @since 0.0.5\n * @public\n */\nexport const tsconfigPathsOptions = {\n configNames: ['tsconfig.json'],\n projects: ['./tsconfig.json'],\n} as const satisfies PluginOptions\n\n/**\n * plugins for {@linkcode vitestProjectDefaults}.\n *\n * @since 0.0.5\n * @public\n */\nexport const plugins = [\n /* @__PURE__ */ tsconfigPaths(tsconfigPathsOptions),\n] as const satisfies [Plugin] as [Plugin]\n","import type { UserWorkspaceConfig, ViteUserConfig } from './external.js'\nimport { plugins } from './plugins.js'\n\n/**\n * Default configuration for {@linkcode vitestProject}.\n *\n * @since 0.0.5\n * @public\n */\nexport const vitestProjectDefaults = {\n /**\n * @default { 'import.meta.vitest': 'undefined' }\n */\n define: {\n /**\n * @default 'undefined'\n */\n 'import.meta.vitest': 'undefined',\n },\n\n /**\n * @default [tsconfigPaths({ configNames: ['tsconfig.json'], projects: ['./tsconfig.json'] })]\n */\n plugins,\n\n test: {\n /**\n * @default true\n */\n clearMocks: true,\n\n /**\n * @default true\n */\n globals: true,\n\n /**\n * @default { enabled: true, tsconfig: './tsconfig.json' }\n */\n typecheck: {\n /**\n * @default true\n */\n enabled: true,\n\n /**\n * @default './tsconfig.json'\n */\n tsconfig: './tsconfig.json',\n },\n\n /**\n * @default true\n */\n unstubEnvs: true,\n\n /**\n * @default true\n */\n unstubGlobals: true,\n },\n} as const satisfies UserWorkspaceConfig\n\n/**\n * Default configuration for {@linkcode vitestConfig}.\n *\n * @since 0.0.5\n * @public\n */\nexport const vitestConfigDefaults = {\n ...vitestProjectDefaults,\n\n test: {\n ...vitestProjectDefaults.test,\n\n /**\n * @default { include: ['src/**\\/*.?(c|m)[jt]s?(x)'] }\n */\n coverage: {\n /**\n * @default ['src/**\\/*.?(c|m)[jt]s?(x)']\n */\n include: ['src/**/*.?(c|m)[jt]s?(x)'],\n },\n\n /**\n * @default process.env.GITHUB_ACTIONS ? [['default', { summary: false }], ['github-actions', {}]] : [['default', {}]]\n */\n reporters: process.env.GITHUB_ACTIONS\n ? ([\n ['default', { summary: false }],\n ['github-actions', {}],\n ] as const)\n : ([['default', {}]] as const),\n\n /**\n * @default false\n */\n watch: false,\n },\n} as const satisfies ViteUserConfig\n","import { vitestConfigDefaults } from './defaults.js'\nimport type { UserWorkspaceConfig, ViteUserConfig } from './external.js'\nimport { defineConfig, defineProject } from './external.js'\n\n/**\n * Shareable {@link https://vitest.dev | **Vitest**}\n * configuration tailored for projects using TypeScript.\n *\n * @example\n * <caption>#### __ECMAScript Modules (ESM) usage inside a file like `vitest.config.mts` or `vitest.config.mjs`__</caption>\n *\n * ```ts\n * import { vitestConfig } from '@aryaemami59/vitest-config'\n *\n * export default vitestConfig\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using `require`)__</caption>\n *\n * ```ts\n * const { vitestConfig } = require('@aryaemami59/vitest-config')\n *\n * module.exports = vitestConfig\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using dynamic import)__</caption>\n *\n * ```ts\n * module.exports = (async () =>\n * (await import('@aryaemami59/vitest-config')).vitestConfig)()\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` (using import and export assignment)__</caption>\n *\n * ```ts\n * import vitestConfigModule = require('@aryaemami59/vitest-config')\n * import vitestConfig = vitestConfigModule.vitestConfig\n *\n * export = vitestConfig\n * ```\n *\n * @since 0.0.3\n * @public\n */\nexport const vitestConfig: ViteUserConfig =\n /* @__PURE__ */ defineConfig(vitestConfigDefaults)\n\n/**\n * Shareable {@link https://vitest.dev | **Vitest**}\n * configuration tailored for projects using TypeScript.\n *\n * @example\n * <caption>#### __ECMAScript Modules (ESM) usage inside a file like `vitest.config.mts` or `vitest.config.mjs`__</caption>\n *\n * ```ts\n * import { vitestProject } from '@aryaemami59/vitest-config'\n *\n * export default vitestProject\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using `require`)__</caption>\n *\n * ```ts\n * const { vitestProject } = require('@aryaemami59/vitest-config')\n *\n * module.exports = vitestProject\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using dynamic import)__</caption>\n *\n * ```ts\n * module.exports = (async () =>\n * (await import('@aryaemami59/vitest-config')).vitestProject)()\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` (using import and export assignment)__</caption>\n *\n * ```ts\n * import vitestConfigModule = require('@aryaemami59/vitest-config')\n * import vitestProject = vitestConfigModule.vitestProject\n *\n * export = vitestProject\n * ```\n *\n * @since 0.0.5\n * @public\n */\nexport const vitestProject: UserWorkspaceConfig =\n /* @__PURE__ */ defineProject(vitestConfigDefaults)\n","import type { UserWorkspaceConfig, ViteUserConfig } from './external.js'\nimport { mergeConfig } from './external.js'\nimport { vitestConfig, vitestProject } from './shareableConfigs.js'\n\n/**\n * A function that returns {@linkcode vitestConfig}\n * along with optional additional overrides.\n *\n * @param [additionalOverrides={}] - **Optional** additional overrides to apply to the configuration.\n * @returns An augmented version of the default {@linkcode vitestConfig}, incorporating any provided overrides.\n *\n * @example\n * <caption>#### __ECMAScript Modules (ESM) usage inside a file like `vitest.config.mts` or `vitest.config.mjs`__</caption>\n *\n * ```ts\n * import { createVitestConfig } from '@aryaemami59/vitest-config'\n *\n * export default createVitestConfig({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * })\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using `require`)__</caption>\n *\n * ```ts\n * const { createVitestConfig } = require('@aryaemami59/vitest-config')\n *\n * module.exports = createVitestConfig({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * })\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using dynamic import)__</caption>\n *\n * ```ts\n * module.exports = (async () =>\n * (await import('@aryaemami59/vitest-config')).createVitestConfig({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * }))()\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` (using import and export assignment)__</caption>\n *\n * ```ts\n * import vitestConfigModule = require('@aryaemami59/vitest-config')\n * import createVitestConfig = vitestConfigModule.createVitestConfig\n *\n * export = createVitestConfig({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * })\n * ```\n *\n * @since 0.0.3\n * @public\n */\nexport const createVitestConfig = (\n additionalOverrides: ViteUserConfig = {},\n): ViteUserConfig =>\n /* @__PURE__ */ mergeConfig(vitestConfig, additionalOverrides)\n\n/**\n * A function that returns {@linkcode vitestProject}\n * along with optional additional overrides.\n *\n * @param [additionalOverrides={}] - **Optional** additional overrides to apply to the configuration.\n * @returns An augmented version of the default {@linkcode vitestProject}, incorporating any provided overrides.\n *\n * @example\n * <caption>#### __ECMAScript Modules (ESM) usage inside a file like `vitest.config.mts` or `vitest.config.mjs`__</caption>\n *\n * ```ts\n * import { createVitestProject } from '@aryaemami59/vitest-config'\n *\n * export default createVitestProject({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * })\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using `require`)__</caption>\n *\n * ```ts\n * const { createVitestProject } = require('@aryaemami59/vitest-config')\n *\n * module.exports = createVitestProject({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * })\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using dynamic import)__</caption>\n *\n * ```ts\n * module.exports = (async () =>\n * (await import('@aryaemami59/vitest-config')).createVitestProject({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * }))()\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` (using import and export assignment)__</caption>\n *\n * ```ts\n * import vitestConfigModule = require('@aryaemami59/vitest-config')\n * import createVitestProject = vitestConfigModule.createVitestProject\n *\n * export = createVitestProject({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * })\n * ```\n *\n * @since 0.0.5\n * @public\n */\nexport const createVitestProject = (\n additionalOverrides: UserWorkspaceConfig = {},\n): UserWorkspaceConfig =>\n /* @__PURE__ */ mergeConfig(vitestProject, additionalOverrides)\n"],"mappings":";;;;;;;;;;AASA,MAAa,uBAAuB;CAClC,aAAa,CAAC,gBAAgB;CAC9B,UAAU,CAAC,kBAAkB;CAC9B;;;;;;;AAQD,MAAa,UAAU,CACL,8BAAc,qBAAqB,CACpD;;;;;;;;;;ACbD,MAAa,wBAAwB;CAInC,QAAQ,EAIN,sBAAsB,aACvB;CAKD;CAEA,MAAM;EAIJ,YAAY;EAKZ,SAAS;EAKT,WAAW;GAIT,SAAS;GAKT,UAAU;GACX;EAKD,YAAY;EAKZ,eAAe;EAChB;CACF;;;;;;;AAQD,MAAa,uBAAuB;CAClC,GAAG;CAEH,MAAM;EACJ,GAAG,sBAAsB;EAKzB,UAAU,EAIR,SAAS,CAAC,2BAA2B,EACtC;EAKD,WAAW,QAAQ,IAAI,iBAClB,CACC,CAAC,WAAW,EAAE,SAAS,OAAO,CAAC,EAC/B,CAAC,kBAAkB,EAAE,CAAC,CACvB,GACA,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;EAKtB,OAAO;EACR;CACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACrDD,MAAa,eACK,6BAAa,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CpD,MAAa,gBACK,8BAAc,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACxBrD,MAAa,sBACX,sBAAsC,EAAE,KAExB,4BAAY,cAAc,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoEhE,MAAa,uBACX,sBAA2C,EAAE,KAE7B,4BAAY,eAAe,oBAAoB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/defaults.ts","../src/plugins.ts","../src/shareableConfigs.ts","../src/utils.ts"],"sourcesContent":["import type { UserWorkspaceConfig, ViteUserConfig } from './external.js'\n\n/**\n * Default configuration for {@linkcode vitestProject}.\n *\n * @since 0.0.5\n * @public\n */\nexport const vitestProjectDefaults = {\n /**\n * @default { 'import.meta.vitest': 'undefined' }\n */\n define: {\n /**\n * @default 'undefined'\n */\n 'import.meta.vitest': 'undefined',\n },\n\n test: {\n /**\n * @default true\n */\n clearMocks: true,\n\n /**\n * @default true\n */\n globals: true,\n\n /**\n * @default { enabled: true, tsconfig: './tsconfig.json' }\n */\n typecheck: {\n /**\n * @default true\n */\n enabled: true,\n\n /**\n * @default './tsconfig.json'\n */\n tsconfig: './tsconfig.json',\n },\n\n /**\n * @default true\n */\n unstubEnvs: true,\n\n /**\n * @default true\n */\n unstubGlobals: true,\n },\n} as const satisfies UserWorkspaceConfig\n\n/**\n * Default configuration for {@linkcode vitestConfig}.\n *\n * @since 0.0.5\n * @public\n */\nexport const vitestConfigDefaults = {\n ...vitestProjectDefaults,\n\n test: {\n ...vitestProjectDefaults.test,\n\n /**\n * @default { include: ['src/**\\/*.?(c|m)[jt]s?(x)'] }\n */\n coverage: {\n /**\n * @default ['src/**\\/*.?(c|m)[jt]s?(x)']\n */\n include: ['src/**/*.?(c|m)[jt]s?(x)'],\n },\n\n /**\n * @default process.env.GITHUB_ACTIONS ? [['default', { summary: false }], ['github-actions', {}]] : [['default', {}]]\n */\n reporters: process.env.GITHUB_ACTIONS\n ? ([\n ['default', { summary: false }],\n ['github-actions', {}],\n ] as const)\n : ([['default', {}]] as const),\n\n /**\n * @default false\n */\n watch: false,\n },\n} as const satisfies ViteUserConfig\n","import type { Plugin, PluginOptions } from './external.js'\nimport { tsconfigPaths } from './external.js'\n\n/**\n * Default configuration for {@linkcode tsconfigPaths}.\n *\n * @since 0.0.5\n * @public\n */\nexport const tsconfigPathsOptions = {\n configNames: ['tsconfig.json'],\n projects: ['./tsconfig.json'],\n} as const satisfies PluginOptions\n\n/**\n * plugins for {@linkcode vitestProjectDefaults}.\n *\n * @since 0.0.5\n * @public\n */\nexport const plugins = [\n /* @__PURE__ */ tsconfigPaths(tsconfigPathsOptions),\n] as const satisfies [Plugin] as [Plugin]\n","import { vitestConfigDefaults } from './defaults.js'\nimport type { UserWorkspaceConfig, ViteUserConfig } from './external.js'\nimport { defineConfig, defineProject } from './external.js'\n\n/**\n * Shareable {@link https://vitest.dev | **Vitest**}\n * configuration tailored for projects using TypeScript.\n *\n * @example\n * <caption>#### __ECMAScript Modules (ESM) usage inside a file like `vitest.config.mts` or `vitest.config.mjs`__</caption>\n *\n * ```ts\n * import { vitestConfig } from '@aryaemami59/vitest-config'\n *\n * export default vitestConfig\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using `require`)__</caption>\n *\n * ```ts\n * const { vitestConfig } = require('@aryaemami59/vitest-config')\n *\n * module.exports = vitestConfig\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using dynamic import)__</caption>\n *\n * ```ts\n * module.exports = (async () =>\n * (await import('@aryaemami59/vitest-config')).vitestConfig)()\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` (using import and export assignment)__</caption>\n *\n * ```ts\n * import vitestConfigModule = require('@aryaemami59/vitest-config')\n * import vitestConfig = vitestConfigModule.vitestConfig\n *\n * export = vitestConfig\n * ```\n *\n * @since 0.0.3\n * @public\n */\nexport const vitestConfig: ViteUserConfig =\n /* @__PURE__ */ defineConfig(vitestConfigDefaults)\n\n/**\n * Shareable {@link https://vitest.dev | **Vitest**}\n * configuration tailored for projects using TypeScript.\n *\n * @example\n * <caption>#### __ECMAScript Modules (ESM) usage inside a file like `vitest.config.mts` or `vitest.config.mjs`__</caption>\n *\n * ```ts\n * import { vitestProject } from '@aryaemami59/vitest-config'\n *\n * export default vitestProject\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using `require`)__</caption>\n *\n * ```ts\n * const { vitestProject } = require('@aryaemami59/vitest-config')\n *\n * module.exports = vitestProject\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using dynamic import)__</caption>\n *\n * ```ts\n * module.exports = (async () =>\n * (await import('@aryaemami59/vitest-config')).vitestProject)()\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` (using import and export assignment)__</caption>\n *\n * ```ts\n * import vitestConfigModule = require('@aryaemami59/vitest-config')\n * import vitestProject = vitestConfigModule.vitestProject\n *\n * export = vitestProject\n * ```\n *\n * @since 0.0.5\n * @public\n */\nexport const vitestProject: UserWorkspaceConfig =\n /* @__PURE__ */ defineProject(vitestConfigDefaults)\n","import type { UserWorkspaceConfig, ViteUserConfig } from './external.js'\nimport { mergeConfig } from './external.js'\nimport { vitestConfig, vitestProject } from './shareableConfigs.js'\n\n/**\n * A function that returns {@linkcode vitestConfig}\n * along with optional additional overrides.\n *\n * @param [additionalOverrides={}] - **Optional** additional overrides to apply to the configuration.\n * @returns An augmented version of the default {@linkcode vitestConfig}, incorporating any provided overrides.\n *\n * @example\n * <caption>#### __ECMAScript Modules (ESM) usage inside a file like `vitest.config.mts` or `vitest.config.mjs`__</caption>\n *\n * ```ts\n * import { createVitestConfig } from '@aryaemami59/vitest-config'\n *\n * export default createVitestConfig({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * })\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using `require`)__</caption>\n *\n * ```ts\n * const { createVitestConfig } = require('@aryaemami59/vitest-config')\n *\n * module.exports = createVitestConfig({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * })\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using dynamic import)__</caption>\n *\n * ```ts\n * module.exports = (async () =>\n * (await import('@aryaemami59/vitest-config')).createVitestConfig({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * }))()\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` (using import and export assignment)__</caption>\n *\n * ```ts\n * import vitestConfigModule = require('@aryaemami59/vitest-config')\n * import createVitestConfig = vitestConfigModule.createVitestConfig\n *\n * export = createVitestConfig({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * })\n * ```\n *\n * @since 0.0.3\n * @public\n */\nexport const createVitestConfig = (\n additionalOverrides: ViteUserConfig = {},\n): ViteUserConfig =>\n /* @__PURE__ */ mergeConfig(vitestConfig, additionalOverrides)\n\n/**\n * A function that returns {@linkcode vitestProject}\n * along with optional additional overrides.\n *\n * @param [additionalOverrides={}] - **Optional** additional overrides to apply to the configuration.\n * @returns An augmented version of the default {@linkcode vitestProject}, incorporating any provided overrides.\n *\n * @example\n * <caption>#### __ECMAScript Modules (ESM) usage inside a file like `vitest.config.mts` or `vitest.config.mjs`__</caption>\n *\n * ```ts\n * import { createVitestProject } from '@aryaemami59/vitest-config'\n *\n * export default createVitestProject({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * })\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using `require`)__</caption>\n *\n * ```ts\n * const { createVitestProject } = require('@aryaemami59/vitest-config')\n *\n * module.exports = createVitestProject({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * })\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` or `vitest.config.cjs` (using dynamic import)__</caption>\n *\n * ```ts\n * module.exports = (async () =>\n * (await import('@aryaemami59/vitest-config')).createVitestProject({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * }))()\n * ```\n *\n * @example\n * <caption>#### __CommonJS (CJS) usage inside a file like `vitest.config.cts` (using import and export assignment)__</caption>\n *\n * ```ts\n * import vitestConfigModule = require('@aryaemami59/vitest-config')\n * import createVitestProject = vitestConfigModule.createVitestProject\n *\n * export = createVitestProject({\n * test: {\n * environment: 'jsdom',\n * // Other additional overrides\n * },\n * })\n * ```\n *\n * @since 0.0.5\n * @public\n */\nexport const createVitestProject = (\n additionalOverrides: UserWorkspaceConfig = {},\n): UserWorkspaceConfig =>\n /* @__PURE__ */ mergeConfig(vitestProject, additionalOverrides)\n"],"mappings":";;;;AAQA,MAAa,wBAAwB;CAInC,QAAQ,EAIN,sBAAsB,aACvB;CAED,MAAM;EAIJ,YAAY;EAKZ,SAAS;EAKT,WAAW;GAIT,SAAS;GAKT,UAAU;GACX;EAKD,YAAY;EAKZ,eAAe;EAChB;CACF;AAQD,MAAa,uBAAuB;CAClC,GAAG;CAEH,MAAM;EACJ,GAAG,sBAAsB;EAKzB,UAAU,EAIR,SAAS,CAAC,2BAA2B,EACtC;EAKD,WAAW,QAAQ,IAAI,iBAClB,CACC,CAAC,WAAW,EAAE,SAAS,OAAO,CAAC,EAC/B,CAAC,kBAAkB,EAAE,CAAC,CACvB,GACA,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;EAKtB,OAAO;EACR;CACF;;;;ACrFD,MAAa,uBAAuB;CAClC,aAAa,CAAC,gBAAgB;CAC9B,UAAU,CAAC,kBAAkB;CAC9B;AAQD,MAAa,UAAU,CACL,8BAAc,qBAAqB,CACpD;;;;ACyBD,MAAa,eACK,6BAAa,qBAAqB;AA6CpD,MAAa,gBACK,8BAAc,qBAAqB;;;;ACxBrD,MAAa,sBACX,sBAAsC,EAAE,KAExB,4BAAY,cAAc,oBAAoB;AAoEhE,MAAa,uBACX,sBAA2C,EAAE,KAE7B,4BAAY,eAAe,oBAAoB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aryaemami59/vitest-config",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "Vitest configuration for TypeScript projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"config",
|
|
@@ -68,22 +68,22 @@
|
|
|
68
68
|
"typecheck": "tsc -p ${INIT_CWD}/tsconfig.json"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"vite-tsconfig-paths": "^6.
|
|
71
|
+
"vite-tsconfig-paths": "^6.1.1"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
75
75
|
"@aryaemami59/tsconfig": "workspace:^",
|
|
76
|
-
"@types/node": "^25.2
|
|
77
|
-
"publint": "^0.3.
|
|
78
|
-
"rimraf": "^6.1.
|
|
79
|
-
"tsdown": "^0.
|
|
80
|
-
"typescript": "^
|
|
81
|
-
"vite": "^
|
|
82
|
-
"vitest": "^4.
|
|
76
|
+
"@types/node": "^25.5.2",
|
|
77
|
+
"publint": "^0.3.18",
|
|
78
|
+
"rimraf": "^6.1.3",
|
|
79
|
+
"tsdown": "^0.21.7",
|
|
80
|
+
"typescript": "^6.0.2",
|
|
81
|
+
"vite": "^8.0.3",
|
|
82
|
+
"vitest": "^4.1.2"
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|
|
85
85
|
"vite": "*",
|
|
86
|
-
"vitest": "
|
|
86
|
+
"vitest": "^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0"
|
|
87
87
|
},
|
|
88
88
|
"peerDependenciesMeta": {
|
|
89
89
|
"vite": {
|
package/src/defaults.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { UserWorkspaceConfig, ViteUserConfig } from './external.js'
|
|
2
|
-
import { plugins } from './plugins.js'
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* Default configuration for {@linkcode vitestProject}.
|
|
@@ -18,11 +17,6 @@ export const vitestProjectDefaults = {
|
|
|
18
17
|
'import.meta.vitest': 'undefined',
|
|
19
18
|
},
|
|
20
19
|
|
|
21
|
-
/**
|
|
22
|
-
* @default [tsconfigPaths({ configNames: ['tsconfig.json'], projects: ['./tsconfig.json'] })]
|
|
23
|
-
*/
|
|
24
|
-
plugins,
|
|
25
|
-
|
|
26
20
|
test: {
|
|
27
21
|
/**
|
|
28
22
|
* @default true
|