vitest 0.0.81 → 0.0.82

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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Formatter } from 'picocolors/types';
2
- import { TransformResult, ViteDevServer } from 'vite';
2
+ import { TransformResult } from 'vite';
3
3
  import { OptionsReceived } from 'pretty-format';
4
4
  import { MessagePort } from 'worker_threads';
5
5
  export { assert, default as chai, expect, should } from 'chai';
@@ -110,27 +110,10 @@ declare type MatchersObject<T extends MatcherState = MatcherState> = {
110
110
  [id: string]: RawMatcherFn<T>;
111
111
  };
112
112
 
113
- declare class StateManager {
114
- filesMap: Record<string, File>;
115
- idMap: Record<string, Task>;
116
- taskFileMap: WeakMap<Task, File>;
117
- getFiles(keys?: string[]): File[];
118
- collectFiles(files: File[]): void;
119
- updateId(task: Task): void;
120
- updateTasks(packs: TaskResultPack[]): void;
121
- }
122
-
123
- declare class SnapshotManager {
124
- config: ResolvedConfig;
125
- summary: SnapshotSummary;
126
- constructor(config: ResolvedConfig);
127
- clear(): void;
128
- add(result: SnapshotResult): void;
129
- }
130
-
131
113
  declare type Awaitable<T> = T | PromiseLike<T>;
132
114
  declare type Nullable<T> = T | null | undefined;
133
115
  declare type Arrayable<T> = T | Array<T>;
