vitest 0.25.3 → 0.25.4

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.
Files changed (33) hide show
  1. package/dist/browser.d.ts +3 -3
  2. package/dist/browser.js +10 -9
  3. package/dist/{chunk-api-setup.c9f38753.js → chunk-api-setup.1c8923c4.js} +4 -2
  4. package/dist/{chunk-integrations-globals.1e636d22.js → chunk-integrations-globals.789c69e2.js} +7 -7
  5. package/dist/{chunk-runtime-chain.f993b1dc.js → chunk-runtime-chain.315721df.js} +8 -7
  6. package/dist/{chunk-runtime-error.6287172c.js → chunk-runtime-error.95c286d7.js} +2 -2
  7. package/dist/{chunk-runtime-mocker.c4d85347.js → chunk-runtime-mocker.cdc0ec57.js} +34 -18
  8. package/dist/{chunk-runtime-rpc.1e7530d3.js → chunk-runtime-rpc.b368762d.js} +2 -2
  9. package/dist/chunk-runtime-setup.80b27439.js +659 -0
  10. package/dist/{chunk-runtime-test-state.de4d6ff8.js → chunk-runtime-test-state.7c288e2d.js} +8 -6
  11. package/dist/{chunk-typecheck-constants.4891f22f.js → chunk-typecheck-constants.ed987901.js} +12 -2
  12. package/dist/{chunk-utils-source-map.c6dfbbc1.js → chunk-utils-source-map.29ff1088.js} +3 -1
  13. package/dist/{chunk-utils-timers.06f993db.js → chunk-utils-timers.b81cda77.js} +2 -0
  14. package/dist/{chunk-vite-node-externalize.c57d0ad1.js → chunk-vite-node-externalize.ddcbafa3.js} +55 -26
  15. package/dist/{chunk-vite-node-client.58cb6bfa.js → chunk-vite-node-source-map.61c5ea66.js} +37 -11
  16. package/dist/{chunk-vite-node-utils.f6d73fbe.js → chunk-vite-node-utils.abe05c5c.js} +1 -14
  17. package/dist/cli.js +8 -7
  18. package/dist/config.cjs +2 -1
  19. package/dist/config.d.ts +2 -1
  20. package/dist/config.js +2 -1
  21. package/dist/entry.js +9 -8
  22. package/dist/environments.d.ts +1 -1
  23. package/dist/{index-9f5bc072.d.ts → index-81973d31.d.ts} +1 -1
  24. package/dist/index.d.ts +5 -5
  25. package/dist/index.js +7 -7
  26. package/dist/loader.js +2 -2
  27. package/dist/node.d.ts +5 -4
  28. package/dist/node.js +9 -8
  29. package/dist/suite.js +6 -6
  30. package/dist/{types-de0e0997.d.ts → types-1cf24598.d.ts} +70 -24
  31. package/dist/{chunk-runtime-setup.667a5719.js → vendor-source-map-support.1ce17397.js} +1 -657
  32. package/dist/worker.js +9 -7
  33. package/package.json +4 -4
package/dist/node.js CHANGED
@@ -1,5 +1,5 @@
1
- export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.c57d0ad1.js';
2
- export { V as VitestRunner } from './chunk-runtime-mocker.c4d85347.js';
1
+ export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.ddcbafa3.js';
2
+ export { V as VitestRunner } from './chunk-runtime-mocker.cdc0ec57.js';
3
3
  import './chunk-utils-env.03f840f2.js';
4
4
  import 'tty';
5
5
  import 'url';
@@ -8,7 +8,7 @@ import './chunk-integrations-coverage.befed097.js';
8
8
  import 'local-pkg';
9
9
  import './chunk-env-node.67948209.js';
10
10
  import 'console';
11
- import './chunk-typecheck-constants.4891f22f.js';
11
+ import './chunk-typecheck-constants.ed987901.js';
12
12
  import 'vite';
13
13
  import 'process';
14
14
  import 'fs';
@@ -17,25 +17,26 @@ import 'util';
17
17
  import 'stream';
18
18
  import 'events';
19
19
  import './vendor-_commonjsHelpers.addc3445.js';
20
- import './chunk-vite-node-client.58cb6bfa.js';
20
+ import './chunk-vite-node-source-map.61c5ea66.js';
21
21
  import 'module';
22
22
  import 'vm';
23
- import './chunk-vite-node-utils.f6d73fbe.js';
23
+ import './chunk-vite-node-utils.abe05c5c.js';
24
24
  import 'acorn';
25
25
  import 'assert';
26
26
  import 'debug';
27
+ import './vendor-source-map-support.1ce17397.js';
28
+ import 'source-map';
27
29
  import 'perf_hooks';
28
30
  import 'fs/promises';
29
31
  import './vendor-index.737c3cff.js';
30
32
  import 'buffer';
31
33
  import 'child_process';
