vitest 0.0.102 → 0.0.106
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 +73 -0
- package/dist/cli.js +11 -12
- package/dist/{constants-a1417084.js → constants-82dad049.js} +2 -2
- package/dist/entry.js +29 -5
- package/dist/{error-d97062cd.js → error-e81aa23d.js} +21 -32
- package/dist/{global-12f52a87.js → global-0f4da031.js} +5 -5
- package/dist/{index-0c3a317d.js → index-1ede1cc5.js} +6 -2
- package/dist/index-77f19d39.js +31 -0
- package/dist/{index-825cb54c.js → index-84978a77.js} +1 -1
- package/dist/{index-37755855.js → index-8cc284f9.js} +1147 -24
- package/dist/index.d.ts +74 -10
- package/dist/index.js +3 -3
- package/dist/{middleware-05e03d95.js → middleware-0c8d46aa.js} +4 -2
- package/dist/node.d.ts +21 -2
- package/dist/node.js +7 -6
- package/dist/{suite-64b3e636.js → suite-ff89a82e.js} +1 -1
- package/dist/utils-92ec89d1.js +814 -0
- package/dist/utils.js +3 -1
- package/dist/worker.js +113 -6
- package/package.json +8 -6
- package/dist/_commonjsHelpers-bdec4bbd.js +0 -7
- package/dist/index-a190f5a1.js +0 -352
- package/dist/utils-c8e62373.js +0 -346
package/LICENSE.md
CHANGED
|
@@ -1001,6 +1001,21 @@ Repository: sindresorhus/log-update
|
|
|
1001
1001
|
|
|
1002
1002
|
---------------------------------------
|
|
1003
1003
|
|
|
1004
|
+
## magic-string
|
|
1005
|
+
License: MIT
|
|
1006
|
+
By: Rich Harris
|
|
1007
|
+
Repository: https://github.com/rich-harris/magic-string
|
|
1008
|
+
|
|
1009
|
+
> Copyright 2018 Rich Harris
|
|
1010
|
+
>
|
|
1011
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
1012
|
+
>
|
|
1013
|
+
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
1014
|
+
>
|
|
1015
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1016
|
+
|
|
1017
|
+
---------------------------------------
|
|
1018
|
+
|
|
1004
1019
|
## merge-stream
|
|
1005
1020
|
License: MIT
|
|
1006
1021
|
By: Stephen Sugden
|
|
@@ -1132,6 +1147,35 @@ Repository: unjs/mlly
|
|
|
1132
1147
|
|
|
1133
1148
|
---------------------------------------
|
|
1134
1149
|
|
|
1150
|
+
## mockdate
|
|
1151
|
+
License: MIT
|
|
1152
|
+
By: Bob Lauer
|
|
1153
|
+
Repository: https://github.com/boblauer/MockDate.git
|
|
1154
|
+
|
|
1155
|
+
> The MIT License (MIT)
|
|
1156
|
+
>
|
|
1157
|
+
> Copyright (c) 2014 Bob Lauer
|
|
1158
|
+
>
|
|
1159
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1160
|
+
> of this software and associated documentation files (the "Software"), to deal
|
|
1161
|
+
> in the Software without restriction, including without limitation the rights
|
|
1162
|
+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1163
|
+
> copies of the Software, and to permit persons to whom the Software is
|
|
1164
|
+
> furnished to do so, subject to the following conditions:
|
|
1165
|
+
>
|
|
1166
|
+
> The above copyright notice and this permission notice shall be included in all
|
|
1167
|
+
> copies or substantial portions of the Software.
|
|
1168
|
+
>
|
|
1169
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1170
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1171
|
+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1172
|
+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1173
|
+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1174
|
+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1175
|
+
> SOFTWARE.
|
|
1176
|
+
|
|
1177
|
+
---------------------------------------
|
|
1178
|
+
|
|
1135
1179
|
## nanoid
|
|
1136
1180
|
License: MIT
|
|
1137
1181
|
By: Andrey Sitnik
|
|
@@ -1699,6 +1743,35 @@ Repository: 7rulnik/source-map
|
|
|
1699
1743
|
|
|
1700
1744
|
---------------------------------------
|
|
1701
1745
|
|
|
1746
|
+
## sourcemap-codec
|
|
1747
|
+
License: MIT
|
|
1748
|
+
By: Rich Harris
|
|
1749
|
+
Repository: https://github.com/Rich-Harris/sourcemap-codec
|
|
1750
|
+
|
|
1751
|
+
> The MIT License
|
|
1752
|
+
>
|
|
1753
|
+
> Copyright (c) 2015 Rich Harris
|
|
1754
|
+
>
|
|
1755
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1756
|
+
> of this software and associated documentation files (the "Software"), to deal
|
|
1757
|
+
> in the Software without restriction, including without limitation the rights
|
|
1758
|
+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1759
|
+
> copies of the Software, and to permit persons to whom the Software is
|
|
1760
|
+
> furnished to do so, subject to the following conditions:
|
|
1761
|
+
>
|
|
1762
|
+
> The above copyright notice and this permission notice shall be included in
|
|
1763
|
+
> all copies or substantial portions of the Software.
|
|
1764
|
+
>
|
|
1765
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1766
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1767
|
+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1768
|
+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1769
|
+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1770
|
+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
1771
|
+
> THE SOFTWARE.
|
|
1772
|
+
|
|
1773
|
+
---------------------------------------
|
|
1774
|
+
|
|
1702
1775
|
## string-width
|
|
1703
1776
|
License: MIT
|
|
1704
1777
|
By: Sindre Sorhus
|
package/dist/cli.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import require$$0 from 'readline';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
-
import { e as ensurePackageInstalled } from './utils-
|
|
4
|
-
import { c as createVitest } from './index-
|
|
3
|
+
import { e as ensurePackageInstalled } from './utils-92ec89d1.js';
|
|
4
|
+
import { c as createVitest } from './index-8cc284f9.js';
|
|
5
5
|
import 'tty';
|
|
6
6
|
import 'local-pkg';
|
|
7
7
|
import 'path';
|
|
8
|
+
import 'chai';
|
|
9
|
+
import 'tinyspy';
|
|
8
10
|
import 'vite';
|
|
9
11
|
import 'process';
|
|
10
12
|
import 'fs';
|
|
11
13
|
import 'os';
|
|
12
14
|
import 'util';
|
|
13
15
|
import 'stream';
|
|
14
|
-
import './constants-
|
|
16
|
+
import './constants-82dad049.js';
|
|
15
17
|
import 'url';
|
|
16
18
|
import 'perf_hooks';
|
|
17
|
-
import './error-
|
|
18
|
-
import './index-
|
|
19
|
-
import './_commonjsHelpers-bdec4bbd.js';
|
|
19
|
+
import './error-e81aa23d.js';
|
|
20
|
+
import './index-84978a77.js';
|
|
20
21
|
import 'assert';
|
|
21
22
|
import 'worker_threads';
|
|
22
23
|
import 'tinypool';
|
|
@@ -634,12 +635,10 @@ class CAC extends EventEmitter {
|
|
|
634
635
|
|
|
635
636
|
const cac = (name = "") => new CAC(name);
|
|
636
637
|
|
|
637
|
-
var version = "0.0.
|
|
638
|
+
var version = "0.0.106";
|
|
638
639
|
|
|
639
640
|
const cli = cac("vitest");
|
|
640
|
-
cli.version(version).option("-r, --root <path>", "root path").option("-c, --config <path>", "path to config file").option("-u, --update", "update snapshot").option("-w, --watch", "watch mode").option("-o, --open", "open Vitest UI").option("--api", "listen to port and serve API").option("--threads", "enabled threads", { default: true }).option("--silent", "silent").option("--run", "do not watch").option("--global", "inject apis globally").option("--dom", "mock browser api with happy-dom").option("--environment <env>", "runner environment", {
|
|
641
|
-
default: "node"
|
|
642
|
-
}).help();
|
|
641
|
+
cli.version(version).option("-r, --root <path>", "root path").option("-c, --config <path>", "path to config file").option("-u, --update", "update snapshot").option("-w, --watch", "watch mode").option("-o, --open", "open Vitest UI").option("--api", "listen to port and serve API").option("--threads", "enabled threads", { default: true }).option("--silent", "silent").option("--run", "do not watch").option("--global", "inject apis globally").option("--dom", "mock browser api with happy-dom").option("--environment <env>", "runner environment", { default: "node" }).option("--passWithNoTests", "pass when no tests found").help();
|
|
643
642
|
cli.command("run [...filters]").action(run);
|
|
644
643
|
cli.command("watch [...filters]").action(dev);
|
|
645
644
|
cli.command("dev [...filters]").action(dev);
|
|
@@ -679,8 +678,8 @@ function registerConsoleShortcuts(ctx) {
|
|
|
679
678
|
if (process.stdin.isTTY) {
|
|
680
679
|
require$$0.emitKeypressEvents(process.stdin);
|
|
681
680
|
process.stdin.setRawMode(true);
|
|
682
|
-
process.stdin.on("keypress", (str) => {
|
|
683
|
-
if (str === "" || str === "")
|
|
681
|
+
process.stdin.on("keypress", (str, key) => {
|
|
682
|
+
if (str === "" || str === "" || key && key.ctrl && key.name === "c")
|
|
684
683
|
process.exit();
|
|
685
684
|
if (ctx.runningPromise)
|
|
686
685
|
return;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { fileURLToPath } from 'url';
|
|
2
|
-
import {
|
|
2
|
+
import { m as resolve } from './utils-92ec89d1.js';
|
|
3
3
|
|
|
4
4
|
const distDir = resolve(fileURLToPath(import.meta.url), "../../dist");
|
|
5
5
|
const defaultInclude = ["**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"];
|
|
6
|
-
const defaultExclude = ["node_modules", "dist", "
|
|
6
|
+
const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/.{idea,git,cache,output,temp}/**"];
|
|
7
7
|
const defaultPort = 51204;
|
|
8
8
|
const API_PATH = "/__vitest_api__";
|
|
9
9
|
const configFiles = [
|
package/dist/entry.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import fs, { promises } from 'fs';
|
|
2
|
+
import { w as commonjsRequire, q as commonjsGlobal, x as index, g as getNames, c as c$1, t as toArray, k as basename, y as interpretOnlyMode, z as partitionSuiteChildren, A as hasTests, o as hasFailed, B as clearModuleMocks, b as vi } from './utils-92ec89d1.js';
|
|
2
3
|
import { Console } from 'console';
|
|
3
4
|
import { Writable } from 'stream';
|
|
4
5
|
import { importModule } from 'local-pkg';
|
|
5
6
|
import chai$1, { expect, util } from 'chai';
|
|
6
|
-
import { a as commonjsRequire, c as commonjsGlobal } from './_commonjsHelpers-bdec4bbd.js';
|
|
7
|
-
import { l as index, g as getNames, c as c$1, t as toArray, b as basename, m as interpretOnlyMode, p as partitionSuiteChildren, o as hasTests, j as hasFailed } from './utils-c8e62373.js';
|
|
8
7
|
import { r as rpc, s as send } from './rpc-7de86f29.js';
|
|
9
|
-
import { u as unifiedDiff } from './error-
|
|
8
|
+
import { u as unifiedDiff } from './error-e81aa23d.js';
|
|
10
9
|
import { performance } from 'perf_hooks';
|
|
11
|
-
import { c as clearContext, b as defaultSuite, e as setHooks, f as getHooks, h as context, j as getFn } from './suite-
|
|
10
|
+
import { c as clearContext, b as defaultSuite, e as setHooks, f as getHooks, h as context, j as getFn } from './suite-ff89a82e.js';
|
|
12
11
|
import { n as nanoid } from './index-9e71c815.js';
|
|
13
12
|
import { format as format$1 } from 'util';
|
|
14
13
|
import 'tty';
|
|
15
14
|
import 'path';
|
|
15
|
+
import 'tinyspy';
|
|
16
16
|
|
|
17
17
|
var node = {
|
|
18
18
|
name: "node",
|
|
@@ -3851,6 +3851,23 @@ class Any extends AsymmetricMatcher {
|
|
|
3851
3851
|
return `Any<${this.fnNameFor(this.sample)}>`;
|
|
3852
3852
|
}
|
|
3853
3853
|
}
|
|
3854
|
+
class StringMatching extends AsymmetricMatcher {
|
|
3855
|
+
constructor(sample, inverse = false) {
|
|
3856
|
+
if (!isA("String", sample) && !isA("RegExp", sample))
|
|
3857
|
+
throw new Error("Expected is not a String or a RegExp");
|
|
3858
|
+
super(new RegExp(sample), inverse);
|
|
3859
|
+
}
|
|
3860
|
+
asymmetricMatch(other) {
|
|
3861
|
+
const result = isA("String", other) && this.sample.test(other);
|
|
3862
|
+
return this.inverse ? !result : result;
|
|
3863
|
+
}
|
|
3864
|
+
toString() {
|
|
3865
|
+
return `String${this.inverse ? "Not" : ""}Matching`;
|
|
3866
|
+
}
|
|
3867
|
+
getExpectedType() {
|
|
3868
|
+
return "string";
|
|
3869
|
+
}
|
|
3870
|
+
}
|
|
3854
3871
|
const JestAsymmetricMatchers = (chai, utils) => {
|
|
3855
3872
|
utils.addMethod(chai.expect, "stringContaining", (expected) => new StringContaining(expected));
|
|
3856
3873
|
utils.addMethod(chai.expect, "anything", () => {
|
|
@@ -3865,6 +3882,9 @@ const JestAsymmetricMatchers = (chai, utils) => {
|
|
|
3865
3882
|
utils.addMethod(chai.expect, "arrayContaining", (expected) => {
|
|
3866
3883
|
return new ArrayContaining(expected);
|
|
3867
3884
|
});
|
|
3885
|
+
utils.addMethod(chai.expect, "stringMatching", (expected) => {
|
|
3886
|
+
return new StringMatching(expected);
|
|
3887
|
+
});
|
|
3868
3888
|
};
|
|
3869
3889
|
|
|
3870
3890
|
let installed = false;
|
|
@@ -3887,7 +3907,7 @@ async function setupGlobalEnv(config) {
|
|
|
3887
3907
|
setupConsoleLogSpy();
|
|
3888
3908
|
await setupChai();
|
|
3889
3909
|
if (config.global)
|
|
3890
|
-
(await import('./global-
|
|
3910
|
+
(await import('./global-0f4da031.js')).registerApiGlobally();
|
|
3891
3911
|
}
|
|
3892
3912
|
function setupConsoleLogSpy() {
|
|
3893
3913
|
const stdout = new Writable({
|
|
@@ -4026,6 +4046,7 @@ async function runTest(test) {
|
|
|
4026
4046
|
state: "run"
|
|
4027
4047
|
};
|
|
4028
4048
|
updateTask(test);
|
|
4049
|
+
clearModuleMocks();
|
|
4029
4050
|
getSnapshotClient().setTest(test);
|
|
4030
4051
|
process.__vitest_worker__.current = test;
|
|
4031
4052
|
try {
|
|
@@ -4123,9 +4144,12 @@ async function run(files, config) {
|
|
|
4123
4144
|
const env = ((_a = code.match(/@(?:vitest|jest)-environment\s+?([\w-]+)\b/)) == null ? void 0 : _a[1]) || config.environment || "node";
|
|
4124
4145
|
if (!["node", "jsdom", "happy-dom"].includes(env))
|
|
4125
4146
|
throw new Error(`Unsupported environment: ${env}`);
|
|
4147
|
+
process.__vitest_worker__.filepath = file;
|
|
4148
|
+
vi.restoreAllMocks();
|
|
4126
4149
|
await withEnv(env, async () => {
|
|
4127
4150
|
await startTests([file], config);
|
|
4128
4151
|
});
|
|
4152
|
+
process.__vitest_worker__.filepath = void 0;
|
|
4129
4153
|
}
|
|
4130
4154
|
}
|
|
4131
4155
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync, promises } from 'fs';
|
|
2
2
|
import { format } from 'util';
|
|
3
|
-
import {
|
|
3
|
+
import { p as notNullish, c, r as relative } from './utils-92ec89d1.js';
|
|
4
4
|
|
|
5
5
|
function Diff() {}
|
|
6
6
|
Diff.prototype = {
|
|
@@ -4564,7 +4564,7 @@ async function getSourcePos(ctx, nearest) {
|
|
|
4564
4564
|
return pos;
|
|
4565
4565
|
}
|
|
4566
4566
|
function displayDiff(actual, expected) {
|
|
4567
|
-
console.error(c.gray(unifiedDiff(
|
|
4567
|
+
console.error(c.gray(unifiedDiff(format(actual), format(expected))) + "\n");
|
|
4568
4568
|
}
|
|
4569
4569
|
function printErrorMessage(error) {
|
|
4570
4570
|
const errorName = error.name || error.nameStr || "Unknown Error";
|
|
@@ -4615,6 +4615,7 @@ function generateCodeFrame(source, indent = 0, start = 0, end, range = 2) {
|
|
|
4615
4615
|
const lines = source.split(splitRE);
|
|
4616
4616
|
let count = 0;
|
|
4617
4617
|
let res = [];
|
|
4618
|
+
const columns = process.stdout.columns || 80;
|
|
4618
4619
|
function lineNo(no = "") {
|
|
4619
4620
|
return c.gray(`${String(no).padStart(3, " ")}| `);
|
|
4620
4621
|
}
|
|
@@ -4627,7 +4628,7 @@ function generateCodeFrame(source, indent = 0, start = 0, end, range = 2) {
|
|
|
4627
4628
|
const lineLength = lines[j].length;
|
|
4628
4629
|
if (lineLength > 200)
|
|
4629
4630
|
return "";
|
|
4630
|
-
res.push(lineNo(j + 1) + cliTruncate(lines[j],
|
|
4631
|
+
res.push(lineNo(j + 1) + cliTruncate(lines[j], columns - 5 - indent));
|
|
4631
4632
|
if (j === i) {
|
|
4632
4633
|
const pad = start - (count - lineLength);
|
|
4633
4634
|
const length = Math.max(1, end > count ? lineLength - pad : end - start);
|
|
@@ -4647,9 +4648,6 @@ function generateCodeFrame(source, indent = 0, start = 0, end, range = 2) {
|
|
|
4647
4648
|
res = res.map((line) => " ".repeat(indent) + line);
|
|
4648
4649
|
return res.join("\n");
|
|
4649
4650
|
}
|
|
4650
|
-
function stringify(obj) {
|
|
4651
|
-
return format(obj);
|
|
4652
|
-
}
|
|
4653
4651
|
const stackFnCallRE = /at (.*) \((.+):(\d+):(\d+)\)$/;
|
|
4654
4652
|
const stackBarePathRE = /at ?(.*) (.+):(\d+):(\d+)$/;
|
|
4655
4653
|
function parseStack(stack) {
|
|
@@ -4679,59 +4677,50 @@ function unifiedDiff(actual, expected) {
|
|
|
4679
4677
|
let expectedLinesCount = 0;
|
|
4680
4678
|
let actualLinesCount = 0;
|
|
4681
4679
|
function preprocess(line) {
|
|
4680
|
+
if (!line)
|
|
4681
|
+
return;
|
|
4682
4682
|
if (line[0] === "+") {
|
|
4683
4683
|
if (expectedLinesCount >= diffLimit)
|
|
4684
4684
|
return;
|
|
4685
4685
|
expectedLinesCount++;
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
line = line[0] + " " + line.slice(1);
|
|
4690
|
-
const isLastLine = expectedLinesCount === diffLimit;
|
|
4691
|
-
return indent + c.red(`${formatLine(line)} ${isLastLine ? renderTruncateMessage(indent) : ""}`);
|
|
4692
|
-
};
|
|
4686
|
+
line = line[0] + " " + line.slice(1);
|
|
4687
|
+
const isLastLine = expectedLinesCount === diffLimit;
|
|
4688
|
+
return indent + c.red(`${formatLine(line)} ${isLastLine ? renderTruncateMessage(indent) : ""}`);
|
|
4693
4689
|
}
|
|
4694
4690
|
if (line[0] === "-") {
|
|
4695
4691
|
if (actualLinesCount >= diffLimit)
|
|
4696
4692
|
return;
|
|
4697
4693
|
actualLinesCount++;
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
line = line[0] + " " + line.slice(1);
|
|
4702
|
-
const isLastLine = actualLinesCount === diffLimit;
|
|
4703
|
-
return indent + c.green(`${formatLine(line)} ${isLastLine ? renderTruncateMessage(indent) : ""}`);
|
|
4704
|
-
};
|
|
4694
|
+
line = line[0] + " " + line.slice(1);
|
|
4695
|
+
const isLastLine = actualLinesCount === diffLimit;
|
|
4696
|
+
return indent + c.green(`${formatLine(line)} ${isLastLine ? renderTruncateMessage(indent) : ""}`);
|
|
4705
4697
|
}
|
|
4706
4698
|
if (line.match(/@@/))
|
|
4707
|
-
return
|
|
4699
|
+
return "--";
|
|
4708
4700
|
if (line.match(/\\ No newline/))
|
|
4709
4701
|
return null;
|
|
4710
|
-
return
|
|
4702
|
+
return indent + " " + line;
|
|
4711
4703
|
}
|
|
4712
4704
|
const msg = createPatch("string", actual, expected);
|
|
4713
|
-
const lines = msg.split("\n").
|
|
4714
|
-
const cleanLines = lines.map(preprocess).filter(
|
|
4715
|
-
if (expectedLinesCount === 1 && actualLinesCount === 1) {
|
|
4705
|
+
const lines = msg.split("\n").slice(5);
|
|
4706
|
+
const cleanLines = lines.map(preprocess).filter(Boolean);
|
|
4707
|
+
if (expectedLinesCount === 1 && actualLinesCount === 1 && lines.length === 2) {
|
|
4716
4708
|
return `
|
|
4717
|
-
${indent}${c.green("- expected")} ${cleanLines[0]
|
|
4718
|
-
${indent}${c.red("+ actual")} ${cleanLines[1]
|
|
4709
|
+
${indent}${c.green("- expected")} ${cleanLines[0]}
|
|
4710
|
+
${indent}${c.red("+ actual")} ${cleanLines[1]}`;
|
|
4719
4711
|
}
|
|
4720
4712
|
return `
|
|
4721
4713
|
${indent}${c.green("- expected")}
|
|
4722
4714
|
${indent}${c.red("+ actual")}
|
|
4723
4715
|
|
|
4724
|
-
${cleanLines.
|
|
4716
|
+
${cleanLines.join("\n")}`;
|
|
4725
4717
|
}
|
|
4726
4718
|
function formatLine(line) {
|
|
4727
|
-
return cliTruncate(line, (process.stdout.columns ||
|
|
4719
|
+
return cliTruncate(line, (process.stdout.columns || 80) - 1);
|
|
4728
4720
|
}
|
|
4729
4721
|
function renderTruncateMessage(indent) {
|
|
4730
4722
|
return `
|
|
4731
4723
|
${indent}${c.dim("[...truncated]")}`;
|
|
4732
4724
|
}
|
|
4733
|
-
function notBlank(line) {
|
|
4734
|
-
return typeof line !== "undefined" && line !== null;
|
|
4735
|
-
}
|
|
4736
4725
|
|
|
4737
4726
|
export { F_POINTER as F, ansiStyles as a, stripAnsi as b, sliceAnsi as c, F_DOWN as d, F_LONG_DASH as e, F_DOWN_RIGHT as f, F_DOT as g, F_CHECK as h, F_CROSS as i, cliTruncate as j, F_RIGHT as k, printError as p, stringWidth as s, unifiedDiff as u };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { g as globalApis } from './constants-
|
|
2
|
-
import { i as index } from './index-
|
|
1
|
+
import { g as globalApis } from './constants-82dad049.js';
|
|
2
|
+
import { i as index } from './index-77f19d39.js';
|
|
3
3
|
import 'url';
|
|
4
|
-
import './utils-
|
|
4
|
+
import './utils-92ec89d1.js';
|
|
5
5
|
import 'tty';
|
|
6
6
|
import 'local-pkg';
|
|
7
7
|
import 'path';
|
|
8
|
-
import './suite-64b3e636.js';
|
|
9
|
-
import './index-9e71c815.js';
|
|
10
8
|
import 'chai';
|
|
11
9
|
import 'tinyspy';
|
|
10
|
+
import './suite-ff89a82e.js';
|
|
11
|
+
import './index-9e71c815.js';
|
|
12
12
|
|
|
13
13
|
function registerApiGlobally() {
|
|
14
14
|
globalApis.forEach((api) => {
|
|
@@ -2,11 +2,15 @@ import path$5 from 'path';
|
|
|
2
2
|
import fs$5 from 'fs';
|
|
3
3
|
import require$$0 from 'util';
|
|
4
4
|
import require$$0$1 from 'child_process';
|
|
5
|
-
import {
|
|
6
|
-
import { a as signalExit, b as onetime$1 } from './index-
|
|
5
|
+
import { q as commonjsGlobal } from './utils-92ec89d1.js';
|
|
6
|
+
import { a as signalExit, b as onetime$1 } from './index-84978a77.js';
|
|
7
7
|
import require$$0$2 from 'os';
|
|
8
8
|
import require$$0$4 from 'buffer';
|
|
9
9
|
import require$$0$3 from 'stream';
|
|
10
|
+
import 'tty';
|
|
11
|
+
import 'local-pkg';
|
|
12
|
+
import 'chai';
|
|
13
|
+
import 'tinyspy';
|
|
10
14
|
import 'assert';
|
|
11
15
|
import 'events';
|
|
12
16
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, s as suite, t as test, d as describe, i as it } from './suite-ff89a82e.js';
|
|
2
|
+
import chai, { assert, should, expect } from 'chai';
|
|
3
|
+
import { s as spies, a as spyOn, f as fn, v as vitest, b as vi } from './utils-92ec89d1.js';
|
|
4
|
+
|
|
5
|
+
const beforeAll = (fn, timeout) => getCurrentSuite().on("beforeAll", withTimeout(fn, timeout ?? getDefaultHookTimeout()));
|
|
6
|
+
const afterAll = (fn, timeout) => getCurrentSuite().on("afterAll", withTimeout(fn, timeout ?? getDefaultHookTimeout()));
|
|
7
|
+
const beforeEach = (fn, timeout) => getCurrentSuite().on("beforeEach", withTimeout(fn, timeout ?? getDefaultHookTimeout()));
|
|
8
|
+
const afterEach = (fn, timeout) => getCurrentSuite().on("afterEach", withTimeout(fn, timeout ?? getDefaultHookTimeout()));
|
|
9
|
+
|
|
10
|
+
var index = /*#__PURE__*/Object.freeze({
|
|
11
|
+
__proto__: null,
|
|
12
|
+
suite: suite,
|
|
13
|
+
test: test,
|
|
14
|
+
describe: describe,
|
|
15
|
+
it: it,
|
|
16
|
+
beforeAll: beforeAll,
|
|
17
|
+
afterAll: afterAll,
|
|
18
|
+
beforeEach: beforeEach,
|
|
19
|
+
afterEach: afterEach,
|
|
20
|
+
assert: assert,
|
|
21
|
+
should: should,
|
|
22
|
+
expect: expect,
|
|
23
|
+
chai: chai,
|
|
24
|
+
spies: spies,
|
|
25
|
+
spyOn: spyOn,
|
|
26
|
+
fn: fn,
|
|
27
|
+
vitest: vitest,
|
|
28
|
+
vi: vi
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export { afterAll as a, beforeAll as b, beforeEach as c, afterEach as d, index as i };
|