116
+ declare type ArgumentsType<T> = T extends (...args: infer U) => any ? U : never;
134
117
  interface ModuleCache {
135
118
  promise?: Promise<any>;
136
119
  exports?: any;
@@ -143,14 +126,6 @@ interface Environment {
143
126
  name: string;
144
127
  setup(global: any): Awaitable<EnvironmentReturn>;
145
128
  }
146
- interface VitestContext {
147
- config: ResolvedConfig;
148
- server: ViteDevServer;
149
- state: StateManager;
150
- snapshot: SnapshotManager;
151
- reporters: Reporter[];
152
- console: Console;
153
- }
154
129
  interface UserConsoleLog {
155
130
  content: string;
156
131
  type: 'stdout' | 'stderr';
@@ -294,7 +269,7 @@ interface SnapshotSummary {
294
269
  updated: number;
295
270
  }
296
271
 
297
- interface UserOptions {
272
+ interface InlineConfig$1 {
298
273
  /**
299
274
  * Include globs for test files
300
275
  *
@@ -397,28 +372,26 @@ interface UserOptions {
397
372
  * @default false
398
373
  */
399
374
  silent?: boolean;
400
- /**
401
- * Open Vitest UI
402
- */
403
- open?: boolean;
404
375
  /**
405
376
  * Path to setup files
406
377
  */
407
378
  setupFiles?: string | string[];
379
+ /**
380
+ * Open Vitest UI
381
+ * @internal WIP
382
+ */
383
+ open?: boolean;
408
384
  /**
409
385
  * Listen to port and serve API
410
386
  *
411
387
  * When set to true, the default port is 55555
412
388
  *
389
+ * @internal WIP
413
390
  * @default false
414
391
  */
415
392
  api?: boolean | number;
416
393
  }
417
- interface CliOptions extends UserOptions {
418
- /**
419
- * Filters by name
420
- */
421
- cliFilters?: string[];
394
+ interface UserConfig extends InlineConfig$1 {
422
395
  /**
423
396
  * Path to the config file.
424
397
  *
@@ -431,7 +404,7 @@ interface CliOptions extends UserOptions {
431
404
  config?: string | undefined;
432
405
  dom?: boolean;
433
406
  }
434
- interface ResolvedConfig extends Omit<Required<CliOptions>, 'config' | 'filters'> {
407
+ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'> {
435
408
  config?: string;
436
409
  filters?: string[];
437
410
  depsInline: (string | RegExp)[];
@@ -577,7 +550,7 @@ declare module 'vite' {
577
550
  /**
578
551
  * Options for Vitest
579
552
  */
580
- test?: UserOptions;
553
+ test?: InlineConfig;
581
554
  }
582
555
  }
583
556
  declare global {
@@ -637,4 +610,4 @@ declare global {
637
610
  }
638
611
  }
639
612
 
640
- export { Arrayable, Awaitable, CliOptions, ComputeMode, Environment, EnvironmentReturn, File, HookListener, ModuleCache, Nullable, Reporter, ResolvedConfig, RpcCall, RpcMap, RpcPayload, RpcSend, RunMode, RuntimeContext, SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, Suite, SuiteCollector, SuiteHooks, Task, TaskBase, TaskResult, TaskResultPack, TaskState, Test, TestCollector, TestFactory, TestFunction, UncheckedSnapshot, UserConsoleLog, UserOptions, VitestContext, WorkerContext, afterAll, afterEach, beforeAll, beforeEach, describe, it, suite, test, vitest };
613
+ export { ArgumentsType, Arrayable, Awaitable, ComputeMode, Environment, EnvironmentReturn, File, HookListener, InlineConfig$1 as InlineConfig, ModuleCache, Nullable, Reporter, ResolvedConfig, RpcCall, RpcMap, RpcPayload, RpcSend, RunMode, RuntimeContext, SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, Suite, SuiteCollector, SuiteHooks, Task, TaskBase, TaskResult, TaskResultPack, TaskState, Test, TestCollector, TestFactory, TestFunction, UncheckedSnapshot, UserConfig, UserConsoleLog, WorkerContext, afterAll, afterEach, beforeAll, beforeEach, describe, it, suite, test, vitest };
@@ -1,5 +1,5 @@
1
1
  import { stringify } from 'flatted';
2
- import { A as API_PATH } from './constants-1268ea5c.js';
2
+ import { A as API_PATH } from './constants-adef7ffb.js';
3
3
  import 'path';
4
4
  import 'url';
5
5
 
package/dist/node.js ADDED
@@ -0,0 +1,19 @@
1
+ export { c as createVitest } from './index-9a2ee1fc.js';
2
+ import 'path';
3
+ import 'vite';
4
+ import 'process';
5
+ import 'fs';
6
+ import './constants-adef7ffb.js';
7
+ import 'url';
8
+ import './utils-9dcc4050.js';
9
+ import 'perf_hooks';
10
+ import './error-dd23da12.js';
11
+ import 'tty';
12
+ import 'source-map';
13
+ import 'assert';
14
+ import 'events';
15
+ import 'worker_threads';
16
+ import 'piscina';
17
+ import 'fast-glob';
18
+ import 'micromatch';
19
+ import 'readline';
package/dist/worker.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { resolve, dirname } from 'path';
2
2
  import { n as nanoid } from './index-9e71c815.js';
3
- import { e as distDir } from './constants-1268ea5c.js';
3
+ import { c as distDir } from './constants-adef7ffb.js';
4
4
  import { builtinModules, createRequire } from 'module';
5
5
  import { pathToFileURL, fileURLToPath } from 'url';
6
6
  import vm from 'vm';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitest",
3
- "version": "0.0.81",
3
+ "version": "0.0.82",
4
4
  "description": "A blazing fast unit test framework powered by Vite",
5
5
  "keywords": [
6
6
  "vite",
@@ -25,6 +25,13 @@
25
25
  "import": "./dist/index.js",
26
26
  "types": "./dist/index.d.ts"
27
27
  },
28
+ "./node": {
29
+ "import": "./dist/node.js",
30
+ "types": "./dist/node.d.ts"
31
+ },
32
+ "./global": {
33
+ "types": "./global.d.ts"
34
+ },
28
35
  "./*": "./*"
29
36
  },
30
37
  "main": "./dist/index.js",
@@ -49,7 +56,7 @@
49
56
  "micromatch": "^4.0.4",
50
57
  "piscina": "^3.2.0",
51
58
  "source-map": "^0.7.3",
52
- "tinyspy": "^0.0.6"
59
+ "tinyspy": "^0.0.13"
53
60
  },
54
61
  "devDependencies": {
55
62
  "@types/diff": "^5.0.1",