32
34
  import './vendor-index.e1d4cf84.js';
33
- import 'source-map';
34
35
  import 'acorn-walk';
35
36
  import 'worker_threads';
36
37
  import 'tinypool';
37
- import './chunk-utils-timers.06f993db.js';
38
- import './chunk-utils-source-map.c6dfbbc1.js';
38
+ import './chunk-utils-timers.b81cda77.js';
39
+ import './chunk-utils-source-map.29ff1088.js';
39
40
  import 'crypto';
40
41
  import './vendor-index.9c919048.js';
41
42
  import './chunk-magic-string.ffe2b171.js';
package/dist/suite.js CHANGED
@@ -1,16 +1,16 @@
1
1
  import 'util';
2
- import './chunk-typecheck-constants.4891f22f.js';
3
- export { b as bench, f as clearCollectorContext, q as createSuiteHooks, h as defaultSuite, d as describe, g as getCurrentSuite, i as it, s as suite, t as test } from './chunk-runtime-chain.f993b1dc.js';
2
+ import 'chai';
3
+ import './chunk-typecheck-constants.ed987901.js';
4
+ export { b as bench, f as clearCollectorContext, q as createSuiteHooks, h as defaultSuite, d as describe, g as getCurrentSuite, i as it, s as suite, t as test } from './chunk-runtime-chain.315721df.js';
4
5
  import 'path';
5
6
  import './chunk-utils-env.03f840f2.js';
6
7
  import 'tty';
7
8
  import 'url';
8
9
  import 'local-pkg';
9
- import 'chai';
10
10
  import './vendor-_commonjsHelpers.addc3445.js';
11
- import './chunk-runtime-rpc.1e7530d3.js';
12
- import './chunk-utils-timers.06f993db.js';
11
+ import './chunk-runtime-rpc.b368762d.js';
12
+ import './chunk-utils-timers.b81cda77.js';
13
13
  import 'fs';
14
- import './chunk-utils-source-map.c6dfbbc1.js';
14
+ import './chunk-utils-source-map.29ff1088.js';
15
15
  import './spy.js';
16
16
  import 'tinyspy';
@@ -267,7 +267,7 @@ declare class ModuleCacheMap extends Map<string, ModuleCache$1> {
267
267
  /**
268
268
  * Return parsed source map based on inlined source map of the module
269
269
  */
270
- getSourceMap(id: string): any;
270
+ getSourceMap(id: string): RawSourceMap | null;
271
271
  }
