@vitest/runner
Advanced tools
+28
-14
@@ -19,4 +19,4 @@ import { VitestRunner } from './types.js'; | ||
| * @param {Function} fn - A function that defines the tests and suites within this suite. | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * // Define a suite with two tests | ||
@@ -32,4 +32,5 @@ * suite('Math operations', () => { | ||
| * }); | ||
| * | ||
| * ``` | ||
| * @example | ||
| * ```ts | ||
| * // Define nested suites | ||
@@ -49,2 +50,3 @@ * suite('String operations', () => { | ||
| * }); | ||
| * ``` | ||
| */ | ||
@@ -59,4 +61,4 @@ declare const suite: SuiteAPI; | ||
| * @throws {Error} If called inside another test function. | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * // Define a simple test | ||
@@ -66,4 +68,5 @@ * test('should add two numbers', () => { | ||
| * }); | ||
| * | ||
| * ``` | ||
| * @example | ||
| * ```ts | ||
| * // Define a test with options | ||
@@ -73,2 +76,3 @@ * test('should subtract two numbers', { retry: 3 }, () => { | ||
| * }); | ||
| * ``` | ||
| */ | ||
@@ -82,4 +86,4 @@ declare const test: TestAPI; | ||
| * @param {Function} fn - A function that defines the tests and suites within this suite. | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * // Define a suite with two tests | ||
@@ -95,4 +99,5 @@ * describe('Math operations', () => { | ||
| * }); | ||
| * | ||
| * ``` | ||
| * @example | ||
| * ```ts | ||
| * // Define nested suites | ||
@@ -112,2 +117,3 @@ * describe('String operations', () => { | ||
| * }); | ||
| * ``` | ||
| */ | ||
@@ -122,4 +128,4 @@ declare const describe: SuiteAPI; | ||
| * @throws {Error} If called inside another test function. | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * // Define a simple test | ||
@@ -129,4 +135,5 @@ * it('adds two numbers', () => { | ||
| * }); | ||
| * | ||
| * ``` | ||
| * @example | ||
| * ```ts | ||
| * // Define a test with options | ||
@@ -136,2 +143,3 @@ * it('subtracts two numbers', { retry: 3 }, () => { | ||
| * }); | ||
| * ``` | ||
| */ | ||
@@ -151,4 +159,4 @@ declare const it: TestAPI; | ||
| * @returns {void} | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * // Example of using beforeAll to set up a database connection | ||
@@ -158,2 +166,3 @@ * beforeAll(async () => { | ||
| * }); | ||
| * ``` | ||
| */ | ||
@@ -170,4 +179,4 @@ declare function beforeAll(fn: BeforeAllListener, timeout?: number): void; | ||
| * @returns {void} | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * // Example of using afterAll to close a database connection | ||
@@ -177,2 +186,3 @@ * afterAll(async () => { | ||
| * }); | ||
| * ``` | ||
| */ | ||
@@ -189,4 +199,4 @@ declare function afterAll(fn: AfterAllListener, timeout?: number): void; | ||
| * @returns {void} | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * // Example of using beforeEach to reset a database state | ||
@@ -196,2 +206,3 @@ * beforeEach(async () => { | ||
| * }); | ||
| * ``` | ||
| */ | ||
@@ -208,4 +219,4 @@ declare function beforeEach<ExtraContext = object>(fn: BeforeEachListener<ExtraContext>, timeout?: number): void; | ||
| * @returns {void} | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * // Example of using afterEach to delete temporary files created during a test | ||
@@ -215,2 +226,3 @@ * afterEach(async () => { | ||
| * }); | ||
| * ``` | ||
| */ | ||
@@ -228,4 +240,4 @@ declare function afterEach<ExtraContext = object>(fn: AfterEachListener<ExtraContext>, timeout?: number): void; | ||
| * @returns {void} | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * // Example of using onTestFailed to log failure details | ||
@@ -235,2 +247,3 @@ * onTestFailed(({ errors }) => { | ||
| * }); | ||
| * ``` | ||
| */ | ||
@@ -250,4 +263,4 @@ declare const onTestFailed: TaskHook<OnTestFailedHandler>; | ||
| * @returns {void} | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * // Example of using onTestFinished for cleanup | ||
@@ -258,2 +271,3 @@ * const db = await connectToDatabase(); | ||
| * }); | ||
| * ``` | ||
| */ | ||
@@ -260,0 +274,0 @@ declare const onTestFinished: TaskHook<OnTestFinishedHandler>; |
+16
-11
@@ -730,4 +730,3 @@ import { getSafeTimers, isObject, createDefer, isNegativeNaN, format, objDisplay, objectAttr, toArray, shuffle } from '@vitest/utils'; | ||
| async function runSetupFiles(config, runner) { | ||
| const files = toArray(config.setupFiles); | ||
| async function runSetupFiles(config, files, runner) { | ||
| if (config.sequence.setupFiles === "parallel") { | ||
@@ -756,6 +755,12 @@ await Promise.all( | ||
| try { | ||
| const setupStart = now$1(); | ||
| await runSetupFiles(config, runner); | ||
| const setupFiles = toArray(config.setupFiles); | ||
| if (setupFiles.length) { | ||
| const setupStart = now$1(); | ||
| await runSetupFiles(config, setupFiles, runner); | ||
| const setupEnd = now$1(); | ||
| file.setupDuration = setupEnd - setupStart; | ||
| } else { | ||
| file.setupDuration = 0; | ||
| } | ||
| const collectStart = now$1(); | ||
| file.setupDuration = collectStart - setupStart; | ||
| await runner.importFile(filepath, "collect"); | ||
@@ -788,2 +793,8 @@ const defaultTasks = await getDefaultSuite().collect(file); | ||
| calculateSuiteHash(file); | ||
| file.tasks.forEach((task) => { | ||
| var _a2; | ||
| if (((_a2 = task.suite) == null ? void 0 : _a2.id) === "") { | ||
| delete task.suite; | ||
| } | ||
| }); | ||
| const hasOnlyTasks = someTasksAreOnly(file); | ||
@@ -797,8 +808,2 @@ interpretTaskModes( | ||
| ); | ||
| file.tasks.forEach((task) => { | ||
| var _a2; | ||
| if (((_a2 = task.suite) == null ? void 0 : _a2.id) === "") { | ||
| delete task.suite; | ||
| } | ||
| }); | ||
| files.push(file); | ||
@@ -805,0 +810,0 @@ } |
+2
-2
@@ -8,4 +8,4 @@ import { M as SequenceHooks, N as SequenceSetupFiles, F as File, T as Task, S as Suite, r as TaskResultPack, a as Test, C as Custom, K as TaskContext, L as ExtendedContext } from './tasks-zB5uPauP.js'; | ||
| root: string; | ||
| setupFiles: string[] | string; | ||
| name: string; | ||
| setupFiles: string[]; | ||
| name?: string; | ||
| passWithNoTests: boolean; | ||
@@ -12,0 +12,0 @@ testNamePattern?: RegExp; |
+1
-1
@@ -12,3 +12,3 @@ import { S as Suite, F as File, T as Task, a as Test, C as Custom } from './tasks-zB5uPauP.js'; | ||
| declare function calculateSuiteHash(parent: Suite): void; | ||
| declare function createFileTask(filepath: string, root: string, projectName: string, pool?: string): File; | ||
| declare function createFileTask(filepath: string, root: string, projectName: string | undefined, pool?: string): File; | ||
@@ -15,0 +15,0 @@ /** |
+2
-2
| { | ||
| "name": "@vitest/runner", | ||
| "type": "module", | ||
| "version": "2.0.4", | ||
| "version": "2.0.5", | ||
| "description": "Vitest test runner", | ||
@@ -42,3 +42,3 @@ "license": "MIT", | ||
| "pathe": "^1.1.2", | ||
| "@vitest/utils": "2.0.4" | ||
| "@vitest/utils": "2.0.5" | ||
| }, | ||
@@ -45,0 +45,0 @@ "scripts": { |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
82423
0.41%2215
0.87%+ Added
+ Added
- Removed
- Removed
Updated