vitest 0.0.113 → 0.0.117
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/LICENSE.md +61 -33
- package/dist/cli.js +1112 -35
- package/dist/{constants-900abe4a.js → constants-080f26e8.js} +2 -2
- package/dist/{diff-9c43ab50.js → diff-80c47cfa.js} +1 -2
- package/dist/entry.js +68 -26
- package/dist/{global-75208c77.js → global-d95ee155.js} +8 -9
- package/dist/{index-09437c50.js → index-2b1f526f.js} +2 -2
- package/dist/{index-c3f2f9fe.js → index-33d800eb.js} +182 -111
- package/dist/{index-61c8686f.js → index-648e7ab2.js} +62 -62
- package/dist/index-6e709f57.js +781 -0
- package/dist/index-bf29f0e6.js +386 -0
- package/dist/{index-9f4b9905.js → index-ce49e384.js} +33 -800
- package/dist/index-e909c175.js +62 -0
- package/dist/index.d.ts +97 -35
- package/dist/index.js +6 -4
- package/dist/{jest-mock-a57b745c.js → jest-mock-4a754991.js} +1 -12
- package/dist/node.d.ts +87 -16
- package/dist/node.js +10 -9
- package/dist/rpc-8c7cc374.js +5 -0
- package/dist/setup-95b119ff.js +4318 -0
- package/dist/utils.js +2 -2
- package/dist/{vi-51946984.js → vi-39f06eb7.js} +30 -6
- package/dist/worker.js +25 -40
- package/package.json +7 -6
- package/vitest.mjs +1 -20
- package/dist/index-041e627e.js +0 -168
- package/dist/index-1488b423.js +0 -186
- package/dist/middleware-0ebc5238.js +0 -79
- package/dist/rpc-7de86f29.js +0 -10
package/dist/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { e as ensurePackageInstalled, g as getFullName,
|
|
2
|
-
|
|
1
|
+
export { l as deepMerge, e as ensurePackageInstalled, g as getFullName, u as getNames, f as getSuites, z as getTasks, j as getTests, h as hasFailed, x as hasTests, v as interpretOnlyMode, i as isObject, y as isWindows, p as mergeSlashes, n as noop, o as notNullish, w as partitionSuiteChildren, k as resolvePath, s as slash, t as toArray, m as toFilePath } from './index-bf29f0e6.js';
|
|
2
|
+
import 'url';
|
|
3
3
|
import 'tty';
|
|
4
4
|
import 'local-pkg';
|
|
5
5
|
import 'path';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import { n as noop } from './index-041e627e.js';
|
|
1
|
+
import { n as noop, i as isObject } from './index-bf29f0e6.js';
|
|
3
2
|
import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-c9e3b764.js';
|
|
3
|
+
import { a as spyOn, f as fn, s as spies } from './jest-mock-4a754991.js';
|
|
4
4
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __defProps = Object.defineProperties;
|
|
@@ -134,7 +134,7 @@ function createSuiteCollector(name, factory = () => {
|
|
|
134
134
|
const mode2 = this.only ? "only" : this.skip ? "skip" : this.todo ? "todo" : "run";
|
|
135
135
|
const computeMode = this.concurrent ? "concurrent" : void 0;
|
|
136
136
|
const test3 = {
|
|
137
|
-
id:
|
|
137
|
+
id: "",
|
|
138
138
|
type: "test",
|
|
139
139
|
name: name2,
|
|
140
140
|
mode: mode2,
|
|
@@ -160,7 +160,7 @@ function createSuiteCollector(name, factory = () => {
|
|
|
160
160
|
}
|
|
161
161
|
function initSuite() {
|
|
162
162
|
suite2 = {
|
|
163
|
-
id:
|
|
163
|
+
id: "",
|
|
164
164
|
type: "suite",
|
|
165
165
|
computeMode: "serial",
|
|
166
166
|
name,
|
|
@@ -199,7 +199,6 @@ function createSuite() {
|
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
const isObject = (val) => toString.call(val) === "[object Object]";
|
|
203
202
|
function equals(a, b, customTesters, strictCheck) {
|
|
204
203
|
customTesters = customTesters || [];
|
|
205
204
|
return eq(a, b, [], [], customTesters, strictCheck ? hasKey : hasDefinedKey);
|
|
@@ -430,6 +429,31 @@ const subsetEquality = (object, subset) => {
|
|
|
430
429
|
};
|
|
431
430
|
return subsetEqualityWithContext()(object, subset);
|
|
432
431
|
};
|
|
432
|
+
const typeEquality = (a, b) => {
|
|
433
|
+
if (a == null || b == null || a.constructor === b.constructor)
|
|
434
|
+
return void 0;
|
|
435
|
+
return false;
|
|
436
|
+
};
|
|
437
|
+
const arrayBufferEquality = (a, b) => {
|
|
438
|
+
if (!(a instanceof ArrayBuffer) || !(b instanceof ArrayBuffer))
|
|
439
|
+
return void 0;
|
|
440
|
+
const dataViewA = new DataView(a);
|
|
441
|
+
const dataViewB = new DataView(b);
|
|
442
|
+
if (dataViewA.byteLength !== dataViewB.byteLength)
|
|
443
|
+
return false;
|
|
444
|
+
for (let i = 0; i < dataViewA.byteLength; i++) {
|
|
445
|
+
if (dataViewA.getUint8(i) !== dataViewB.getUint8(i))
|
|
446
|
+
return false;
|
|
447
|
+
}
|
|
448
|
+
return true;
|
|
449
|
+
};
|
|
450
|
+
const sparseArrayEquality = (a, b) => {
|
|
451
|
+
if (!Array.isArray(a) || !Array.isArray(b))
|
|
452
|
+
return void 0;
|
|
453
|
+
const aKeys = Object.keys(a);
|
|
454
|
+
const bKeys = Object.keys(b);
|
|
455
|
+
return equals(a, b, [iterableEquality, typeEquality], true) && equals(aKeys, bKeys);
|
|
456
|
+
};
|
|
433
457
|
|
|
434
458
|
const MATCHERS_OBJECT = Symbol.for("matchers-object");
|
|
435
459
|
if (!Object.prototype.hasOwnProperty.call(global, MATCHERS_OBJECT)) {
|
|
@@ -488,7 +512,7 @@ const JestChaiExpect = (chai, utils) => {
|
|
|
488
512
|
return this.eql(expected);
|
|
489
513
|
});
|
|
490
514
|
def("toStrictEqual", function(expected) {
|
|
491
|
-
return this
|
|
515
|
+
return iterableEquality(this, expected) ?? typeEquality(this, expected) ?? sparseArrayEquality(this, expected) ?? arrayBufferEquality(this, expected);
|
|
492
516
|
});
|
|
493
517
|
def("toBe", function(expected) {
|
|
494
518
|
return this.equal(expected);
|
package/dist/worker.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { c as distDir } from './constants-
|
|
1
|
+
import { k as resolve, d as dirname$2, b as basename$2, p as mergeSlashes, s as slash, m as toFilePath } from './index-bf29f0e6.js';
|
|
2
|
+
import { c as createBirpc } from './index-e909c175.js';
|
|
3
|
+
import { c as distDir } from './constants-080f26e8.js';
|
|
4
4
|
import { builtinModules, createRequire } from 'module';
|
|
5
5
|
import { pathToFileURL, fileURLToPath as fileURLToPath$2, URL as URL$1 } from 'url';
|
|
6
6
|
import vm from 'vm';
|
|
7
7
|
import path from 'path';
|
|
8
|
-
import fs, { promises, realpathSync, statSync, Stats,
|
|
8
|
+
import fs, { promises, realpathSync, statSync, Stats, existsSync, readdirSync } from 'fs';
|
|
9
9
|
import assert from 'assert';
|
|
10
10
|
import { format as format$2, inspect } from 'util';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import 'chai';
|
|
14
|
-
import 'tinyspy';
|
|
11
|
+
import { a as spyOn, s as spies } from './jest-mock-4a754991.js';
|
|
12
|
+
import { r as rpc } from './rpc-8c7cc374.js';
|
|
15
13
|
import 'tty';
|
|
16
14
|
import 'local-pkg';
|
|
15
|
+
import 'chai';
|
|
16
|
+
import 'tinyspy';
|
|
17
17
|
|
|
18
18
|
const BUILTIN_MODULES$1 = new Set(builtinModules);
|
|
19
19
|
function normalizeSlash$1(str) {
|
|
@@ -7664,7 +7664,7 @@ function find(dir) {
|
|
|
7664
7664
|
|
|
7665
7665
|
// Manually “tree shaken” from:
|
|
7666
7666
|
|
|
7667
|
-
const isWindows
|
|
7667
|
+
const isWindows = process.platform === 'win32';
|
|
7668
7668
|
|
|
7669
7669
|
const own$1 = {}.hasOwnProperty;
|
|
7670
7670
|
|
|
@@ -7838,7 +7838,7 @@ codes.ERR_UNSUPPORTED_ESM_URL_SCHEME = createError(
|
|
|
7838
7838
|
let message =
|
|
7839
7839
|
'Only file and data URLs are supported by the default ESM loader';
|
|
7840
7840
|
|
|
7841
|
-
if (isWindows
|
|
7841
|
+
if (isWindows && url.protocol.length === 2) {
|
|
7842
7842
|
message += '. On Windows, absolute paths must be valid file:// URLs';
|
|
7843
7843
|
}
|
|
7844
7844
|
|
|
@@ -9219,6 +9219,8 @@ var __spreadValues = (a, b) => {
|
|
|
9219
9219
|
function resolveMockPath(mockPath, root, nmName) {
|
|
9220
9220
|
if (nmName) {
|
|
9221
9221
|
const mockFolder = resolve(root, "__mocks__");
|
|
9222
|
+
if (!existsSync(mockFolder))
|
|
9223
|
+
return null;
|
|
9222
9224
|
const files = readdirSync(mockFolder);
|
|
9223
9225
|
for (const file of files) {
|
|
9224
9226
|
const [basename2] = file.split(".");
|
|
@@ -9326,7 +9328,6 @@ const depsExternal = [
|
|
|
9326
9328
|
/\.cjs.js$/,
|
|
9327
9329
|
/\.mjs$/
|
|
9328
9330
|
];
|
|
9329
|
-
const isWindows = process.platform === "win32";
|
|
9330
9331
|
const stubRequests = {
|
|
9331
9332
|
"/@vite/client": {
|
|
9332
9333
|
injectQuery: (id) => id,
|
|
@@ -9531,12 +9532,6 @@ async function shouldExternalize(id, config) {
|
|
|
9531
9532
|
return false;
|
|
9532
9533
|
return id.includes("/node_modules/") && await isValidNodeImport(id);
|
|
9533
9534
|
}
|
|
9534
|
-
function toFilePath(id, root) {
|
|
9535
|
-
let absolute = slash(id).startsWith("/@fs/") ? id.slice(4) : id.startsWith(dirname$2(root)) ? id : id.startsWith("/") ? slash(resolve(root, id.slice(1))) : id;
|
|
9536
|
-
if (absolute.startsWith("//"))
|
|
9537
|
-
absolute = absolute.slice(1);
|
|
9538
|
-
return isWindows && absolute.startsWith("/") ? fileURLToPath$2(pathToFileURL(absolute.slice(1)).href) : absolute;
|
|
9539
|
-
}
|
|
9540
9535
|
function matchExternalizePattern(id, patterns) {
|
|
9541
9536
|
for (const ex of patterns) {
|
|
9542
9537
|
if (typeof ex === "string") {
|
|
@@ -9566,10 +9561,10 @@ async function startViteNode(ctx) {
|
|
|
9566
9561
|
return _viteNode;
|
|
9567
9562
|
const processExit = process.exit;
|
|
9568
9563
|
process.on("beforeExit", (code) => {
|
|
9569
|
-
|
|
9564
|
+
rpc().onWorkerExit(code);
|
|
9570
9565
|
});
|
|
9571
9566
|
process.exit = (code = process.exitCode || 0) => {
|
|
9572
|
-
|
|
9567
|
+
rpc().onWorkerExit(code);
|
|
9573
9568
|
return processExit(code);
|
|
9574
9569
|
};
|
|
9575
9570
|
const { config } = ctx;
|
|
@@ -9579,7 +9574,7 @@ async function startViteNode(ctx) {
|
|
|
9579
9574
|
resolve(distDir, "entry.js")
|
|
9580
9575
|
],
|
|
9581
9576
|
fetch(id) {
|
|
9582
|
-
return
|
|
9577
|
+
return rpc().fetch(id);
|
|
9583
9578
|
},
|
|
9584
9579
|
inline: config.depsInline,
|
|
9585
9580
|
external: config.depsExternal,
|
|
@@ -9595,31 +9590,21 @@ function init(ctx) {
|
|
|
9595
9590
|
throw new Error(`worker for ${ctx.files.join(",")} already initialized by ${process.__vitest_worker__.ctx.files.join(",")}. This is probably an internal bug of Vitest.`);
|
|
9596
9591
|
process.stdout.write("\0");
|
|
9597
9592
|
const { config, port } = ctx;
|
|
9598
|
-
const rpcPromiseMap = /* @__PURE__ */ new Map();
|
|
9599
9593
|
process.__vitest_worker__ = {
|
|
9600
9594
|
ctx,
|
|
9601
9595
|
moduleCache,
|
|
9602
9596
|
config,
|
|
9603
|
-
rpc: (
|
|
9604
|
-
|
|
9605
|
-
|
|
9606
|
-
|
|
9607
|
-
port.postMessage(
|
|
9608
|
-
}
|
|
9609
|
-
|
|
9610
|
-
|
|
9611
|
-
|
|
9612
|
-
}
|
|
9597
|
+
rpc: createBirpc({
|
|
9598
|
+
functions: {},
|
|
9599
|
+
eventNames: ["onUserLog", "onCollected", "onWorkerExit"],
|
|
9600
|
+
post(v) {
|
|
9601
|
+
port.postMessage(v);
|
|
9602
|
+
},
|
|
9603
|
+
on(fn) {
|
|
9604
|
+
port.addListener("message", fn);
|
|
9605
|
+
}
|
|
9606
|
+
})
|
|
9613
9607
|
};
|
|
9614
|
-
port.addListener("message", async (data) => {
|
|
9615
|
-
const api = rpcPromiseMap.get(data.id);
|
|
9616
|
-
if (api) {
|
|
9617
|
-
if (data.error)
|
|
9618
|
-
api.reject(data.error);
|
|
9619
|
-
else
|
|
9620
|
-
api.resolve(data.result);
|
|
9621
|
-
}
|
|
9622
|
-
});
|
|
9623
9608
|
if (ctx.invalidates)
|
|
9624
9609
|
ctx.invalidates.forEach((i) => moduleCache.delete(i));
|
|
9625
9610
|
ctx.files.forEach((i) => moduleCache.delete(i));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.117",
|
|
4
4
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vite",
|
|
@@ -60,13 +60,15 @@
|
|
|
60
60
|
"@types/jsdom": "^16.2.14",
|
|
61
61
|
"@types/micromatch": "^4.0.2",
|
|
62
62
|
"@types/natural-compare": "^1.4.1",
|
|
63
|
-
"@types/node": "^17.0.
|
|
63
|
+
"@types/node": "^17.0.5",
|
|
64
64
|
"@types/prompts": "^2.4.0",
|
|
65
|
+
"birpc": "^0.0.2",
|
|
65
66
|
"c8": "^7.10.0",
|
|
66
67
|
"cac": "^6.7.12",
|
|
67
68
|
"chai-subset": "^1.6.0",
|
|
68
69
|
"cli-truncate": "^3.1.0",
|
|
69
70
|
"diff": "^5.0.0",
|
|
71
|
+
"execa": "^6.0.0",
|
|
70
72
|
"fast-glob": "^3.2.7",
|
|
71
73
|
"find-up": "^6.2.0",
|
|
72
74
|
"flatted": "^3.2.4",
|
|
@@ -77,7 +79,6 @@
|
|
|
77
79
|
"micromatch": "^4.0.4",
|
|
78
80
|
"mlly": "^0.3.16",
|
|
79
81
|
"mockdate": "^3.0.5",
|
|
80
|
-
"nanoid": "^3.1.30",
|
|
81
82
|
"natural-compare": "^1.4.0",
|
|
82
83
|
"pathe": "^0.2.0",
|
|
83
84
|
"picocolors": "^1.0.0",
|
|
@@ -87,7 +88,8 @@
|
|
|
87
88
|
"rollup": "^2.62.0",
|
|
88
89
|
"source-map-js": "^1.0.1",
|
|
89
90
|
"strip-ansi": "^7.0.1",
|
|
90
|
-
"typescript": "^4.5.4"
|
|
91
|
+
"typescript": "^4.5.4",
|
|
92
|
+
"ws": "^8.4.0"
|
|
91
93
|
},
|
|
92
94
|
"peerDependencies": {
|
|
93
95
|
"c8": "*",
|
|
@@ -111,8 +113,7 @@
|
|
|
111
113
|
},
|
|
112
114
|
"scripts": {
|
|
113
115
|
"build": "rimraf dist && rollup -c",
|
|
114
|
-
"dev": "rollup -c --watch src"
|
|
115
|
-
"typecheck": "tsc --noEmit"
|
|
116
|
+
"dev": "rollup -c --watch src"
|
|
116
117
|
},
|
|
117
118
|
"readme": "# vitest\n\n[](https://www.npmjs.com/package/vitest)\n\nA blazing fast unit test framework powered by Vite.\n\n> **This project is currently in closed beta exclusively for Sponsors.**<br>\n> Become a Sponsor of [@patak-dev](https://github.com/sponsors/patak-dev) or [@antfu](https://github.com/sponsors/antfu) to access the source code and issues tracker.\n> Learn more at [vitest.dev](https://vitest.dev)\n"
|
|
118
119
|
}
|
package/vitest.mjs
CHANGED
|
@@ -1,21 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { fileURLToPath } from 'url'
|
|
4
|
-
import { ensurePackageInstalled, resolvePath } from './dist/utils.js'
|
|
5
|
-
|
|
6
|
-
const argv = process.argv.slice(2)
|
|
7
|
-
|
|
8
|
-
if (!await ensurePackageInstalled('vite'))
|
|
9
|
-
process.exit(1)
|
|
10
|
-
|
|
11
|
-
if (argv.includes('--coverage')) {
|
|
12
|
-
if (!await ensurePackageInstalled('c8'))
|
|
13
|
-
process.exit(1)
|
|
14
|
-
const filename = fileURLToPath(import.meta.url)
|
|
15
|
-
const entry = resolvePath(filename, '../dist/cli.js')
|
|
16
|
-
process.argv.splice(2, 0, process.argv[0], entry)
|
|
17
|
-
await import('c8/bin/c8.js')
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
await import('./dist/cli.js')
|
|
21
|
-
}
|
|
2
|
+
import('./dist/cli.js')
|
package/dist/index-041e627e.js
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import require$$0 from 'tty';
|
|
2
|
-
import { isPackageExists } from 'local-pkg';
|
|
3
|
-
|
|
4
|
-
var picocolors = {exports: {}};
|
|
5
|
-
|
|
6
|
-
let tty = require$$0;
|
|
7
|
-
|
|
8
|
-
let isColorSupported =
|
|
9
|
-
!("NO_COLOR" in process.env || process.argv.includes("--no-color")) &&
|
|
10
|
-
("FORCE_COLOR" in process.env ||
|
|
11
|
-
process.argv.includes("--color") ||
|
|
12
|
-
process.platform === "win32" ||
|
|
13
|
-
(tty.isatty(1) && process.env.TERM !== "dumb") ||
|
|
14
|
-
"CI" in process.env);
|
|
15
|
-
|
|
16
|
-
let formatter =
|
|
17
|
-
(open, close, replace = open) =>
|
|
18
|
-
input => {
|
|
19
|
-
let string = "" + input;
|
|
20
|
-
let index = string.indexOf(close, open.length);
|
|
21
|
-
return ~index
|
|
22
|
-
? open + replaceClose(string, close, replace, index) + close
|
|
23
|
-
: open + string + close
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
let replaceClose = (string, close, replace, index) => {
|
|
27
|
-
let start = string.substring(0, index) + replace;
|
|
28
|
-
let end = string.substring(index + close.length);
|
|
29
|
-
let nextIndex = end.indexOf(close);
|
|
30
|
-
return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
let createColors = (enabled = isColorSupported) => ({
|
|
34
|
-
isColorSupported: enabled,
|
|
35
|
-
reset: enabled ? s => `\x1b[0m${s}\x1b[0m` : String,
|
|
36
|
-
bold: enabled ? formatter("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m") : String,
|
|
37
|
-
dim: enabled ? formatter("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m") : String,
|
|
38
|
-
italic: enabled ? formatter("\x1b[3m", "\x1b[23m") : String,
|
|
39
|
-
underline: enabled ? formatter("\x1b[4m", "\x1b[24m") : String,
|
|
40
|
-
inverse: enabled ? formatter("\x1b[7m", "\x1b[27m") : String,
|
|
41
|
-
hidden: enabled ? formatter("\x1b[8m", "\x1b[28m") : String,
|
|
42
|
-
strikethrough: enabled ? formatter("\x1b[9m", "\x1b[29m") : String,
|
|
43
|
-
black: enabled ? formatter("\x1b[30m", "\x1b[39m") : String,
|
|
44
|
-
red: enabled ? formatter("\x1b[31m", "\x1b[39m") : String,
|
|
45
|
-
green: enabled ? formatter("\x1b[32m", "\x1b[39m") : String,
|
|
46
|
-
yellow: enabled ? formatter("\x1b[33m", "\x1b[39m") : String,
|
|
47
|
-
blue: enabled ? formatter("\x1b[34m", "\x1b[39m") : String,
|
|
48
|
-
magenta: enabled ? formatter("\x1b[35m", "\x1b[39m") : String,
|
|
49
|
-
cyan: enabled ? formatter("\x1b[36m", "\x1b[39m") : String,
|
|
50
|
-
white: enabled ? formatter("\x1b[37m", "\x1b[39m") : String,
|
|
51
|
-
gray: enabled ? formatter("\x1b[90m", "\x1b[39m") : String,
|
|
52
|
-
bgBlack: enabled ? formatter("\x1b[40m", "\x1b[49m") : String,
|
|
53
|
-
bgRed: enabled ? formatter("\x1b[41m", "\x1b[49m") : String,
|
|
54
|
-
bgGreen: enabled ? formatter("\x1b[42m", "\x1b[49m") : String,
|
|
55
|
-
bgYellow: enabled ? formatter("\x1b[43m", "\x1b[49m") : String,
|
|
56
|
-
bgBlue: enabled ? formatter("\x1b[44m", "\x1b[49m") : String,
|
|
57
|
-
bgMagenta: enabled ? formatter("\x1b[45m", "\x1b[49m") : String,
|
|
58
|
-
bgCyan: enabled ? formatter("\x1b[46m", "\x1b[49m") : String,
|
|
59
|
-
bgWhite: enabled ? formatter("\x1b[47m", "\x1b[49m") : String,
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
picocolors.exports = createColors();
|
|
63
|
-
picocolors.exports.createColors = createColors;
|
|
64
|
-
|
|
65
|
-
var c = picocolors.exports;
|
|
66
|
-
|
|
67
|
-
function toArray(array) {
|
|
68
|
-
array = array || [];
|
|
69
|
-
if (Array.isArray(array))
|
|
70
|
-
return array;
|
|
71
|
-
return [array];
|
|
72
|
-
}
|
|
73
|
-
function notNullish(v) {
|
|
74
|
-
return v != null;
|
|
75
|
-
}
|
|
76
|
-
function slash(str) {
|
|
77
|
-
return str.replace(/\\/g, "/");
|
|
78
|
-
}
|
|
79
|
-
function mergeSlashes(str) {
|
|
80
|
-
return str.replace(/\/\//g, "/");
|
|
81
|
-
}
|
|
82
|
-
const noop = () => {
|
|
83
|
-
};
|
|
84
|
-
function partitionSuiteChildren(suite) {
|
|
85
|
-
let tasksGroup = [];
|
|
86
|
-
const tasksGroups = [];
|
|
87
|
-
for (const c2 of suite.tasks) {
|
|
88
|
-
if (tasksGroup.length === 0 || c2.computeMode === tasksGroup[0].computeMode) {
|
|
89
|
-
tasksGroup.push(c2);
|
|
90
|
-
} else {
|
|
91
|
-
tasksGroups.push(tasksGroup);
|
|
92
|
-
tasksGroup = [c2];
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
if (tasksGroup.length > 0)
|
|
96
|
-
tasksGroups.push(tasksGroup);
|
|
97
|
-
return tasksGroups;
|
|
98
|
-
}
|
|
99
|
-
function interpretOnlyMode(tasks) {
|
|
100
|
-
if (tasks.some((t) => t.mode === "only")) {
|
|
101
|
-
tasks.forEach((t) => {
|
|
102
|
-
if (t.mode === "run")
|
|
103
|
-
t.mode = "skip";
|
|
104
|
-
else if (t.mode === "only")
|
|
105
|
-
t.mode = "run";
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
tasks.forEach((t) => {
|
|
109
|
-
if (t.type === "suite") {
|
|
110
|
-
if (t.mode === "skip")
|
|
111
|
-
t.tasks.forEach((c2) => c2.mode === "run" && (c2.mode = "skip"));
|
|
112
|
-
else
|
|
113
|
-
interpretOnlyMode(t.tasks);
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
function getTests(suite) {
|
|
118
|
-
return toArray(suite).flatMap((s) => s.type === "test" ? [s] : s.tasks.flatMap((c2) => c2.type === "test" ? [c2] : getTests(c2)));
|
|
119
|
-
}
|
|
120
|
-
function getTasks(tasks) {
|
|
121
|
-
return toArray(tasks).flatMap((s) => s.type === "test" ? [s] : [s, ...getTasks(s.tasks)]);
|
|
122
|
-
}
|
|
123
|
-
function getSuites(suite) {
|
|
124
|
-
return toArray(suite).flatMap((s) => s.type === "suite" ? [s, ...getSuites(s.tasks)] : []);
|
|
125
|
-
}
|
|
126
|
-
function hasTests(suite) {
|
|
127
|
-
return toArray(suite).some((s) => s.tasks.some((c2) => c2.type === "test" || hasTests(c2)));
|
|
128
|
-
}
|
|
129
|
-
function hasFailed(suite) {
|
|
130
|
-
return toArray(suite).some((s) => {
|
|
131
|
-
var _a;
|
|
132
|
-
return ((_a = s.result) == null ? void 0 : _a.state) === "fail" || s.type === "suite" && hasFailed(s.tasks);
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
function getNames(task) {
|
|
136
|
-
const names = [task.name];
|
|
137
|
-
let current = task;
|
|
138
|
-
while ((current == null ? void 0 : current.suite) || (current == null ? void 0 : current.file)) {
|
|
139
|
-
current = current.suite || current.file;
|
|
140
|
-
if (current == null ? void 0 : current.name)
|
|
141
|
-
names.unshift(current.name);
|
|
142
|
-
}
|
|
143
|
-
return names;
|
|
144
|
-
}
|
|
145
|
-
function getFullName(task) {
|
|
146
|
-
return getNames(task).join(c.dim(" > "));
|
|
147
|
-
}
|
|
148
|
-
async function ensurePackageInstalled(dependency, promptInstall = !process.env.CI && process.stdout.isTTY) {
|
|
149
|
-
if (isPackageExists(dependency))
|
|
150
|
-
return true;
|
|
151
|
-
console.log(c.red(`${c.inverse(c.red(" MISSING DEP "))} Can not find dependency '${dependency}'
|
|
152
|
-
`));
|
|
153
|
-
if (!promptInstall)
|
|
154
|
-
return false;
|
|
155
|
-
const prompts = await import('./index-fa899e66.js').then(function (n) { return n.i; });
|
|
156
|
-
const { install } = await prompts.prompt({
|
|
157
|
-
type: "confirm",
|
|
158
|
-
name: "install",
|
|
159
|
-
message: c.reset(`Do you want to install ${c.green(dependency)}?`)
|
|
160
|
-
});
|
|
161
|
-
if (install) {
|
|
162
|
-
await (await import('./index-9f4b9905.js')).installPackage(dependency, { dev: true });
|
|
163
|
-
return true;
|
|
164
|
-
}
|
|
165
|
-
return false;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export { getSuites as a, getTests as b, c, notNullish as d, ensurePackageInstalled as e, getNames as f, getFullName as g, hasFailed as h, interpretOnlyMode as i, hasTests as j, getTasks as k, mergeSlashes as m, noop as n, partitionSuiteChildren as p, slash as s, toArray as t };
|
package/dist/index-1488b423.js
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
|
|
3
|
-
function normalizeWindowsPath(input = "") {
|
|
4
|
-
if (!input.includes("\\")) {
|
|
5
|
-
return input;
|
|
6
|
-
}
|
|
7
|
-
return input.replace(/\\/g, "/");
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const _UNC_REGEX = /^[/][/]/;
|
|
11
|
-
const _UNC_DRIVE_REGEX = /^[/][/]([.]{1,2}[/])?([a-zA-Z]):[/]/;
|
|
12
|
-
const _IS_ABSOLUTE_RE = /^\/|^\\|^[a-zA-Z]:[/\\]/;
|
|
13
|
-
const sep = "/";
|
|
14
|
-
const delimiter = ":";
|
|
15
|
-
const normalize = function(path2) {
|
|
16
|
-
if (path2.length === 0) {
|
|
17
|
-
return ".";
|
|
18
|
-
}
|
|
19
|
-
path2 = normalizeWindowsPath(path2);
|
|
20
|
-
const isUNCPath = path2.match(_UNC_REGEX);
|
|
21
|
-
const hasUNCDrive = isUNCPath && path2.match(_UNC_DRIVE_REGEX);
|
|
22
|
-
const isPathAbsolute = isAbsolute(path2);
|
|
23
|
-
const trailingSeparator = path2[path2.length - 1] === "/";
|
|
24
|
-
path2 = normalizeString(path2, !isPathAbsolute);
|
|
25
|
-
if (path2.length === 0) {
|
|
26
|
-
if (isPathAbsolute) {
|
|
27
|
-
return "/";
|
|
28
|
-
}
|
|
29
|
-
return trailingSeparator ? "./" : ".";
|
|
30
|
-
}
|
|
31
|
-
if (trailingSeparator) {
|
|
32
|
-
path2 += "/";
|
|
33
|
-
}
|
|
34
|
-
if (isUNCPath) {
|
|
35
|
-
if (hasUNCDrive) {
|
|
36
|
-
return `//./${path2}`;
|
|
37
|
-
}
|
|
38
|
-
return `//${path2}`;
|
|
39
|
-
}
|
|
40
|
-
return isPathAbsolute && !isAbsolute(path2) ? `/${path2}` : path2;
|
|
41
|
-
};
|
|
42
|
-
const join = function(...args) {
|
|
43
|
-
if (args.length === 0) {
|
|
44
|
-
return ".";
|
|
45
|
-
}
|
|
46
|
-
let joined;
|
|
47
|
-
for (let i = 0; i < args.length; ++i) {
|
|
48
|
-
const arg = args[i];
|
|
49
|
-
if (arg.length > 0) {
|
|
50
|
-
if (joined === void 0) {
|
|
51
|
-
joined = arg;
|
|
52
|
-
} else {
|
|
53
|
-
joined += `/${arg}`;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
if (joined === void 0) {
|
|
58
|
-
return ".";
|
|
59
|
-
}
|
|
60
|
-
return normalize(joined);
|
|
61
|
-
};
|
|
62
|
-
const resolve = function(...args) {
|
|
63
|
-
args = args.map((arg) => normalizeWindowsPath(arg));
|
|
64
|
-
let resolvedPath = "";
|
|
65
|
-
let resolvedAbsolute = false;
|
|
66
|
-
for (let i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
67
|
-
const path2 = i >= 0 ? args[i] : process.cwd();
|
|
68
|
-
if (path2.length === 0) {
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
resolvedPath = `${path2}/${resolvedPath}`;
|
|
72
|
-
resolvedAbsolute = isAbsolute(path2);
|
|
73
|
-
}
|
|
74
|
-
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
75
|
-
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
|
|
76
|
-
return `/${resolvedPath}`;
|
|
77
|
-
}
|
|
78
|
-
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
79
|
-
};
|
|
80
|
-
function normalizeString(path2, allowAboveRoot) {
|
|
81
|
-
let res = "";
|
|
82
|
-
let lastSegmentLength = 0;
|
|
83
|
-
let lastSlash = -1;
|
|
84
|
-
let dots = 0;
|
|
85
|
-
let char = null;
|
|
86
|
-
for (let i = 0; i <= path2.length; ++i) {
|
|
87
|
-
if (i < path2.length) {
|
|
88
|
-
char = path2[i];
|
|
89
|
-
} else if (char === "/") {
|
|
90
|
-
break;
|
|
91
|
-
} else {
|
|
92
|
-
char = "/";
|
|
93
|
-
}
|
|
94
|
-
if (char === "/") {
|
|
95
|
-
if (lastSlash === i - 1 || dots === 1) ; else if (dots === 2) {
|
|
96
|
-
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
97
|
-
if (res.length > 2) {
|
|
98
|
-
const lastSlashIndex = res.lastIndexOf("/");
|
|
99
|
-
if (lastSlashIndex === -1) {
|
|
100
|
-
res = "";
|
|
101
|
-
lastSegmentLength = 0;
|
|
102
|
-
} else {
|
|
103
|
-
res = res.slice(0, lastSlashIndex);
|
|
104
|
-
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
105
|
-
}
|
|
106
|
-
lastSlash = i;
|
|
107
|
-
dots = 0;
|
|
108
|
-
continue;
|
|
109
|
-
} else if (res.length !== 0) {
|
|
110
|
-
res = "";
|
|
111
|
-
lastSegmentLength = 0;
|
|
112
|
-
lastSlash = i;
|
|
113
|
-
dots = 0;
|
|
114
|
-
continue;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
if (allowAboveRoot) {
|
|
118
|
-
res += res.length > 0 ? "/.." : "..";
|
|
119
|
-
lastSegmentLength = 2;
|
|
120
|
-
}
|
|
121
|
-
} else {
|
|
122
|
-
if (res.length > 0) {
|
|
123
|
-
res += `/${path2.slice(lastSlash + 1, i)}`;
|
|
124
|
-
} else {
|
|
125
|
-
res = path2.slice(lastSlash + 1, i);
|
|
126
|
-
}
|
|
127
|
-
lastSegmentLength = i - lastSlash - 1;
|
|
128
|
-
}
|
|
129
|
-
lastSlash = i;
|
|
130
|
-
dots = 0;
|
|
131
|
-
} else if (char === "." && dots !== -1) {
|
|
132
|
-
++dots;
|
|
133
|
-
} else {
|
|
134
|
-
dots = -1;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return res;
|
|
138
|
-
}
|
|
139
|
-
const isAbsolute = function(p) {
|
|
140
|
-
return _IS_ABSOLUTE_RE.test(p);
|
|
141
|
-
};
|
|
142
|
-
const toNamespacedPath = function(p) {
|
|
143
|
-
return normalizeWindowsPath(p);
|
|
144
|
-
};
|
|
145
|
-
const extname = function(p) {
|
|
146
|
-
return path.posix.extname(normalizeWindowsPath(p));
|
|
147
|
-
};
|
|
148
|
-
const relative = function(from, to) {
|
|
149
|
-
return path.posix.relative(normalizeWindowsPath(from), normalizeWindowsPath(to));
|
|
150
|
-
};
|
|
151
|
-
const dirname = function(p) {
|
|
152
|
-
return path.posix.dirname(normalizeWindowsPath(p));
|
|
153
|
-
};
|
|
154
|
-
const format = function(p) {
|
|
155
|
-
return normalizeWindowsPath(path.posix.format(p));
|
|
156
|
-
};
|
|
157
|
-
const basename = function(p, ext) {
|
|
158
|
-
return path.posix.basename(normalizeWindowsPath(p), ext);
|
|
159
|
-
};
|
|
160
|
-
const parse = function(p) {
|
|
161
|
-
return path.posix.parse(normalizeWindowsPath(p));
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
const _path = /*#__PURE__*/Object.freeze({
|
|
165
|
-
__proto__: null,
|
|
166
|
-
sep: sep,
|
|
167
|
-
delimiter: delimiter,
|
|
168
|
-
normalize: normalize,
|
|
169
|
-
join: join,
|
|
170
|
-
resolve: resolve,
|
|
171
|
-
normalizeString: normalizeString,
|
|
172
|
-
isAbsolute: isAbsolute,
|
|
173
|
-
toNamespacedPath: toNamespacedPath,
|
|
174
|
-
extname: extname,
|
|
175
|
-
relative: relative,
|
|
176
|
-
dirname: dirname,
|
|
177
|
-
format: format,
|
|
178
|
-
basename: basename,
|
|
179
|
-
parse: parse
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
const index = {
|
|
183
|
-
..._path
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
export { resolve as a, basename as b, index as c, dirname as d, isAbsolute as i, relative as r };
|