@html-validate/vitest-config 0.0.0 → 1.0.0
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/README.md +27 -31
- package/dist/index.d.ts +2 -0
- package/dist/index.js +397 -0
- package/package.json +39 -6
package/README.md
CHANGED
|
@@ -1,45 +1,41 @@
|
|
|
1
1
|
# @html-validate/vitest-config
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Vitest shareable preset used by the various HTML-validate packages
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Install Vitest and this preset:
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
```bash
|
|
10
|
+
npm install --save-dev vitest @html-validate/vitest-config
|
|
11
|
+
```
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
1. Configure OIDC trusted publishing for the package name `@html-validate/vitest-config`
|
|
13
|
-
2. Enable secure, token-less publishing from CI/CD workflows
|
|
14
|
-
3. Establish provenance for packages published under this name
|
|
13
|
+
## Usage
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
`vite.config.mts` (or `vitest.config.mts`):
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
```diff
|
|
18
|
+
import { defineConfig } from "vitest/config";
|
|
19
|
+
+import { defineTestConfig } from "@html-validate/vitest-config";
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
export default defineConfig({
|
|
22
|
+
+ test: defineTestConfig(),
|
|
23
|
+
});
|
|
24
|
+
```
|
|
21
25
|
|
|
22
|
-
|
|
26
|
+
### Override defaults
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
2. Configure the trusted publisher (e.g., GitHub Actions)
|
|
26
|
-
3. Specify the repository and workflow that should be allowed to publish
|
|
27
|
-
4. Use the configured workflow to publish your actual package
|
|
28
|
+
You can pass your own config to `defineTestConfig` to override defaults:
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
`vite.config.mts`
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
- Should not be installed as a dependency
|
|
35
|
-
- Exists only for administrative purposes
|
|
32
|
+
```diff
|
|
33
|
+
import { defineConfig } from "vitest/config";
|
|
34
|
+
import { defineTestConfig } from "@html-validate/vitest-config";
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
**Maintained for OIDC setup purposes only**
|
|
36
|
+
export default defineConfig({
|
|
37
|
+
test: defineTestConfig({
|
|
38
|
+
+ environment: "jsdom",
|
|
39
|
+
}),
|
|
40
|
+
});
|
|
41
|
+
```
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __commonJS = (cb, mod2) => function __require() {
|
|
8
|
+
try {
|
|
9
|
+
return mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports;
|
|
10
|
+
} catch (e2) {
|
|
11
|
+
throw mod2 = 0, e2;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target,
|
|
28
|
+
mod2
|
|
29
|
+
));
|
|
30
|
+
|
|
31
|
+
// node_modules/deepmerge/dist/cjs.js
|
|
32
|
+
var require_cjs = __commonJS({
|
|
33
|
+
"node_modules/deepmerge/dist/cjs.js"(exports, module) {
|
|
34
|
+
"use strict";
|
|
35
|
+
var isMergeableObject = function isMergeableObject2(value) {
|
|
36
|
+
return isNonNullObject(value) && !isSpecial(value);
|
|
37
|
+
};
|
|
38
|
+
function isNonNullObject(value) {
|
|
39
|
+
return !!value && typeof value === "object";
|
|
40
|
+
}
|
|
41
|
+
function isSpecial(value) {
|
|
42
|
+
var stringValue = Object.prototype.toString.call(value);
|
|
43
|
+
return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
|
|
44
|
+
}
|
|
45
|
+
var canUseSymbol = typeof Symbol === "function" && Symbol.for;
|
|
46
|
+
var REACT_ELEMENT_TYPE = canUseSymbol ? /* @__PURE__ */ Symbol.for("react.element") : 60103;
|
|
47
|
+
function isReactElement(value) {
|
|
48
|
+
return value.$$typeof === REACT_ELEMENT_TYPE;
|
|
49
|
+
}
|
|
50
|
+
function emptyTarget(val) {
|
|
51
|
+
return Array.isArray(val) ? [] : {};
|
|
52
|
+
}
|
|
53
|
+
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
54
|
+
return options.clone !== false && options.isMergeableObject(value) ? deepmerge2(emptyTarget(value), value, options) : value;
|
|
55
|
+
}
|
|
56
|
+
function defaultArrayMerge(target, source, options) {
|
|
57
|
+
return target.concat(source).map(function(element) {
|
|
58
|
+
return cloneUnlessOtherwiseSpecified(element, options);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function getMergeFunction(key, options) {
|
|
62
|
+
if (!options.customMerge) {
|
|
63
|
+
return deepmerge2;
|
|
64
|
+
}
|
|
65
|
+
var customMerge = options.customMerge(key);
|
|
66
|
+
return typeof customMerge === "function" ? customMerge : deepmerge2;
|
|
67
|
+
}
|
|
68
|
+
function getEnumerableOwnPropertySymbols(target) {
|
|
69
|
+
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
70
|
+
return Object.propertyIsEnumerable.call(target, symbol);
|
|
71
|
+
}) : [];
|
|
72
|
+
}
|
|
73
|
+
function getKeys(target) {
|
|
74
|
+
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
|
|
75
|
+
}
|
|
76
|
+
function propertyIsOnObject(object, property) {
|
|
77
|
+
try {
|
|
78
|
+
return property in object;
|
|
79
|
+
} catch (_2) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function propertyIsUnsafe(target, key) {
|
|
84
|
+
return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
|
|
85
|
+
}
|
|
86
|
+
function mergeObject(target, source, options) {
|
|
87
|
+
var destination = {};
|
|
88
|
+
if (options.isMergeableObject(target)) {
|
|
89
|
+
getKeys(target).forEach(function(key) {
|
|
90
|
+
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
getKeys(source).forEach(function(key) {
|
|
94
|
+
if (propertyIsUnsafe(target, key)) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
|
98
|
+
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
99
|
+
} else {
|
|
100
|
+
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
return destination;
|
|
104
|
+
}
|
|
105
|
+
function deepmerge2(target, source, options) {
|
|
106
|
+
options = options || {};
|
|
107
|
+
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
108
|
+
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
|
109
|
+
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
110
|
+
var sourceIsArray = Array.isArray(source);
|
|
111
|
+
var targetIsArray = Array.isArray(target);
|
|
112
|
+
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
113
|
+
if (!sourceAndTargetTypesMatch) {
|
|
114
|
+
return cloneUnlessOtherwiseSpecified(source, options);
|
|
115
|
+
} else if (sourceIsArray) {
|
|
116
|
+
return options.arrayMerge(target, source, options);
|
|
117
|
+
} else {
|
|
118
|
+
return mergeObject(target, source, options);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
deepmerge2.all = function deepmergeAll(array, options) {
|
|
122
|
+
if (!Array.isArray(array)) {
|
|
123
|
+
throw new Error("first argument should be an array");
|
|
124
|
+
}
|
|
125
|
+
return array.reduce(function(prev, next) {
|
|
126
|
+
return deepmerge2(prev, next, options);
|
|
127
|
+
}, {});
|
|
128
|
+
};
|
|
129
|
+
var deepmerge_1 = deepmerge2;
|
|
130
|
+
module.exports = deepmerge_1;
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
// node_modules/@vitest/coverage-v8/dist/index.js
|
|
135
|
+
import inspector from "node:inspector/promises";
|
|
136
|
+
import { fileURLToPath } from "node:url";
|
|
137
|
+
|
|
138
|
+
// node_modules/std-env/dist/index.mjs
|
|
139
|
+
var e = globalThis.process?.env || /* @__PURE__ */ Object.create(null);
|
|
140
|
+
var t = globalThis.process || { env: e };
|
|
141
|
+
var n = t !== void 0 && t.env && t.env.NODE_ENV || void 0;
|
|
142
|
+
var r = [[`claude`, [`CLAUDECODE`, `CLAUDE_CODE`]], [`replit`, [`REPL_ID`]], [`gemini`, [`GEMINI_CLI`]], [`codex`, [`CODEX_SANDBOX`, `CODEX_THREAD_ID`]], [`opencode`, [`OPENCODE`]], [`pi`, [i(`PATH`, /\.pi[\\/]agent/)]], [`auggie`, [`AUGMENT_AGENT`]], [`goose`, [`GOOSE_PROVIDER`]], [`junie`, [`JUNIE_DATA`, `JUNIE_SHIM_PATH`]], [`devin`, [i(`EDITOR`, /devin/)]], [`cursor`, [`CURSOR_AGENT`]], [`kiro`, [i(`TERM_PROGRAM`, /kiro/, { noTTY: true })]]];
|
|
143
|
+
function i(n2, r2, i2) {
|
|
144
|
+
return () => {
|
|
145
|
+
if (i2?.noTTY && t.stdout?.isTTY) return false;
|
|
146
|
+
let a2 = e[n2];
|
|
147
|
+
return a2 ? r2.test(a2) : false;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function a() {
|
|
151
|
+
let t2 = e.AI_AGENT;
|
|
152
|
+
if (t2) return { name: t2.toLowerCase() };
|
|
153
|
+
for (let [t3, n2] of r) for (let r2 of n2) if (typeof r2 == `string` ? e[r2] : r2()) return { name: t3 };
|
|
154
|
+
return {};
|
|
155
|
+
}
|
|
156
|
+
var o = a();
|
|
157
|
+
var s = o.name;
|
|
158
|
+
var c = !!o.name;
|
|
159
|
+
var l = [[`APPVEYOR`], [`AWS_AMPLIFY`, `AWS_APP_ID`, { ci: true }], [`AZURE_PIPELINES`, `SYSTEM_TEAMFOUNDATIONCOLLECTIONURI`], [`AZURE_STATIC`, `INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN`], [`APPCIRCLE`, `AC_APPCIRCLE`], [`BAMBOO`, `bamboo_planKey`], [`BITBUCKET`, `BITBUCKET_COMMIT`], [`BITRISE`, `BITRISE_IO`], [`BUDDY`, `BUDDY_WORKSPACE_ID`], [`BUILDKITE`], [`CIRCLE`, `CIRCLECI`], [`CIRRUS`, `CIRRUS_CI`], [`CLOUDFLARE_PAGES`, `CF_PAGES`, { ci: true }], [`CLOUDFLARE_WORKERS`, `WORKERS_CI`, { ci: true }], [`GOOGLE_CLOUDRUN`, `K_SERVICE`], [`GOOGLE_CLOUDRUN_JOB`, `CLOUD_RUN_JOB`], [`CODEBUILD`, `CODEBUILD_BUILD_ARN`], [`CODEFRESH`, `CF_BUILD_ID`], [`DRONE`], [`DRONE`, `DRONE_BUILD_EVENT`], [`DSARI`], [`GITHUB_ACTIONS`], [`GITLAB`, `GITLAB_CI`], [`GITLAB`, `CI_MERGE_REQUEST_ID`], [`GOCD`, `GO_PIPELINE_LABEL`], [`LAYERCI`], [`JENKINS`, `JENKINS_URL`], [`HUDSON`, `HUDSON_URL`], [`MAGNUM`], [`NETLIFY`], [`NETLIFY`, `NETLIFY_LOCAL`, { ci: false }], [`NEVERCODE`], [`RENDER`], [`SAIL`, `SAILCI`], [`SEMAPHORE`], [`SCREWDRIVER`], [`SHIPPABLE`], [`SOLANO`, `TDDIUM`], [`STRIDER`], [`TEAMCITY`, `TEAMCITY_VERSION`], [`TRAVIS`], [`VERCEL`, `NOW_BUILDER`], [`VERCEL`, `VERCEL`, { ci: false }], [`VERCEL`, `VERCEL_ENV`, { ci: false }], [`APPCENTER`, `APPCENTER_BUILD_ID`], [`CODESANDBOX`, `CODESANDBOX_SSE`, { ci: false }], [`CODESANDBOX`, `CODESANDBOX_HOST`, { ci: false }], [`STACKBLITZ`], [`STORMKIT`], [`CLEAVR`], [`ZEABUR`], [`CODESPHERE`, `CODESPHERE_APP_ID`, { ci: true }], [`RAILWAY`, `RAILWAY_PROJECT_ID`], [`RAILWAY`, `RAILWAY_SERVICE_ID`], [`DENO-DEPLOY`, `DENO_DEPLOY`], [`DENO-DEPLOY`, `DENO_DEPLOYMENT_ID`], [`FIREBASE_APP_HOSTING`, `FIREBASE_APP_HOSTING`, { ci: true }], [`EDGEONE_PAGES`, `EO_PAGES_CI`, { ci: true }]];
|
|
160
|
+
function u() {
|
|
161
|
+
for (let t2 of l) if (e[t2[1] || t2[0]]) return { name: t2[0].toLowerCase(), ...t2[2] };
|
|
162
|
+
return e.SHELL === `/bin/jsh` && t.versions?.webcontainer ? { name: `stackblitz`, ci: false } : { name: ``, ci: false };
|
|
163
|
+
}
|
|
164
|
+
var d = u();
|
|
165
|
+
var f = d.name;
|
|
166
|
+
var p = t.platform || ``;
|
|
167
|
+
var m = !!e.CI || d.ci !== false;
|
|
168
|
+
var h = !!t.stdout?.isTTY;
|
|
169
|
+
var _ = !!e.DEBUG;
|
|
170
|
+
var v = n === `test` || !!e.TEST;
|
|
171
|
+
var y = n === `production` || e.MODE === `production`;
|
|
172
|
+
var b = n === `dev` || n === `development` || e.MODE === `development`;
|
|
173
|
+
var x = !!e.MINIMAL || m || v || !h;
|
|
174
|
+
var S = /^win/i.test(p);
|
|
175
|
+
var C = /^linux/i.test(p);
|
|
176
|
+
var w = /^darwin/i.test(p);
|
|
177
|
+
var T = !e.NO_COLOR && (!!e.FORCE_COLOR || (h || S) && e.TERM !== `dumb` || m);
|
|
178
|
+
var E = (t.versions?.node || ``).replace(/^v/, ``) || null;
|
|
179
|
+
var D = Number(E?.split(`.`)[0]) || null;
|
|
180
|
+
var O = !!t?.versions?.node;
|
|
181
|
+
var k = `Bun` in globalThis;
|
|
182
|
+
var A = `Deno` in globalThis;
|
|
183
|
+
var j = `fastly` in globalThis;
|
|
184
|
+
var M = `Netlify` in globalThis;
|
|
185
|
+
var N = `EdgeRuntime` in globalThis;
|
|
186
|
+
var P = globalThis.navigator?.userAgent === `Cloudflare-Workers`;
|
|
187
|
+
var F = [[M, `netlify`], [N, `edge-light`], [P, `workerd`], [j, `fastly`], [A, `deno`], [k, `bun`], [O, `node`]];
|
|
188
|
+
function I() {
|
|
189
|
+
let e2 = F.find((e3) => e3[0]);
|
|
190
|
+
if (e2) return { name: e2[1] };
|
|
191
|
+
}
|
|
192
|
+
var L = I();
|
|
193
|
+
var R = L?.name || ``;
|
|
194
|
+
|
|
195
|
+
// node_modules/@vitest/coverage-v8/dist/load-provider-CdgAx3rL.js
|
|
196
|
+
var name = "./provider.js";
|
|
197
|
+
async function loadProvider() {
|
|
198
|
+
const { V8CoverageProvider } = await import(
|
|
199
|
+
/* @vite-ignore */
|
|
200
|
+
name
|
|
201
|
+
);
|
|
202
|
+
return new V8CoverageProvider();
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// node_modules/@vitest/coverage-v8/dist/pathe.M-eThtNZ-BTaAGrLg.js
|
|
206
|
+
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
207
|
+
function normalizeWindowsPath(input = "") {
|
|
208
|
+
if (!input) {
|
|
209
|
+
return input;
|
|
210
|
+
}
|
|
211
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r2) => r2.toUpperCase());
|
|
212
|
+
}
|
|
213
|
+
var _UNC_REGEX = /^[/\\]{2}/;
|
|
214
|
+
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
215
|
+
var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
216
|
+
var normalize = function(path) {
|
|
217
|
+
if (path.length === 0) {
|
|
218
|
+
return ".";
|
|
219
|
+
}
|
|
220
|
+
path = normalizeWindowsPath(path);
|
|
221
|
+
const isUNCPath = path.match(_UNC_REGEX);
|
|
222
|
+
const isPathAbsolute = isAbsolute(path);
|
|
223
|
+
const trailingSeparator = path[path.length - 1] === "/";
|
|
224
|
+
path = normalizeString(path, !isPathAbsolute);
|
|
225
|
+
if (path.length === 0) {
|
|
226
|
+
if (isPathAbsolute) {
|
|
227
|
+
return "/";
|
|
228
|
+
}
|
|
229
|
+
return trailingSeparator ? "./" : ".";
|
|
230
|
+
}
|
|
231
|
+
if (trailingSeparator) {
|
|
232
|
+
path += "/";
|
|
233
|
+
}
|
|
234
|
+
if (_DRIVE_LETTER_RE.test(path)) {
|
|
235
|
+
path += "/";
|
|
236
|
+
}
|
|
237
|
+
if (isUNCPath) {
|
|
238
|
+
if (!isPathAbsolute) {
|
|
239
|
+
return `//./${path}`;
|
|
240
|
+
}
|
|
241
|
+
return `//${path}`;
|
|
242
|
+
}
|
|
243
|
+
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
244
|
+
};
|
|
245
|
+
function normalizeString(path, allowAboveRoot) {
|
|
246
|
+
let res = "";
|
|
247
|
+
let lastSegmentLength = 0;
|
|
248
|
+
let lastSlash = -1;
|
|
249
|
+
let dots = 0;
|
|
250
|
+
let char = null;
|
|
251
|
+
for (let index = 0; index <= path.length; ++index) {
|
|
252
|
+
if (index < path.length) {
|
|
253
|
+
char = path[index];
|
|
254
|
+
} else if (char === "/") {
|
|
255
|
+
break;
|
|
256
|
+
} else {
|
|
257
|
+
char = "/";
|
|
258
|
+
}
|
|
259
|
+
if (char === "/") {
|
|
260
|
+
if (lastSlash === index - 1 || dots === 1) ;
|
|
261
|
+
else if (dots === 2) {
|
|
262
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
263
|
+
if (res.length > 2) {
|
|
264
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
265
|
+
if (lastSlashIndex === -1) {
|
|
266
|
+
res = "";
|
|
267
|
+
lastSegmentLength = 0;
|
|
268
|
+
} else {
|
|
269
|
+
res = res.slice(0, lastSlashIndex);
|
|
270
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
271
|
+
}
|
|
272
|
+
lastSlash = index;
|
|
273
|
+
dots = 0;
|
|
274
|
+
continue;
|
|
275
|
+
} else if (res.length > 0) {
|
|
276
|
+
res = "";
|
|
277
|
+
lastSegmentLength = 0;
|
|
278
|
+
lastSlash = index;
|
|
279
|
+
dots = 0;
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
if (allowAboveRoot) {
|
|
284
|
+
res += res.length > 0 ? "/.." : "..";
|
|
285
|
+
lastSegmentLength = 2;
|
|
286
|
+
}
|
|
287
|
+
} else {
|
|
288
|
+
if (res.length > 0) {
|
|
289
|
+
res += `/${path.slice(lastSlash + 1, index)}`;
|
|
290
|
+
} else {
|
|
291
|
+
res = path.slice(lastSlash + 1, index);
|
|
292
|
+
}
|
|
293
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
294
|
+
}
|
|
295
|
+
lastSlash = index;
|
|
296
|
+
dots = 0;
|
|
297
|
+
} else if (char === "." && dots !== -1) {
|
|
298
|
+
++dots;
|
|
299
|
+
} else {
|
|
300
|
+
dots = -1;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
return res;
|
|
304
|
+
}
|
|
305
|
+
var isAbsolute = function(p2) {
|
|
306
|
+
return _IS_ABSOLUTE_RE.test(p2);
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
// node_modules/@vitest/coverage-v8/dist/index.js
|
|
310
|
+
var session = new inspector.Session();
|
|
311
|
+
var enabled = false;
|
|
312
|
+
var mod = {
|
|
313
|
+
async startCoverage({ isolate }) {
|
|
314
|
+
if (isolate === false && enabled) {
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
enabled = true;
|
|
318
|
+
session.connect();
|
|
319
|
+
await session.post("Profiler.enable");
|
|
320
|
+
await session.post("Profiler.startPreciseCoverage", {
|
|
321
|
+
callCount: true,
|
|
322
|
+
detailed: true
|
|
323
|
+
});
|
|
324
|
+
},
|
|
325
|
+
async takeCoverage(options) {
|
|
326
|
+
if (f === "stackblitz") {
|
|
327
|
+
return { result: [] };
|
|
328
|
+
}
|
|
329
|
+
const coverage = await session.post("Profiler.takePreciseCoverage");
|
|
330
|
+
const result = [];
|
|
331
|
+
for (const entry of coverage.result) {
|
|
332
|
+
if (filterResult(entry)) {
|
|
333
|
+
result.push({
|
|
334
|
+
...entry,
|
|
335
|
+
startOffset: options?.moduleExecutionInfo?.get(normalize(fileURLToPath(entry.url)))?.startOffset || 0
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return { result };
|
|
340
|
+
},
|
|
341
|
+
async stopCoverage({ isolate }) {
|
|
342
|
+
if (isolate === false) {
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
await session.post("Profiler.stopPreciseCoverage");
|
|
346
|
+
await session.post("Profiler.disable");
|
|
347
|
+
session.disconnect();
|
|
348
|
+
},
|
|
349
|
+
async getProvider() {
|
|
350
|
+
return loadProvider();
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
function filterResult(coverage) {
|
|
354
|
+
if (!coverage.url.startsWith("file://")) {
|
|
355
|
+
return false;
|
|
356
|
+
}
|
|
357
|
+
if (coverage.url.includes("/node_modules/")) {
|
|
358
|
+
return false;
|
|
359
|
+
}
|
|
360
|
+
if (coverage.url.includes("/@id/@vitest/")) {
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
363
|
+
if (coverage.url.includes("/@vite/client")) {
|
|
364
|
+
return false;
|
|
365
|
+
}
|
|
366
|
+
return true;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// src/index.ts
|
|
370
|
+
var import_deepmerge = __toESM(require_cjs(), 1);
|
|
371
|
+
var defaultTestConfig = {
|
|
372
|
+
coverage: {
|
|
373
|
+
provider: mod,
|
|
374
|
+
reporter: ["text", "text-summary", "cobertura", "html", "json", "lcov"],
|
|
375
|
+
include: ["src/**/*.[jt]s"],
|
|
376
|
+
exclude: [
|
|
377
|
+
"**/*.cy.ts",
|
|
378
|
+
"**/*.d.ts",
|
|
379
|
+
"**/__fixtures__/**",
|
|
380
|
+
"**/generated/**",
|
|
381
|
+
"**/index.[jt]s",
|
|
382
|
+
"**/temp/**"
|
|
383
|
+
]
|
|
384
|
+
},
|
|
385
|
+
reporters: ["default", ["junit", { suiteName: "Vitest tests" }]],
|
|
386
|
+
outputFile: "./temp/vitest-junit.xml",
|
|
387
|
+
exclude: ["**/.git/**", "**/build/**", "**/dist/**", "**/node_modules/**", "**/temp/**"]
|
|
388
|
+
};
|
|
389
|
+
function overwriteMerge(_a, b2) {
|
|
390
|
+
return b2;
|
|
391
|
+
}
|
|
392
|
+
function defineTestConfig(userConfig = {}) {
|
|
393
|
+
return (0, import_deepmerge.default)(defaultTestConfig, userConfig, { arrayMerge: overwriteMerge });
|
|
394
|
+
}
|
|
395
|
+
export {
|
|
396
|
+
defineTestConfig
|
|
397
|
+
};
|
package/package.json
CHANGED
|
@@ -1,10 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@html-validate/vitest-config",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Vitest shareable preset used by the various HTML-validate packages",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
"vitest"
|
|
7
|
+
],
|
|
8
|
+
"homepage": "https://gitlab.com/html-validate/vitest-config#readme",
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://gitlab.com/html-validate/vitest-config/issues"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://gitlab.com/html-validate/vitest-config.git"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"author": "David Sveningsson <ext@sidvind.com>",
|
|
18
|
+
"type": "module",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"import": "./dist/index.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"main": "dist/index.js",
|
|
26
|
+
"types": "dist/index.d.ts",
|
|
27
|
+
"files": [
|
|
28
|
+
"dist/"
|
|
29
|
+
],
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@vitest/coverage-v8": "^4.1.0"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"vitest": "^4.0.0"
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": "^22.16 || ^24 || >= 26",
|
|
38
|
+
"npm": ">= 10"
|
|
39
|
+
},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
}
|
|
10
43
|
}
|