272
272
  declare class ViteNodeRunner {
273
273
  options: ViteNodeRunnerOptions;
@@ -281,7 +281,7 @@ declare class ViteNodeRunner {
281
281
  constructor(options: ViteNodeRunnerOptions);
282
282
  executeFile(file: string): Promise<any>;
283
283
  executeId(id: string): Promise<any>;
284
- getSourceMap(id: string): any;
284
+ getSourceMap(id: string): RawSourceMap | null;
285
285
  /** @internal */
286
286
  cachedRequest(rawId: string, callstack: string[]): Promise<any>;
287
287
  /** @internal */
@@ -331,6 +331,7 @@ declare type CreateHotContextFunction = (runner: ViteNodeRunner, url: string) =>
331
331
  interface ModuleCache$1 {
332
332
  promise?: Promise<any>;
333
333
  exports?: any;
334
+ evaluated?: boolean;
334
335
  code?: string;
335
336
  map?: RawSourceMap;
336
337
  /**
@@ -792,6 +793,7 @@ declare class JUnitReporter implements Reporter {
792
793
  private reportFile?;
793
794
  private baseLog;
794
795
  private logger;
796
+ private _timeStart;
795
797
  onInit(ctx: Vitest): Promise<void>;
796
798
  writeElement(name: string, attrs: Record<string, any>, children: () => Promise<void>): Promise<void>;
797
799
  writeErrorDetails(error: ErrorWithDiff): Promise<void>;
@@ -1475,13 +1477,35 @@ declare type ResolvedCoverageOptions = {
1475
1477
  } & Required<CoverageOptions>;
1476
1478
  interface BaseCoverageOptions {
1477
1479
  /**
1478
- * Enable coverage, pass `--coverage` to enable
1480
+ * Enables coverage collection. Can be overriden using `--coverage` CLI option.
1479
1481
  *
1480
1482
  * @default false
1481
1483
  */
1482
1484
  enabled?: boolean;
1483
1485
  /**
1484
- * Clean coverage before running tests
1486
+ * List of files included in coverage as glob patterns
1487
+ *
1488
+ * @default ['**']
1489
+ */
1490
+ include?: string[];
1491
+ /**
1492
+ * Extensions for files to be included in coverage
1493
+ *
1494
+ * @default ['.js', '.cjs', '.mjs', '.ts', '.tsx', '.jsx', '.vue', '.svelte']
1495
+ */
1496
+ extension?: string | string[];
1497
+ /**
1498
+ * List of files excluded from coverage as glob patterns
1499
+ */
1500
+ exclude?: string[];
1501
+ /**
1502
+ * Whether to include all files, including the untested ones into report
1503
+ *
1504
+ * @default false
1505
+ */
1506
+ all?: boolean;
1507
+ /**
1508
+ * Clean coverage results before running tests
1485
1509
  *
1486
1510
  * @default true
1487
1511
  */
@@ -1497,56 +1521,62 @@ interface BaseCoverageOptions {
1497
1521
  */
1498
1522
  reportsDirectory?: string;
1499
1523
  /**
1500
- * Reporters
1524
+ * Coverage reporters to use.
1525
+ * See [istanbul documentation](https://istanbul.js.org/docs/advanced/alternative-reporters/) for detailed list of all reporters.
1501
1526
  *
1502
- * @default 'text'
1527
+ * @default ['text', 'html', 'clover', 'json']
1503
1528
  */
1504
1529
  reporter?: Arrayable<CoverageReporter>;
1505
- /**
1506
- * List of files included in coverage as glob patterns
1507
- */
1508
- include?: string[];
1509
- /**
1510
- * List of files excluded from coverage as glob patterns
1511
- */
1512
- exclude?: string[];
1513
1530
  /**
1514
1531
  * Do not show files with 100% statement, branch, and function coverage
1532
+ *
1533
+ * @default false
1515
1534
  */
1516
1535
  skipFull?: boolean;
1517
1536
  /**
1518
- * Check thresholds per file
1537
+ * Check thresholds per file.
1538
+ * See `lines`, `functions`, `branches` and `statements` for the actual thresholds.
1519
1539
  *
1520
1540
  * @default false
1521
1541
  */
1522
1542
  perFile?: boolean;
1523
1543
  /**
1524
1544
  * Threshold for lines
1545
+ *
1546
+ * @default undefined
1525
1547
  */
1526
1548
  lines?: number;
1527
1549
  /**
1528
1550
  * Threshold for functions
1551
+ *
1552
+ * @default undefined
1529
1553
  */
1530
1554
  functions?: number;
1531
1555
  /**
1532
1556
  * Threshold for branches
1557
+ *
1558
+ * @default undefined
1533
1559
  */
1534
1560
  branches?: number;
1535
1561
  /**
1536
1562
  * Threshold for statements
1563
+ *
1564
+ * @default undefined
1537
1565
  */
1538
1566
  statements?: number;
1567
+ }
1568
+ interface CoverageIstanbulOptions extends BaseCoverageOptions {
1539
1569
  /**
1540
- * Extensions for files to be included in coverage
1570
+ * Set to array of class method names to ignore for coverage
1571
+ *
1572
+ * @default []
1541
1573
  */
1542
- extension?: string | string[];
1574
+ ignoreClassMethods?: string[];
1543
1575
  /**
1544
- * Whether to include all files, including the untested ones into report
1576
+ * Watermarks for statements, lines, branches and functions.
1577
+ *
1578
+ * Default value is `[50,80]` for each property.
1545
1579
  */
1546
- all?: boolean;
1547
- }
1548
- interface CoverageIstanbulOptions extends BaseCoverageOptions {
1549
- ignoreClassMethods?: string[];
1550
1580
  watermarks?: {
1551
1581
  statements?: [number, number];
1552
1582
  functions?: [number, number];
@@ -1560,14 +1590,24 @@ interface CoverageC8Options extends BaseCoverageOptions {
1560
1590
  *
1561
1591
  * @default false
1562
1592
  */
1563
- allowExternal?: any;
1593
+ allowExternal?: boolean;
1564
1594
  /**
1565
- * Exclude coverage under /node_modules/
1595
+ * Exclude coverage under `/node_modules/`
1566
1596
  *
1567
1597
  * @default true
1568
1598
  */
1569
1599
  excludeNodeModules?: boolean;
1600
+ /**
1601
+ * Specifies the directories that are used when `--all` is enabled.
1602
+ *
1603
+ * @default cwd
1604
+ */
1570
1605
  src?: string[];
1606
+ /**
1607
+ * Shortcut for `--check-coverage --lines 100 --functions 100 --branches 100 --statements 100`
1608
+ *
1609
+ * @default false
1610
+ */
1571
1611
  100?: boolean;
1572
1612
  }
1573
1613
 
@@ -2050,6 +2090,12 @@ interface InlineConfig {
2050
2090
  * Options for configuring typechecking test environment.
2051
2091
  */
2052
2092
  typecheck?: Partial<TypecheckConfig>;
2093
+ /**
2094
+ * The number of milliseconds after which a test is considered slow and reported as such in the results.
2095
+ *
2096
+ * @default 300
2097
+ */
2098
+ slowTestThreshold?: number;
2053
2099
  }
2054
2100
  interface TypecheckConfig {
2055
2101
  /**