vitest 0.0.104 → 0.0.105
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 +29 -0
- package/dist/cli.js +6 -7
- package/dist/{constants-c4dc2ff5.js → constants-9320a46c.js} +1 -1
- package/dist/entry.js +4 -5
- package/dist/{error-796962c6.js → error-4e165107.js} +1 -1
- package/dist/{global-166f6789.js → global-a3634033.js} +4 -4
- package/dist/{index-40564dba.js → index-1da01554.js} +7 -5
- package/dist/{index-825cb54c.js → index-4cf13e25.js} +1 -1
- package/dist/{index-0c3a317d.js → index-5d224425.js} +6 -2
- package/dist/{index-145f6f09.js → index-a76b4291.js} +2 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -3
- package/dist/{middleware-0627688d.js → middleware-c66abe08.js} +2 -2
- package/dist/node.js +5 -6
- package/dist/{suite-8d666d5a.js → suite-101bab76.js} +1 -1
- package/dist/{utils-49e5008c.js → utils-5307e690.js} +132 -2
- package/dist/utils.js +1 -1
- package/dist/worker.js +2 -2
- package/package.json +6 -5
- package/dist/_commonjsHelpers-bdec4bbd.js +0 -7
package/LICENSE.md
CHANGED
|
@@ -1147,6 +1147,35 @@ Repository: unjs/mlly
|
|
|
1147
1147
|
|
|
1148
1148
|
---------------------------------------
|
|
1149
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
|
+
|
|
1150
1179
|
## nanoid
|
|
1151
1180
|
License: MIT
|
|
1152
1181
|
By: Andrey Sitnik
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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-5307e690.js';
|
|
4
|
+
import { c as createVitest } from './index-1da01554.js';
|
|
5
5
|
import 'tty';
|
|
6
6
|
import 'local-pkg';
|
|
7
7
|
import 'path';
|
|
@@ -13,12 +13,11 @@ import 'fs';
|
|
|
13
13
|
import 'os';
|
|
14
14
|
import 'util';
|
|
15
15
|
import 'stream';
|
|
16
|
-
import './constants-
|
|
16
|
+
import './constants-9320a46c.js';
|
|
17
17
|
import 'url';
|
|
18
18
|
import 'perf_hooks';
|
|
19
|
-
import './error-
|
|
20
|
-
import './index-
|
|
21
|
-
import './_commonjsHelpers-bdec4bbd.js';
|
|
19
|
+
import './error-4e165107.js';
|
|
20
|
+
import './index-4cf13e25.js';
|
|
22
21
|
import 'assert';
|
|
23
22
|
import 'worker_threads';
|
|
24
23
|
import 'tinypool';
|
|
@@ -636,7 +635,7 @@ class CAC extends EventEmitter {
|
|
|
636
635
|
|
|
637
636
|
const cac = (name = "") => new CAC(name);
|
|
638
637
|
|
|
639
|
-
var version = "0.0.
|
|
638
|
+
var version = "0.0.105";
|
|
640
639
|
|
|
641
640
|
const cli = cac("vitest");
|
|
642
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();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fileURLToPath } from 'url';
|
|
2
|
-
import { m as resolve } from './utils-
|
|
2
|
+
import { m as resolve } from './utils-5307e690.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}"];
|
package/dist/entry.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import fs, { promises } from 'fs';
|
|
2
|
-
import {
|
|
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-5307e690.js';
|
|
3
3
|
import { Console } from 'console';
|
|
4
4
|
import { Writable } from 'stream';
|
|
5
5
|
import { importModule } from 'local-pkg';
|
|
6
6
|
import chai$1, { expect, util } from 'chai';
|
|
7
|
-
import { a as commonjsRequire, c as commonjsGlobal } from './_commonjsHelpers-bdec4bbd.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-4e165107.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-101bab76.js';
|
|
12
11
|
import { n as nanoid } from './index-9e71c815.js';
|
|
13
12
|
import { format as format$1 } from 'util';
|
|
14
13
|
import 'tty';
|
|
@@ -3908,7 +3907,7 @@ async function setupGlobalEnv(config) {
|
|
|
3908
3907
|
setupConsoleLogSpy();
|
|
3909
3908
|
await setupChai();
|
|
3910
3909
|
if (config.global)
|
|
3911
|
-
(await import('./global-
|
|
3910
|
+
(await import('./global-a3634033.js')).registerApiGlobally();
|
|
3912
3911
|
}
|
|
3913
3912
|
function setupConsoleLogSpy() {
|
|
3914
3913
|
const stdout = new Writable({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync, promises } from 'fs';
|
|
2
2
|
import { format } from 'util';
|
|
3
|
-
import { p as notNullish, c, r as relative } from './utils-
|
|
3
|
+
import { p as notNullish, c, r as relative } from './utils-5307e690.js';
|
|
4
4
|
|
|
5
5
|
function Diff() {}
|
|
6
6
|
Diff.prototype = {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { g as globalApis } from './constants-
|
|
2
|
-
import { i as index } from './index-
|
|
1
|
+
import { g as globalApis } from './constants-9320a46c.js';
|
|
2
|
+
import { i as index } from './index-a76b4291.js';
|
|
3
3
|
import 'url';
|
|
4
|
-
import './utils-
|
|
4
|
+
import './utils-5307e690.js';
|
|
5
5
|
import 'tty';
|
|
6
6
|
import 'local-pkg';
|
|
7
7
|
import 'path';
|
|
8
8
|
import 'chai';
|
|
9
9
|
import 'tinyspy';
|
|
10
|
-
import './suite-
|
|
10
|
+
import './suite-101bab76.js';
|
|
11
11
|
import './index-9e71c815.js';
|
|
12
12
|
|
|
13
13
|
function registerApiGlobally() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c, g as getNames, d as slash$1, h as getTests, i as isAbsolute, r as relative, j as dirname, k as basename, l as getSuites, m as resolve, n as noop$1, t as toArray, o as hasFailed } from './utils-
|
|
1
|
+
import { c, g as getNames, d as slash$1, h as getTests, i as isAbsolute, r as relative, j as dirname, k as basename, l as getSuites, m as resolve, n as noop$1, t as toArray, o as hasFailed } from './utils-5307e690.js';
|
|
2
2
|
import { createServer, mergeConfig } from 'vite';
|
|
3
3
|
import path$a from 'path';
|
|
4
4
|
import process$1 from 'process';
|
|
@@ -7,10 +7,10 @@ import require$$0 from 'os';
|
|
|
7
7
|
import require$$0$1 from 'util';
|
|
8
8
|
import require$$0$2 from 'stream';
|
|
9
9
|
import require$$2 from 'events';
|
|
10
|
-
import { d as defaultInclude, a as defaultExclude, b as defaultPort, c as distDir, e as configFiles } from './constants-
|
|
10
|
+
import { d as defaultInclude, a as defaultExclude, b as defaultPort, c as distDir, e as configFiles } from './constants-9320a46c.js';
|
|
11
11
|
import { performance } from 'perf_hooks';
|
|
12
|
-
import { s as stringWidth, a as ansiStyles, b as stripAnsi, c as sliceAnsi, F as F_POINTER, d as F_DOWN, e as F_LONG_DASH, f as F_DOWN_RIGHT, g as F_DOT, h as F_CHECK, i as F_CROSS, j as cliTruncate, k as F_RIGHT, p as printError } from './error-
|
|
13
|
-
import { o as onetime, s as signalExit } from './index-
|
|
12
|
+
import { s as stringWidth, a as ansiStyles, b as stripAnsi, c as sliceAnsi, F as F_POINTER, d as F_DOWN, e as F_LONG_DASH, f as F_DOWN_RIGHT, g as F_DOT, h as F_CHECK, i as F_CROSS, j as cliTruncate, k as F_RIGHT, p as printError } from './error-4e165107.js';
|
|
13
|
+
import { o as onetime, s as signalExit } from './index-4cf13e25.js';
|
|
14
14
|
import { MessageChannel } from 'worker_threads';
|
|
15
15
|
import { pathToFileURL } from 'url';
|
|
16
16
|
import { Tinypool } from 'tinypool';
|
|
@@ -8840,6 +8840,8 @@ function createFakePool(ctx) {
|
|
|
8840
8840
|
function createWorkerPool(ctx) {
|
|
8841
8841
|
const options = {
|
|
8842
8842
|
filename: workerPath,
|
|
8843
|
+
isolateWorkers: true,
|
|
8844
|
+
concurrentTasksPerWorker: 1,
|
|
8843
8845
|
useAtomics: false
|
|
8844
8846
|
};
|
|
8845
8847
|
if (ctx.config.maxThreads != null)
|
|
@@ -9111,7 +9113,7 @@ async function createVitest(options, viteOverrides = {}) {
|
|
|
9111
9113
|
ctx.setServer(options, server2);
|
|
9112
9114
|
haveStarted = true;
|
|
9113
9115
|
if (options.api)
|
|
9114
|
-
server2.middlewares.use((await import('./middleware-
|
|
9116
|
+
server2.middlewares.use((await import('./middleware-c66abe08.js')).default(ctx));
|
|
9115
9117
|
}
|
|
9116
9118
|
},
|
|
9117
9119
|
MocksPlugin()
|
|
@@ -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-5307e690.js';
|
|
6
|
+
import { a as signalExit, b as onetime$1 } from './index-4cf13e25.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
|
|
|
@@ -1,6 +1,6 @@
|
|
|
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-
|
|
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-101bab76.js';
|
|
2
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-
|
|
3
|
+
import { s as spies, a as spyOn, f as fn, v as vitest, b as vi } from './utils-5307e690.js';
|
|
4
4
|
|
|
5
5
|
const beforeAll = (fn, timeout) => getCurrentSuite().on("beforeAll", withTimeout(fn, timeout ?? getDefaultHookTimeout()));
|
|
6
6
|
const afterAll = (fn, timeout) => getCurrentSuite().on("afterAll", withTimeout(fn, timeout ?? getDefaultHookTimeout()));
|
package/dist/index.d.ts
CHANGED
|
@@ -605,6 +605,7 @@ declare function fn<TArgs extends any[] = any[], R = any>(implementation: (...ar
|
|
|
605
605
|
|
|
606
606
|
declare class VitestUtils {
|
|
607
607
|
private _timers;
|
|
608
|
+
private _systemDate;
|
|
608
609
|
constructor();
|
|
609
610
|
useFakeTimers(): void;
|
|
610
611
|
useRealTimers(): void;
|
|
@@ -613,6 +614,9 @@ declare class VitestUtils {
|
|
|
613
614
|
advanceTimersByTime(ms: number): void | Promise<void>;
|
|
614
615
|
advanceTimersToNextTimer(): void | Promise<void>;
|
|
615
616
|
getTimerCount(): number;
|
|
617
|
+
setSystemDate(date: string | number | Date): void;
|
|
618
|
+
resetSystemDate(): void;
|
|
619
|
+
getSystemDate(): string | number | Date;
|
|
616
620
|
spyOn: typeof spyOn;
|
|
617
621
|
fn: typeof fn;
|
|
618
622
|
mock(path: string): void;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { d as describe, i as it, s as suite, t as test } from './suite-
|
|
2
|
-
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach } from './index-
|
|
1
|
+
export { d as describe, i as it, s as suite, t as test } from './suite-101bab76.js';
|
|
2
|
+
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach } from './index-a76b4291.js';
|
|
3
3
|
export { assert, default as chai, expect, should } from 'chai';
|
|
4
|
-
export { f as fn, s as spies, a as spyOn, b as vi, v as vitest } from './utils-
|
|
4
|
+
export { f as fn, s as spies, a as spyOn, b as vi, v as vitest } from './utils-5307e690.js';
|
|
5
5
|
import './index-9e71c815.js';
|
|
6
6
|
import 'tty';
|
|
7
7
|
import 'local-pkg';
|
package/dist/node.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { c as createVitest } from './index-
|
|
2
|
-
import './utils-
|
|
1
|
+
export { c as createVitest } from './index-1da01554.js';
|
|
2
|
+
import './utils-5307e690.js';
|
|
3
3
|
import 'tty';
|
|
4
4
|
import 'local-pkg';
|
|
5
5
|
import 'path';
|
|
@@ -12,12 +12,11 @@ import 'os';
|
|
|
12
12
|
import 'util';
|
|
13
13
|
import 'stream';
|
|
14
14
|
import 'events';
|
|
15
|
-
import './constants-
|
|
15
|
+
import './constants-9320a46c.js';
|
|
16
16
|
import 'url';
|
|
17
17
|
import 'perf_hooks';
|
|
18
|
-
import './error-
|
|
19
|
-
import './index-
|
|
20
|
-
import './_commonjsHelpers-bdec4bbd.js';
|
|
18
|
+
import './error-4e165107.js';
|
|
19
|
+
import './index-4cf13e25.js';
|
|
21
20
|
import 'assert';
|
|
22
21
|
import 'worker_threads';
|
|
23
22
|
import 'tinypool';
|
|
@@ -4,6 +4,16 @@ import path from 'path';
|
|
|
4
4
|
import { util } from 'chai';
|
|
5
5
|
import * as tinyspy from 'tinyspy';
|
|
6
6
|
|
|
7
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
8
|
+
|
|
9
|
+
function getDefaultExportFromCjs (x) {
|
|
10
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function commonjsRequire (path) {
|
|
14
|
+
throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
15
|
+
}
|
|
16
|
+
|
|
7
17
|
var picocolors = {exports: {}};
|
|
8
18
|
|
|
9
19
|
let tty = require$$0;
|
|
@@ -250,6 +260,114 @@ const index = {
|
|
|
250
260
|
..._path
|
|
251
261
|
};
|
|
252
262
|
|
|
263
|
+
var mockdate$1 = {exports: {}};
|
|
264
|
+
|
|
265
|
+
(function (module, exports) {
|
|
266
|
+
(function (global, factory) {
|
|
267
|
+
factory(exports) ;
|
|
268
|
+
}(commonjsGlobal, (function (exports) {
|
|
269
|
+
/*! *****************************************************************************
|
|
270
|
+
Copyright (c) Microsoft Corporation.
|
|
271
|
+
|
|
272
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
273
|
+
purpose with or without fee is hereby granted.
|
|
274
|
+
|
|
275
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
276
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
277
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
278
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
279
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
280
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
281
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
282
|
+
***************************************************************************** */
|
|
283
|
+
/* global Reflect, Promise */
|
|
284
|
+
|
|
285
|
+
var extendStatics = function(d, b) {
|
|
286
|
+
extendStatics = Object.setPrototypeOf ||
|
|
287
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
288
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
289
|
+
return extendStatics(d, b);
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
function __extends(d, b) {
|
|
293
|
+
if (typeof b !== "function" && b !== null)
|
|
294
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
295
|
+
extendStatics(d, b);
|
|
296
|
+
function __() { this.constructor = d; }
|
|
297
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
var RealDate = Date;
|
|
301
|
+
var now = null;
|
|
302
|
+
var MockDate = /** @class */ (function (_super) {
|
|
303
|
+
__extends(Date, _super);
|
|
304
|
+
function Date(y, m, d, h, M, s, ms) {
|
|
305
|
+
_super.call(this) || this;
|
|
306
|
+
var date;
|
|
307
|
+
switch (arguments.length) {
|
|
308
|
+
case 0:
|
|
309
|
+
if (now !== null) {
|
|
310
|
+
date = new RealDate(now.valueOf());
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
date = new RealDate();
|
|
314
|
+
}
|
|
315
|
+
break;
|
|
316
|
+
case 1:
|
|
317
|
+
date = new RealDate(y);
|
|
318
|
+
break;
|
|
319
|
+
default:
|
|
320
|
+
d = typeof d === 'undefined' ? 1 : d;
|
|
321
|
+
h = h || 0;
|
|
322
|
+
M = M || 0;
|
|
323
|
+
s = s || 0;
|
|
324
|
+
ms = ms || 0;
|
|
325
|
+
date = new RealDate(y, m, d, h, M, s, ms);
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
return date;
|
|
329
|
+
}
|
|
330
|
+
return Date;
|
|
331
|
+
}(RealDate));
|
|
332
|
+
MockDate.prototype = RealDate.prototype;
|
|
333
|
+
MockDate.UTC = RealDate.UTC;
|
|
334
|
+
MockDate.now = function () {
|
|
335
|
+
return new MockDate().valueOf();
|
|
336
|
+
};
|
|
337
|
+
MockDate.parse = function (dateString) {
|
|
338
|
+
return RealDate.parse(dateString);
|
|
339
|
+
};
|
|
340
|
+
MockDate.toString = function () {
|
|
341
|
+
return RealDate.toString();
|
|
342
|
+
};
|
|
343
|
+
function set(date) {
|
|
344
|
+
var dateObj = new Date(date.valueOf());
|
|
345
|
+
if (isNaN(dateObj.getTime())) {
|
|
346
|
+
throw new TypeError('mockdate: The time set is an invalid date: ' + date);
|
|
347
|
+
}
|
|
348
|
+
// @ts-ignore
|
|
349
|
+
Date = MockDate;
|
|
350
|
+
now = dateObj.valueOf();
|
|
351
|
+
}
|
|
352
|
+
function reset() {
|
|
353
|
+
Date = RealDate;
|
|
354
|
+
}
|
|
355
|
+
var mockdate = {
|
|
356
|
+
set: set,
|
|
357
|
+
reset: reset,
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
exports.default = mockdate;
|
|
361
|
+
exports.reset = reset;
|
|
362
|
+
exports.set = set;
|
|
363
|
+
|
|
364
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
365
|
+
|
|
366
|
+
})));
|
|
367
|
+
}(mockdate$1, mockdate$1.exports));
|
|
368
|
+
|
|
369
|
+
var mockdate = /*@__PURE__*/getDefaultExportFromCjs(mockdate$1.exports);
|
|
370
|
+
|
|
253
371
|
const spies = /* @__PURE__ */ new Set();
|
|
254
372
|
function spyOn(obj, method, accessType) {
|
|
255
373
|
const dictionary = {
|
|
@@ -517,6 +635,7 @@ class VitestUtils {
|
|
|
517
635
|
this.spyOn = spyOn;
|
|
518
636
|
this.fn = fn;
|
|
519
637
|
this._timers = new FakeTimers();
|
|
638
|
+
this._systemDate = null;
|
|
520
639
|
}
|
|
521
640
|
useFakeTimers() {
|
|
522
641
|
return this._timers.useFakeTimers();
|
|
@@ -539,6 +658,17 @@ class VitestUtils {
|
|
|
539
658
|
getTimerCount() {
|
|
540
659
|
return this._timers.getTimerCount();
|
|
541
660
|
}
|
|
661
|
+
setSystemDate(date) {
|
|
662
|
+
this._systemDate = date;
|
|
663
|
+
mockdate.set(date);
|
|
664
|
+
}
|
|
665
|
+
resetSystemDate() {
|
|
666
|
+
this._systemDate = null;
|
|
667
|
+
mockdate.reset();
|
|
668
|
+
}
|
|
669
|
+
getSystemDate() {
|
|
670
|
+
return this._systemDate || Date.now();
|
|
671
|
+
}
|
|
542
672
|
mock(path) {
|
|
543
673
|
}
|
|
544
674
|
unmock(path) {
|
|
@@ -666,7 +796,7 @@ async function ensurePackageInstalled(dependency, promptInstall = !process.env.C
|
|
|
666
796
|
message: c.reset(`Do you want to install ${c.green(dependency)}?`)
|
|
667
797
|
});
|
|
668
798
|
if (install) {
|
|
669
|
-
await (await import('./index-
|
|
799
|
+
await (await import('./index-5d224425.js')).installPackage(dependency, { dev: true });
|
|
670
800
|
return true;
|
|
671
801
|
}
|
|
672
802
|
return false;
|
|
@@ -681,4 +811,4 @@ function clearModuleMocks() {
|
|
|
681
811
|
vi.clearAllMocks();
|
|
682
812
|
}
|
|
683
813
|
|
|
684
|
-
export {
|
|
814
|
+
export { hasTests as A, clearModuleMocks as B, getTasks as C, spyOn as a, vi as b, c, slash as d, ensurePackageInstalled as e, fn as f, getNames as g, getTests as h, isAbsolute as i, dirname as j, basename as k, getSuites as l, resolve as m, noop as n, hasFailed as o, notNullish as p, commonjsGlobal as q, relative as r, spies as s, toArray as t, mergeSlashes as u, vitest as v, commonjsRequire as w, index as x, interpretOnlyMode as y, partitionSuiteChildren as z };
|
package/dist/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { B as clearModuleMocks, e as ensurePackageInstalled, g as getNames, l as getSuites, C as getTasks, h as getTests, o as hasFailed, A as hasTests, y as interpretOnlyMode, u as mergeSlashes, n as noop, p as notNullish, z as partitionSuiteChildren, m as resolvePath, d as slash, t as toArray } from './utils-5307e690.js';
|
|
2
2
|
import 'local-pkg';
|
|
3
3
|
import 'tty';
|
|
4
4
|
import 'path';
|
package/dist/worker.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as slash, m as resolve, j as dirname$2, a as spyOn,
|
|
1
|
+
import { d as slash, m as resolve, j as dirname$2, a as spyOn, u as mergeSlashes, s as spies, k as basename$2 } from './utils-5307e690.js';
|
|
2
2
|
import { n as nanoid } from './index-9e71c815.js';
|
|
3
|
-
import { c as distDir } from './constants-
|
|
3
|
+
import { c as distDir } from './constants-9320a46c.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 fs, { promises, realpathSync, statSync, Stats, readdirSync, existsSync } from 'fs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.105",
|
|
4
4
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vite",
|
|
@@ -51,16 +51,16 @@
|
|
|
51
51
|
"@types/chai-subset": "^1.3.3",
|
|
52
52
|
"chai": "^4.3.4",
|
|
53
53
|
"local-pkg": "^0.4.0",
|
|
54
|
-
"tinypool": "^0.0.
|
|
54
|
+
"tinypool": "^0.0.5",
|
|
55
55
|
"tinyspy": "^0.2.4"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@antfu/install-pkg": "^0.1.0",
|
|
59
59
|
"@types/diff": "^5.0.1",
|
|
60
|
-
"@types/jsdom": "^16.2.
|
|
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.2",
|
|
64
64
|
"@types/prompts": "^2.4.0",
|
|
65
65
|
"c8": "^7.10.0",
|
|
66
66
|
"cac": "^6.7.12",
|
|
@@ -70,12 +70,13 @@
|
|
|
70
70
|
"fast-glob": "^3.2.7",
|
|
71
71
|
"find-up": "^6.2.0",
|
|
72
72
|
"flatted": "^3.2.4",
|
|
73
|
-
"happy-dom": "^2.25.
|
|
73
|
+
"happy-dom": "^2.25.1",
|
|
74
74
|
"jsdom": "^19.0.0",
|
|
75
75
|
"log-update": "^5.0.0",
|
|
76
76
|
"magic-string": "^0.25.7",
|
|
77
77
|
"micromatch": "^4.0.4",
|
|
78
78
|
"mlly": "^0.3.16",
|
|
79
|
+
"mockdate": "^3.0.5",
|
|
79
80
|
"nanoid": "^3.1.30",
|
|
80
81
|
"natural-compare": "^1.4.0",
|
|
81
82
|
"pathe": "^0.2.0",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
2
|
-
|
|
3
|
-
function commonjsRequire (path) {
|
|
4
|
-
throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export { commonjsRequire as a, commonjsGlobal as c };
|