vitest 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter } from 'events';
2
2
  import { d as c } from './chunk-utils-base.8397dafe.js';
3
- import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.dcae037e.js';
3
+ import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.141a670a.js';
4
4
  import 'path';
5
5
  import 'tty';
6
6
  import 'local-pkg';
package/dist/entry.js CHANGED
@@ -3,7 +3,7 @@ import { t as toArray, r as relative, B as partitionSuiteChildren, C as hasTests
3
3
  import { Console } from 'console';
4
4
  import { Writable } from 'stream';
5
5
  import { importModule } from 'local-pkg';
6
- import { r as resetRunOnceCounter, i as index, R as RealDate, s as stringify, c as clearContext, d as defaultSuite, a as setHooks, g as getHooks, b as context, e as getSnapshotClient, f as setState, h as getFn, j as getState, v as vi } from './chunk-runtime-chain.9e150040.js';
6
+ import { r as resetRunOnceCounter, i as index, R as RealDate, s as stringify, c as clearContext, d as defaultSuite, a as setHooks, g as getHooks, b as context, e as getSnapshotClient, f as setState, h as getFn, j as getState, v as vi } from './chunk-runtime-chain.26475065.js';
7
7
  import { r as rpc } from './chunk-runtime-rpc.5f9e77bc.js';
8
8
  import { g as getWorkerState } from './chunk-utils-global.7bcfa03c.js';
9
9
  import { performance as performance$1 } from 'perf_hooks';
@@ -403,7 +403,7 @@ async function setupGlobalEnv(config) {
403
403
  globalSetup = true;
404
404
  setupConsoleLogSpy();
405
405
  if (config.globals)
406
- (await import('./chunk-integrations-globals.7566c2ac.js')).registerApiGlobally();
406
+ (await import('./chunk-integrations-globals.07fd0dd8.js')).registerApiGlobally();
407
407
  }
408
408
  function setupDefines(defines) {
409
409
  for (const key in defines)
package/dist/index.d.ts CHANGED
@@ -1178,7 +1178,16 @@ declare const afterEach: (fn: SuiteHooks['afterEach'][0], timeout?: number | und
1178
1178
  *
1179
1179
  * @experimental
1180
1180
  */
1181
- declare function runOnce<T>(fn: (() => Awaitable<T>), key?: string): Promise<T>;
1181
+ declare function runOnce<T>(fn: (() => T), key?: string): T;
1182
+ /**
1183
+ * Get a boolean indicates whether the task is running in the first time.
1184
+ * Could only be `false` in watch mode.
1185
+ *
1186
+ * Currently only works with `isolate: false`
1187
+ *
1188
+ * @experimental
1189
+ */
1190
+ declare function isFirstRun(): boolean;
1182
1191
 
1183
1192
  declare const expect: Vi.ExpectStatic;
1184
1193
 
@@ -1348,6 +1357,9 @@ declare class VitestUtils {
1348
1357
  declare const vitest: VitestUtils;
1349
1358
  declare const vi: VitestUtils;
1350
1359
 
1360
+ declare function getRunningMode(): "run" | "watch";
1361
+ declare function isWatchMode(): boolean;
1362
+
1351
1363
  interface TransformResultWithSource extends TransformResult {
1352
1364
  source?: string;
1353
1365
  }
@@ -1471,4 +1483,4 @@ declare global {
1471
1483
  }
1472
1484
  }
1473
1485
 
1474
- export { ApiConfig, ArgumentsType$1 as ArgumentsType, Arrayable, Awaitable, BuiltinEnvironment, C8Options, Constructable, CoverageReporter, DeepMerge, DoneCallback, EnhancedSpy, Environment, EnvironmentOptions, EnvironmentReturn, ErrorWithDiff, File, HookListener, InlineConfig, JSDOMOptions, JestMockCompatContext, MaybeMocked, MaybeMockedConstructor, MaybeMockedDeep, MergeInsertions, MockWithArgs, MockedFunction, MockedFunctionDeep, MockedObject, MockedObjectDeep, ModuleCache, ModuleGraphData, MutableArray, Nullable, ParsedStack, Position, Reporter, ResolveIdFunction, ResolvedC8Options, ResolvedConfig, RunMode, RuntimeContext, SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, SpyInstance, SpyInstanceFn, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestFunction, TransformResultWithSource, UncheckedSnapshot, UserConfig, UserConsoleLog, Vitest, WebSocketEvents, WebSocketHandlers, WorkerContext, WorkerGlobalState, WorkerRPC, afterAll, afterEach, beforeAll, beforeEach, describe, expect, fn, isMockFunction, it, runOnce, spies, spyOn, suite, test, vi, vitest };
1486
+ export { ApiConfig, ArgumentsType$1 as ArgumentsType, Arrayable, Awaitable, BuiltinEnvironment, C8Options, Constructable, CoverageReporter, DeepMerge, DoneCallback, EnhancedSpy, Environment, EnvironmentOptions, EnvironmentReturn, ErrorWithDiff, File, HookListener, InlineConfig, JSDOMOptions, JestMockCompatContext, MaybeMocked, MaybeMockedConstructor, MaybeMockedDeep, MergeInsertions, MockWithArgs, MockedFunction, MockedFunctionDeep, MockedObject, MockedObjectDeep, ModuleCache, ModuleGraphData, MutableArray, Nullable, ParsedStack, Position, Reporter, ResolveIdFunction, ResolvedC8Options, ResolvedConfig, RunMode, RuntimeContext, SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, SpyInstance, SpyInstanceFn, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestFunction, TransformResultWithSource, UncheckedSnapshot, UserConfig, UserConsoleLog, Vitest, WebSocketEvents, WebSocketHandlers, WorkerContext, WorkerGlobalState, WorkerRPC, afterAll, afterEach, beforeAll, beforeEach, describe, expect, fn, getRunningMode, isFirstRun, isMockFunction, isWatchMode, it, runOnce, spies, spyOn, suite, test, vi, vitest };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { p as afterAll, u as afterEach, o as beforeAll, q as beforeEach, l as describe, w as expect, m as it, n as runOnce, k as suite, t as test, v as vi, x as vitest } from './chunk-runtime-chain.9e150040.js';
1
+ export { q as afterAll, w as afterEach, p as beforeAll, u as beforeEach, l as describe, x as expect, z as getRunningMode, o as isFirstRun, A as isWatchMode, m as it, n as runOnce, k as suite, t as test, v as vi, y as vitest } from './chunk-runtime-chain.26475065.js';
2
2
  export { fn, isMockFunction, spies, spyOn } from './jest-mock.js';
3
3
  export { assert, default as chai, should } from 'chai';
4
4
  import 'util';
package/dist/node.js CHANGED
@@ -1,4 +1,4 @@
1
- export { V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.dcae037e.js';
1
+ export { V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.141a670a.js';
2
2
  export { V as VitestRunner } from './chunk-utils-path.c049f6c1.js';
3
3
  import 'buffer';
4
4
  import 'path';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitest",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "A blazing fast unit test framework powered by Vite",
5
5
  "keywords": [
6
6
  "vite",
@@ -96,7 +96,7 @@
96
96
  "@types/node": "^17.0.21",
97
97
  "@types/prompts": "^2.4.0",
98
98
  "@types/sinonjs__fake-timers": "^8.1.1",
99
- "@vitest/ui": "0.7.1",
99
+ "@vitest/ui": "0.7.2",
100
100
  "birpc": "^0.1.0",
101
101
  "c8": "^7.11.0",
102
102
  "cac": "^6.7.12",
@@ -123,7 +123,7 @@
123
123
  "source-map-js": "^1.0.2",
124
124
  "strip-ansi": "^7.0.1",
125
125
  "typescript": "^4.6.2",
126
- "vite-node": "0.7.1",
126
+ "vite-node": "0.7.2",
127
127
  "ws": "^8.5.0"
128
128
  },
129
129
  "engines": {