vitest 0.0.13 → 0.0.17

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 (45) hide show
  1. package/README.md +5 -3
  2. package/bin/vitest.mjs +1 -1
  3. package/dist/cli.js +22 -29
  4. package/dist/constants.js +6 -5
  5. package/dist/{cli-entry.d.ts → entry.d.ts} +0 -0
  6. package/dist/entry.js +38 -0
  7. package/dist/index.d.ts +2 -5
  8. package/dist/index.js +2 -5
  9. package/dist/integrations/chai/index.d.ts +3 -0
  10. package/dist/integrations/chai/index.js +3 -0
  11. package/dist/{chai.d.ts → integrations/chai/jest-expect.d.ts} +5 -5
  12. package/dist/{chai.js → integrations/chai/jest-expect.js} +16 -14
  13. package/dist/integrations/chai/setup.d.ts +2 -0
  14. package/dist/integrations/chai/setup.js +12 -0
  15. package/dist/integrations/chai/snapshot/index.d.ts +19 -0
  16. package/dist/{snapshot → integrations/chai/snapshot}/index.js +3 -13
  17. package/dist/{snapshot → integrations/chai/snapshot}/manager.d.ts +2 -0
  18. package/dist/{snapshot → integrations/chai/snapshot}/manager.js +8 -0
  19. package/dist/{snapshot → integrations/chai/snapshot}/utils/jest-config-helper.d.ts +0 -0
  20. package/dist/{snapshot → integrations/chai/snapshot}/utils/jest-config-helper.js +0 -0
  21. package/dist/{snapshot → integrations/chai/snapshot}/utils/jest-reporters-lite.d.ts +0 -0
  22. package/dist/{snapshot → integrations/chai/snapshot}/utils/jest-reporters-lite.js +0 -0
  23. package/dist/{snapshot → integrations/chai/snapshot}/utils/jest-test-result-helper.d.ts +0 -0
  24. package/dist/{snapshot → integrations/chai/snapshot}/utils/jest-test-result-helper.js +0 -0
  25. package/dist/{snapshot → integrations/chai/snapshot}/utils/types.d.ts +0 -0
  26. package/dist/{snapshot → integrations/chai/snapshot}/utils/types.js +0 -0
  27. package/dist/integrations/chai/types.d.ts +3 -0
  28. package/dist/integrations/chai/types.js +1 -0
  29. package/dist/integrations/jsdom.d.ts +5 -0
  30. package/dist/integrations/jsdom.js +20 -0
  31. package/dist/integrations/sinon.d.ts +3 -0
  32. package/dist/integrations/sinon.js +3 -0
  33. package/dist/reporters/default.d.ts +13 -8
  34. package/dist/reporters/default.js +60 -54
  35. package/dist/run.js +29 -21
  36. package/dist/suite.d.ts +5 -1
  37. package/dist/suite.js +32 -16
  38. package/dist/types.d.ts +27 -13
  39. package/global.d.ts +2 -5
  40. package/index.d.ts +1 -0
  41. package/package.json +5 -1
  42. package/dist/cli-entry.js +0 -28
  43. package/dist/hooks.d.ts +0 -49
  44. package/dist/hooks.js +0 -17
  45. package/dist/snapshot/index.d.ts +0 -9
package/README.md CHANGED
@@ -6,10 +6,11 @@ A blazing fast test runner powered by Vite.
6
6
 
7
7
  ## Features
8
8
 
9
- - [Vite](https://vitejs.dev/)'s config, transformers, resolvers, and plugins. Powered by [vite-node](https://github.com/antfu/vite-node)
9
+ - [Vite](https://vitejs.dev/)'s config, transformers, resolvers, and plugins.
10
10
  - [Jest Snapshot](https://jestjs.io/docs/snapshot-testing)
11
11
  - [Chai](https://www.chaijs.com/) for assertions
12
12
  - [Sinon](https://sinonjs.org/) for mocking
13
+ - [JSDOM](https://github.com/jsdom/jsdom) for DOM mocking
13
14
  - Async suite / test, top level await
14
15
  - ESM friendly
15
16
  - Out-of-box TypeScript support
@@ -20,11 +21,12 @@ import { it, describe, expect, assert } from 'vitest'
20
21
 
21
22
  describe('suite name', () => {
22
23
  it('foo', () => {
23
- assert.equal(Math.sqrt(4), 2)
24
+ expect(1 + 1).toEqual(2)
25
+ expect(true).to.be.true
24
26
  })
25
27
 
26
28
  it('bar', () => {
27
- expect(1 + 1).eq(2)
29
+ assert.equal(Math.sqrt(4), 2)
28
30
  })
29
31
 
30
32
  it('snapshot', () => {
package/bin/vitest.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict'
3
3
 
4
- import '../dist/cli.js'
4
+ import '../dist/entry.js'
package/dist/cli.js CHANGED
@@ -1,36 +1,29 @@
1
- import { fileURLToPath } from 'url';
2
- import { resolve, dirname } from 'path';
1
+ var _a;
3
2
  import minimist from 'minimist';
4
- import { findUp } from 'find-up';
5
- import { run } from './node.js';
6
- process.env.VITEST = 'true';
3
+ import c from 'picocolors';
4
+ import { run } from './run';
5
+ const { log } = console;
7
6
  const argv = minimist(process.argv.slice(2), {
8
7
  alias: {
9
- c: 'config',
8
+ u: 'update',
9
+ w: 'watch',
10
10
  },
11
11
  string: ['root', 'config'],
12
- boolean: ['dev'],
13
- });
14
- const __dirname = dirname(fileURLToPath(import.meta.url));
15
- const root = resolve(argv.root || process.cwd());
16
- const configPath = argv.config ? resolve(root, argv.config) : await findUp(['vitest.config.ts', 'vitest.config.js', 'vitest.config.mjs', 'vite.config.ts', 'vite.config.js', 'vite.config.mjs'], { cwd: root });
17
- await run({
18
- root,
19
- files: [
20
- resolve(__dirname, argv.dev ? '../src/cli-entry.ts' : './cli-entry.js'),
21
- ],
22
- config: configPath,
23
- defaultConfig: {
24
- optimizeDeps: {
25
- exclude: [
26
- 'vitest',
27
- ],
28
- },
29
- },
30
- shouldExternalize(id) {
31
- if (id.includes('/node_modules/vitest/'))
32
- return false;
33
- else
34
- return id.includes('/node_modules/');
12
+ boolean: ['update', 'dev', 'global', 'watch', 'jsdom'],
13
+ unknown(name) {
14
+ if (name[0] === '-') {
15
+ console.error(c.red(`Unknown argument: ${name}`));
16
+ help();
17
+ process.exit(1);
18
+ }
19
+ return true;
35
20
  },
36
21
  });
22
+ // @ts-expect-error
23
+ const server = (_a = process === null || process === void 0 ? void 0 : process.__vite_node__) === null || _a === void 0 ? void 0 : _a.server;
24
+ const viteConfig = (server === null || server === void 0 ? void 0 : server.config) || {};
25
+ const testOptions = viteConfig.test || {};
26
+ await run(Object.assign(Object.assign(Object.assign({}, argv), testOptions), { server, updateSnapshot: argv.update, rootDir: argv.root || process.cwd(), nameFilters: argv._ }));
27
+ function help() {
28
+ log('Help: finish help');
29
+ }
package/dist/constants.js CHANGED
@@ -1,22 +1,23 @@
1
1
  export const defaultIncludes = ['**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'];
2
2
  export const defaultExcludes = ['**/node_modules/**', '**/dist/**'];
3
3
  export const globalApis = [
4
+ // suite
4
5
  'suite',
5
6
  'test',
6
7
  'describe',
7
8
  'it',
9
+ // chai
10
+ 'chai',
8
11
  'expect',
9
12
  'assert',
13
+ // sinon
14
+ 'sinon',
10
15
  'spy',
11
16
  'mock',
12
17
  'stub',
13
- 'sinon',
18
+ // hooks
14
19
  'beforeAll',
15
20
  'afterAll',
16
21
  'beforeEach',
17
22
  'afterEach',
18
- 'beforeFile',
19
- 'afterFile',
20
- 'beforeSuite',
21
- 'afterSuite',
22
23
  ];
File without changes
package/dist/entry.js ADDED
@@ -0,0 +1,38 @@
1
+ import { fileURLToPath } from 'url';
2
+ import { resolve, dirname } from 'path';
3
+ import minimist from 'minimist';
4
+ import { findUp } from 'find-up';
5
+ import { run } from './node.js';
6
+ process.env.VITEST = 'true';
7
+ const argv = minimist(process.argv.slice(2), {
8
+ alias: {
9
+ c: 'config',
10
+ },
11
+ string: ['root', 'config'],
12
+ boolean: ['dev'],
13
+ });
14
+ const __dirname = dirname(fileURLToPath(import.meta.url));
15
+ const root = resolve(argv.root || process.cwd());
16
+ const configPath = argv.config
17
+ ? resolve(root, argv.config)
18
+ : await findUp(['vitest.config.ts', 'vitest.config.js', 'vitest.config.mjs', 'vite.config.ts', 'vite.config.js', 'vite.config.mjs'], { cwd: root });
19
+ await run({
20
+ root,
21
+ files: [
22
+ resolve(__dirname, argv.dev ? '../src/cli.ts' : './cli.js'),
23
+ ],
24
+ config: configPath,
25
+ defaultConfig: {
26
+ optimizeDeps: {
27
+ exclude: [
28
+ 'vitest',
29
+ ],
30
+ },
31
+ },
32
+ shouldExternalize(id) {
33
+ if (id.includes('/node_modules/vitest/'))
34
+ return false;
35
+ else
36
+ return id.includes('/node_modules/');
37
+ },
38
+ });
package/dist/index.d.ts CHANGED
@@ -1,8 +1,5 @@
1
- import sinon from 'sinon';
2
1
  export * from './types';
3
2
  export * from './suite';
4
3
  export * from './config';
5
- export * from './chai';
6
- export { beforeAll, afterAll, beforeEach, afterEach, beforeFile, afterFile, beforeSuite, afterSuite } from './hooks';
7
- export { sinon };
8
- export declare const mock: sinon.SinonMockStatic, spy: sinon.SinonSpyStatic, stub: sinon.SinonStubStatic;
4
+ export * from './integrations/chai';
5
+ export * from './integrations/sinon';
package/dist/index.js CHANGED
@@ -1,8 +1,5 @@
1
- import sinon from 'sinon';
2
1
  export * from './types';
3
2
  export * from './suite';
4
3
  export * from './config';
5
- export * from './chai';
6
- export { beforeAll, afterAll, beforeEach, afterEach, beforeFile, afterFile, beforeSuite, afterSuite } from './hooks';
7
- export { sinon };
8
- export const { mock, spy, stub } = sinon;
4
+ export * from './integrations/chai';
5
+ export * from './integrations/sinon';
@@ -0,0 +1,3 @@
1
+ import chai from 'chai';
2
+ export { assert, should, expect } from 'chai';
3
+ export { chai };
@@ -0,0 +1,3 @@
1
+ import chai from 'chai';
2
+ export { assert, should, expect } from 'chai';
3
+ export { chai };
@@ -1,14 +1,14 @@
1
- import { Config } from 'vitest';
2
- export declare function setupChai(config: Config): Promise<void>;
3
- export { assert, should, expect } from 'chai';
1
+ import { ChaiPlugin } from './types';
2
+ export declare function JestChaiExpect(): ChaiPlugin;
4
3
  declare global {
5
4
  namespace Chai {
6
5
  interface Assertion {
7
- toMatchSnapshot(message?: string): Assertion;
8
- matchSnapshot(message?: string): Assertion;
9
6
  toEqual(expected: any): void;
10
7
  toStrictEqual(expected: any): void;
8
+ toBe(expected: any): void;
11
9
  toContain(item: any): void;
10
+ toBeTruthy(): void;
11
+ toBeFalsy(): void;
12
12
  toBeNaN(): void;
13
13
  toBeUndefined(): void;
14
14
  toBeNull(): void;
@@ -1,15 +1,7 @@
1
- import chai from 'chai';
2
- import SinonChai from 'sinon-chai';
3
- import { SnapshotPlugin } from './snapshot';
4
- export async function setupChai(config) {
5
- chai.use(SinonChai);
6
- chai.use(await SnapshotPlugin({
7
- rootDir: config.rootDir || process.cwd(),
8
- update: config.updateSnapshot,
9
- }));
10
- // Jest Compact
11
- // TODO: add more https://jestjs.io/docs/expect
12
- chai.use((chai, utils) => {
1
+ // Jest Expect Compact
2
+ // TODO: add more https://jestjs.io/docs/expect
3
+ export function JestChaiExpect() {
4
+ return (chai, utils) => {
13
5
  const proto = chai.Assertion.prototype;
14
6
  utils.addMethod(proto, 'toEqual', function (expected) {
15
7
  return this.eql(expected);
@@ -17,9 +9,20 @@ export async function setupChai(config) {
17
9
  utils.addMethod(proto, 'toStrictEqual', function (expected) {
18
10
  return this.equal(expected);
19
11
  });
12
+ utils.addMethod(proto, 'toBe', function (expected) {
13
+ return this.be(expected);
14
+ });
20
15
  utils.addMethod(proto, 'toContain', function (item) {
21
16
  return this.contain(item);
22
17
  });
18
+ utils.addMethod(proto, 'toBeTruthy', function () {
19
+ const obj = utils.flag(this, 'object');
20
+ this.assert(Boolean(obj), 'expected #{this} to be truthy', 'expected #{this} to not be truthy', obj);
21
+ });
22
+ utils.addMethod(proto, 'toFalsy', function () {
23
+ const obj = utils.flag(this, 'object');
24
+ this.assert(!obj, 'expected #{this} to be falsy', 'expected #{this} to not be falsy', obj);
25
+ });
23
26
  utils.addMethod(proto, 'toBeNaN', function () {
24
27
  return this.be.NaN;
25
28
  });
@@ -32,6 +35,5 @@ export async function setupChai(config) {
32
35
  utils.addMethod(proto, 'toBeDefined', function () {
33
36
  return this.not.be.undefined;
34
37
  });
35
- });
38
+ };
36
39
  }
37
- export { assert, should, expect } from 'chai';
@@ -0,0 +1,2 @@
1
+ import { Config } from 'vitest';
2
+ export declare function setupChai(config: Config): Promise<void>;
@@ -0,0 +1,12 @@
1
+ import chai from 'chai';
2
+ import SinonChai from 'sinon-chai';
3
+ import { JestChaiExpect } from './jest-expect';
4
+ import { SnapshotPlugin } from './snapshot';
5
+ export async function setupChai(config) {
6
+ chai.use(SinonChai);
7
+ chai.use(JestChaiExpect());
8
+ chai.use(await SnapshotPlugin({
9
+ rootDir: config.rootDir || process.cwd(),
10
+ update: config.updateSnapshot,
11
+ }));
12
+ }
@@ -0,0 +1,19 @@
1
+ import { ChaiPlugin } from '../types';
2
+ import { SnapshotManager } from './manager';
3
+ export interface SnapshotOptions {
4
+ rootDir: string;
5
+ update?: boolean;
6
+ }
7
+ export declare function getSnapshotManager(): SnapshotManager;
8
+ export declare function SnapshotPlugin(options: SnapshotOptions): Promise<ChaiPlugin>;
9
+ declare global {
10
+ namespace Chai {
11
+ interface Assertion {
12
+ toMatchSnapshot(message?: string): Assertion;
13
+ matchSnapshot(message?: string): Assertion;
14
+ }
15
+ interface ExpectStatic {
16
+ addSnapshotSerializer: import('pretty-format').Plugin;
17
+ }
18
+ }
19
+ }
@@ -1,8 +1,10 @@
1
1
  import Snap from 'jest-snapshot';
2
- import { afterAll, beforeEach } from '../hooks';
3
2
  import { SnapshotManager } from './manager';
4
3
  const { addSerializer } = Snap;
5
4
  let _manager;
5
+ export function getSnapshotManager() {
6
+ return _manager;
7
+ }
6
8
  export async function SnapshotPlugin(options) {
7
9
  const { rootDir } = options;
8
10
  _manager = new SnapshotManager({
@@ -14,18 +16,6 @@ export async function SnapshotPlugin(options) {
14
16
  rootDir,
15
17
  });
16
18
  return function (chai, utils) {
17
- beforeEach((task) => {
18
- var _a;
19
- _manager.setContext({
20
- file: ((_a = task.file) === null || _a === void 0 ? void 0 : _a.filepath) || task.name,
21
- title: task.name,
22
- fullTitle: [task.suite.name, task.name].filter(Boolean).join(' > '),
23
- });
24
- });
25
- afterAll(() => {
26
- _manager.saveSnap();
27
- _manager.report();
28
- });
29
19
  for (const key of ['matchSnapshot', 'toMatchSnapshot']) {
30
20
  utils.addMethod(chai.Assertion.prototype, key, function (message) {
31
21
  const expected = utils.flag(this, 'object');
@@ -1,5 +1,6 @@
1
1
  import type { SnapshotStateType, SnapshotResolver } from 'jest-snapshot';
2
2
  import type { SnapshotStateOptions } from 'jest-snapshot/build/State';
3
+ import { Task } from '../../../types';
3
4
  import { SnapshotSummary } from './utils/types';
4
5
  export interface Context {
5
6
  file: string;
@@ -20,6 +21,7 @@ export declare class SnapshotManager {
20
21
  snapshotResolver?: SnapshotResolver | null;
21
22
  });
22
23
  onFileChanged(): void;
24
+ setTask(task: Task): void;
23
25
  setContext(context: Context): void;
24
26
  assert(received: unknown, message: string): void;
25
27
  saveSnap(): void;
@@ -31,6 +31,14 @@ export class SnapshotManager {
31
31
  this.testFile = this.context.file;
32
32
  this.snapshotState = new SnapshotState(this.snapshotResolver.resolveSnapshotPath(this.testFile), this.snapshotOptions);
33
33
  }
34
+ setTask(task) {
35
+ var _a;
36
+ this.setContext({
37
+ file: ((_a = task.file) === null || _a === void 0 ? void 0 : _a.filepath) || task.name,
38
+ title: task.name,
39
+ fullTitle: [task.suite.name, task.name].filter(Boolean).join(' > '),
40
+ });
41
+ }
34
42
  setContext(context) {
35
43
  if (!context.title || !context.file)
36
44
  return;
@@ -0,0 +1,3 @@
1
+ import { use as chaiUse } from 'chai';
2
+ export declare type FirstFunctionArgument<T> = T extends (arg: infer A) => unknown ? A : never;
3
+ export declare type ChaiPlugin = FirstFunctionArgument<typeof chaiUse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { JSDOM } from 'jsdom';
2
+ export declare function setupJSDOM(global: any): {
3
+ dom: JSDOM;
4
+ restore(): void;
5
+ };
@@ -0,0 +1,20 @@
1
+ import { JSDOM } from 'jsdom';
2
+ export function setupJSDOM(global) {
3
+ const dom = new JSDOM('<!DOCTYPE html>', {
4
+ pretendToBeVisual: true,
5
+ runScripts: 'dangerously',
6
+ // TODO: options
7
+ url: 'http://localhost:3000',
8
+ });
9
+ const keys = Object.getOwnPropertyNames(dom.window)
10
+ .filter(k => !k.startsWith('_'))
11
+ .filter(k => !(k in global));
12
+ for (const key of keys)
13
+ global[key] = dom.window[key];
14
+ return {
15
+ dom,
16
+ restore() {
17
+ keys.forEach(key => delete global[key]);
18
+ },
19
+ };
20
+ }
@@ -0,0 +1,3 @@
1
+ import sinon from 'sinon';
2
+ export { sinon };
3
+ export declare const mock: sinon.SinonMockStatic, spy: sinon.SinonSpyStatic, stub: sinon.SinonStubStatic;
@@ -0,0 +1,3 @@
1
+ import sinon from 'sinon';
2
+ export { sinon };
3
+ export const { mock, spy, stub } = sinon;
@@ -1,19 +1,24 @@
1
- import { File, Reporter, RunnerContext, Suite, Task } from '../types';
1
+ import Listr from 'listr';
2
+ import { Reporter, RunnerContext, Task } from '../types';
3
+ interface TaskPromise {
4
+ promise: Promise<void>;
5
+ resolve: () => void;
6
+ reject: (e: unknown) => void;
7
+ }
2
8
  export declare class DefaultReporter implements Reporter {
3
9
  indent: number;
4
10
  start: number;
5
11
  end: number;
12
+ listr: Listr | null;
13
+ listrPromise: Promise<void> | null;
14
+ taskMap: Map<Task, TaskPromise>;
6
15
  onStart(): void;
7
- onCollected(): void;
8
- onSuiteBegin(suite: Suite): void;
9
- onSuiteEnd(suite: Suite): void;
10
- onFileBegin(file: File): void;
11
- onFileEnd(): void;
12
- onTaskBegin(task: Task): void;
16
+ onCollected(ctx: RunnerContext): void;
13
17
  onTaskEnd(task: Task): void;
14
- onFinished({ files }: RunnerContext): void;
18
+ onFinished({ files }: RunnerContext): Promise<void>;
15
19
  private getIndent;
16
20
  private log;
17
21
  private error;
18
22
  onSnapshotUpdate(): void;
19
23
  }
24
+ export {};
@@ -1,69 +1,75 @@
1
- import { relative } from 'path';
2
1
  import { performance } from 'perf_hooks';
2
+ import { relative } from 'path';
3
3
  import c from 'picocolors';
4
- import ora from 'ora';
5
- const DOT = '· ';
6
- const CHECK = '✔ ';
7
- const CROSS = '⤫ ';
4
+ import Listr from 'listr';
5
+ const CROSS = ' ';
8
6
  export class DefaultReporter {
9
7
  constructor() {
10
8
  this.indent = 0;
11
9
  this.start = 0;
12
10
  this.end = 0;
11
+ this.listr = null;
12
+ this.listrPromise = null;
13
+ this.taskMap = new Map();
13
14
  }
14
15
  onStart() {
15
16
  this.indent = 0;
16
17
  }
17
- onCollected() {
18
+ onCollected(ctx) {
18
19
  this.start = performance.now();
19
- }
20
- onSuiteBegin(suite) {
21
- if (suite.name) {
22
- this.indent += 1;
23
- const name = DOT + suite.name;
24
- if (suite.mode === 'skip')
25
- this.log(c.dim(c.yellow(`${name} (skipped)`)));
26
- else if (suite.mode === 'todo')
27
- this.log(c.dim(`${name} (todo)`));
28
- else
29
- this.log(name);
30
- }
31
- }
32
- onSuiteEnd(suite) {
33
- if (suite.name)
34
- this.indent -= 1;
35
- }
36
- onFileBegin(file) {
37
- this.log(`- ${relative(process.cwd(), file.filepath)} ${c.dim(`(${file.suites.flatMap(i => i.tasks).length} tests)`)}`);
38
- }
39
- onFileEnd() {
40
- this.log();
41
- }
42
- onTaskBegin(task) {
43
- this.indent += 1;
44
- // @ts-expect-error
45
- task.__ora = ora({ text: task.name, prefixText: this.getIndent().slice(1), spinner: 'arc' }).start();
20
+ this.taskMap = new Map();
21
+ const tasks = ctx.files.reduce((acc, file) => acc.concat(file.suites.flatMap(i => i.tasks)), []);
22
+ tasks.forEach((t) => {
23
+ const obj = {};
24
+ obj.promise = new Promise((resolve, reject) => {
25
+ obj.resolve = resolve;
26
+ obj.reject = reject;
27
+ });
28
+ this.taskMap.set(t, obj);
29
+ });
30
+ const createTasksListr = (tasks) => {
31
+ return tasks.map((task) => {
32
+ return {
33
+ title: task.name,
34
+ skip: () => task.mode === 'skip',
35
+ task: async () => {
36
+ var _a;
37
+ return await ((_a = this.taskMap.get(task)) === null || _a === void 0 ? void 0 : _a.promise);
38
+ },
39
+ };
40
+ });
41
+ };
42
+ const listrOptions = {
43
+ exitOnError: false,
44
+ };
45
+ this.listr = new Listr(ctx.files.map((file) => {
46
+ return {
47
+ title: relative(process.cwd(), file.filepath),
48
+ task: () => {
49
+ return new Listr(file.suites.flatMap((suite) => {
50
+ if (!suite.name)
51
+ return createTasksListr(suite.tasks);
52
+ return [{
53
+ title: suite.name,
54
+ skip: () => suite.mode !== 'run',
55
+ task: () => new Listr(createTasksListr(suite.tasks), listrOptions),
56
+ }];
57
+ }), listrOptions);
58
+ },
59
+ };
60
+ }), listrOptions);
61
+ this.listrPromise = this.listr.run().catch(() => { });
46
62
  }
47
63
  onTaskEnd(task) {
48
- var _a;
49
- // @ts-expect-error
50
- (_a = task.__ora) === null || _a === void 0 ? void 0 : _a.stop();
51
- if (task.state === 'pass') {
52
- this.log(`${c.green(CHECK + task.name)}`);
53
- }
54
- else if (task.state === 'skip') {
55
- this.log(c.dim(c.yellow(`${DOT + task.name} (skipped)`)));
56
- }
57
- else if (task.state === 'todo') {
58
- this.log(c.dim(`${DOT + task.name} (todo)`));
59
- }
60
- else {
61
- this.error(`${c.red(`${CROSS}${task.name}`)}`);
62
- process.exitCode = 1;
63
- }
64
- this.indent -= 1;
64
+ var _a, _b;
65
+ if (task.state === 'fail')
66
+ (_a = this.taskMap.get(task)) === null || _a === void 0 ? void 0 : _a.reject(task.error);
67
+ else
68
+ (_b = this.taskMap.get(task)) === null || _b === void 0 ? void 0 : _b.resolve();
65
69
  }
66
- onFinished({ files }) {
70
+ async onFinished({ files }) {
71
+ await this.listrPromise;
72
+ this.log();
67
73
  this.end = performance.now();
68
74
  const failedFiles = files.filter(i => i.error);
69
75
  const tasks = files.reduce((acc, file) => acc.concat(file.suites.flatMap(i => i.tasks)), []);
@@ -85,14 +91,14 @@ export class DefaultReporter {
85
91
  this.error(c.bold(`\nFailed Tests (${failed.length})`));
86
92
  failed.forEach((task) => {
87
93
  var _a;
88
- this.error(`\n${CROSS + c.inverse(c.red(' FAIL '))} ${[task.suite.name, task.name].filter(Boolean).join(' > ')} ${c.gray(`${(_a = task.file) === null || _a === void 0 ? void 0 : _a.filepath}`)}`);
94
+ this.error(`\n${CROSS + c.inverse(c.red(' FAIL '))} ${[task.suite.name, task.name].filter(Boolean).join(' > ')} ${c.gray(c.dim(`${(_a = task.file) === null || _a === void 0 ? void 0 : _a.filepath}`))}`);
89
95
  console.error(task.error || 'Unknown error');
90
96
  this.log();
91
97
  });
92
98
  }
93
- this.log(c.green(`Passed ${passed.length} / ${runable.length}`));
99
+ this.log(c.bold(c.green(`Passed ${passed.length} / ${runable.length}`)));
94
100
  if (failed.length)
95
- this.log(c.red(`Failed ${failed.length} / ${runable.length}`));
101
+ this.log(c.bold(c.red(`Failed ${failed.length} / ${runable.length}`)));
96
102
  if (skipped.length)
97
103
  this.log(c.yellow(`Skipped ${skipped.length}`));
98
104
  if (todo.length)
package/dist/run.js CHANGED
@@ -1,16 +1,20 @@
1
1
  import fg from 'fast-glob';
2
- import { setupChai } from './chai';
2
+ import { setupChai } from './integrations/chai/setup';
3
3
  import { clearContext, defaultSuite } from './suite';
4
4
  import { context } from './context';
5
- import { afterEachHook, afterFileHook, afterAllHook, afterSuiteHook, beforeEachHook, beforeFileHook, beforeAllHook, beforeSuiteHook } from './hooks';
6
5
  import { DefaultReporter } from './reporters/default';
7
6
  import { defaultIncludes, defaultExcludes } from './constants';
7
+ import { getSnapshotManager } from './integrations/chai/snapshot';
8
+ async function callHook(suite, name, args) {
9
+ await Promise.all(suite.hooks[name].map(fn => fn(...args)));
10
+ }
8
11
  export async function runTask(task, ctx) {
9
- var _a, _b;
12
+ var _a, _b, _c;
10
13
  const { reporter } = ctx;
11
- await ((_a = reporter.onTaskBegin) === null || _a === void 0 ? void 0 : _a.call(reporter, task, ctx));
14
+ (_a = getSnapshotManager()) === null || _a === void 0 ? void 0 : _a.setTask(task);
15
+ await ((_b = reporter.onTaskBegin) === null || _b === void 0 ? void 0 : _b.call(reporter, task, ctx));
12
16
  if (task.mode === 'run') {
13
- await beforeEachHook.fire(task);
17
+ await callHook(task.suite, 'afterEach', [task, task.suite]);
14
18
  try {
15
19
  await task.fn();
16
20
  task.state = 'pass';
@@ -19,9 +23,9 @@ export async function runTask(task, ctx) {
19
23
  task.state = 'fail';
20
24
  task.error = e;
21
25
  }
22
- await afterEachHook.fire(task);
26
+ await callHook(task.suite, 'afterEach', [task, task.suite]);
23
27
  }
24
- await ((_b = reporter.onTaskEnd) === null || _b === void 0 ? void 0 : _b.call(reporter, task, ctx));
28
+ await ((_c = reporter.onTaskEnd) === null || _c === void 0 ? void 0 : _c.call(reporter, task, ctx));
25
29
  }
26
30
  export async function collectFiles(paths) {
27
31
  const files = [];
@@ -72,23 +76,24 @@ function interpretOnlyMode(items) {
72
76
  }
73
77
  }
74
78
  export async function runFile(file, ctx) {
75
- var _a, _b, _c, _d;
79
+ var _a, _b;
76
80
  const { reporter } = ctx;
77
81
  const runableSuites = file.suites.filter(i => i.mode === 'run');
78
82
  if (runableSuites.length === 0)
79
83
  return;
80
84
  await ((_a = reporter.onFileBegin) === null || _a === void 0 ? void 0 : _a.call(reporter, file, ctx));
81
- await beforeFileHook.fire(file);
82
- for (const suite of file.suites) {
83
- await ((_b = reporter.onSuiteBegin) === null || _b === void 0 ? void 0 : _b.call(reporter, suite, ctx));
84
- await beforeSuiteHook.fire(suite);
85
- for (const t of suite.tasks)
86
- await runTask(t, ctx);
87
- await afterSuiteHook.fire(suite);
88
- await ((_c = reporter.onSuiteEnd) === null || _c === void 0 ? void 0 : _c.call(reporter, suite, ctx));
89
- }
90
- await afterFileHook.fire(file);
91
- await ((_d = reporter.onFileEnd) === null || _d === void 0 ? void 0 : _d.call(reporter, file, ctx));
85
+ // TODO: support toggling parallel or serial
86
+ await Promise.all(file.suites.map(async (suite) => {
87
+ var _a, _b;
88
+ await ((_a = reporter.onSuiteBegin) === null || _a === void 0 ? void 0 : _a.call(reporter, suite, ctx));
89
+ await callHook(suite, 'beforeAll', [suite]);
90
+ await Promise.all(suite.tasks.map(i => runTask(i, ctx)));
91
+ // for (const t of suite.tasks)
92
+ // await runTask(t, ctx)
93
+ await callHook(suite, 'afterAll', [suite]);
94
+ await ((_b = reporter.onSuiteEnd) === null || _b === void 0 ? void 0 : _b.call(reporter, suite, ctx));
95
+ }));
96
+ await ((_b = reporter.onFileEnd) === null || _b === void 0 ? void 0 : _b.call(reporter, file, ctx));
92
97
  }
93
98
  export async function run(config) {
94
99
  var _a, _b, _c, _d;
@@ -111,6 +116,8 @@ export async function run(config) {
111
116
  await ((_b = reporter.onStart) === null || _b === void 0 ? void 0 : _b.call(reporter, config));
112
117
  if (config.global)
113
118
  (await import('./global')).registerApiGlobally();
119
+ if (config.jsdom)
120
+ (await import('./integrations/jsdom')).setupJSDOM(globalThis);
114
121
  const files = await collectFiles(paths);
115
122
  const ctx = {
116
123
  files,
@@ -118,9 +125,10 @@ export async function run(config) {
118
125
  reporter,
119
126
  };
120
127
  await ((_c = reporter.onCollected) === null || _c === void 0 ? void 0 : _c.call(reporter, ctx));
121
- await beforeAllHook.fire();
122
128
  for (const file of files)
123
129
  await runFile(file, ctx);
124
- await afterAllHook.fire();
130
+ const snapshot = getSnapshotManager();
131
+ snapshot === null || snapshot === void 0 ? void 0 : snapshot.saveSnap();
132
+ snapshot === null || snapshot === void 0 ? void 0 : snapshot.report();
125
133
  await ((_d = reporter.onFinished) === null || _d === void 0 ? void 0 : _d.call(reporter, ctx));
126
134
  }
package/dist/suite.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { SuiteCollector, TestFactory, TestFunction } from './types';
1
+ import { SuiteCollector, TestFactory, TestFunction, Suite } from './types';
2
2
  export declare const defaultSuite: SuiteCollector;
3
3
  export declare const test: {
4
4
  (name: string, fn: TestFunction): void;
@@ -19,4 +19,8 @@ export declare const it: {
19
19
  only(name: string, fn: TestFunction): void;
20
20
  todo(name: string): void;
21
21
  };
22
+ export declare const beforeAll: (fn: Suite['hooks']['beforeAll'][0]) => void;
23
+ export declare const afterAll: (fn: Suite['hooks']['afterAll'][0]) => void;
24
+ export declare const beforeEach: (fn: Suite['hooks']['beforeEach'][0]) => void;
25
+ export declare const afterEach: (fn: Suite['hooks']['afterEach'][0]) => void;
22
26
  export declare function clearContext(): void;
package/dist/suite.js CHANGED
@@ -3,20 +3,30 @@ export const defaultSuite = suite('');
3
3
  function getCurrentSuite() {
4
4
  return context.currentSuite || defaultSuite;
5
5
  }
6
- export const test = (name, fn) => getCurrentSuite().test(name, fn);
7
- test.skip = (name, fn) => getCurrentSuite().test.skip(name, fn);
8
- test.only = (name, fn) => getCurrentSuite().test.only(name, fn);
9
- test.todo = (name) => getCurrentSuite().test.todo(name);
10
- function createSuiteCollector(mode, suiteName, factory) {
6
+ function createSuiteCollector(name, factory = () => { }, mode) {
11
7
  const queue = [];
12
8
  const factoryQueue = [];
9
+ const suiteBase = {
10
+ name,
11
+ mode,
12
+ hooks: {
13
+ beforeAll: [],
14
+ afterAll: [],
15
+ beforeEach: [],
16
+ afterEach: [],
17
+ },
18
+ };
13
19
  const collector = {
14
- name: suiteName,
20
+ name,
15
21
  mode,
16
22
  test,
17
23
  collect,
18
24
  clear,
25
+ on: addHook,
19
26
  };
27
+ function addHook(name, ...fn) {
28
+ suiteBase.hooks[name].push(...fn);
29
+ }
20
30
  function collectTask(name, fn, mode) {
21
31
  queue.push({
22
32
  name,
@@ -41,12 +51,8 @@ function createSuiteCollector(mode, suiteName, factory) {
41
51
  if (factory)
42
52
  await factory(test);
43
53
  const tasks = [...factoryQueue, ...queue];
44
- const suite = {
45
- name: collector.name,
46
- mode: collector.mode,
47
- tasks,
48
- file,
49
- };
54
+ const suite = Object.assign(Object.assign({}, suiteBase), { tasks,
55
+ file });
50
56
  tasks.forEach((task) => {
51
57
  task.suite = suite;
52
58
  if (file)
@@ -58,15 +64,25 @@ function createSuiteCollector(mode, suiteName, factory) {
58
64
  context.suites.push(collector);
59
65
  return collector;
60
66
  }
67
+ // apis
68
+ export const test = (name, fn) => getCurrentSuite().test(name, fn);
69
+ test.skip = (name, fn) => getCurrentSuite().test.skip(name, fn);
70
+ test.only = (name, fn) => getCurrentSuite().test.only(name, fn);
71
+ test.todo = (name) => getCurrentSuite().test.todo(name);
61
72
  export function suite(suiteName, factory) {
62
- return createSuiteCollector('run', suiteName, factory);
73
+ return createSuiteCollector(suiteName, factory, 'run');
63
74
  }
64
- suite.skip = (suiteName, factory) => createSuiteCollector('skip', suiteName, factory);
65
- suite.only = (suiteName, factory) => createSuiteCollector('only', suiteName, factory);
66
- suite.todo = (suiteName) => createSuiteCollector('todo', suiteName);
75
+ suite.skip = (suiteName, factory) => createSuiteCollector(suiteName, factory, 'skip');
76
+ suite.only = (suiteName, factory) => createSuiteCollector(suiteName, factory, 'only');
77
+ suite.todo = (suiteName) => createSuiteCollector(suiteName, undefined, 'todo');
67
78
  // alias
68
79
  export const describe = suite;
69
80
  export const it = test;
81
+ // hooks
82
+ export const beforeAll = (fn) => getCurrentSuite().on('beforeAll', fn);
83
+ export const afterAll = (fn) => getCurrentSuite().on('afterAll', fn);
84
+ export const beforeEach = (fn) => getCurrentSuite().on('beforeEach', fn);
85
+ export const afterEach = (fn) => getCurrentSuite().on('afterEach', fn);
70
86
  // utils
71
87
  export function clearContext() {
72
88
  context.suites.length = 0;
package/dist/types.d.ts CHANGED
@@ -8,7 +8,13 @@ export interface UserOptions {
8
8
  *
9
9
  * @default false
10
10
  */
11
- global?: string;
11
+ global?: boolean;
12
+ /**
13
+ * Use `js-dom` to mock browser APIs
14
+ *
15
+ * @default false
16
+ */
17
+ jsdom?: boolean;
12
18
  }
13
19
  export interface Config extends UserOptions {
14
20
  rootDir?: string;
@@ -35,18 +41,26 @@ export interface TestCollector {
35
41
  skip: (name: string, fn: TestFunction) => void;
36
42
  todo: (name: string) => void;
37
43
  }
44
+ export declare type HookListener<T extends any[]> = (...args: T) => Awaitable<void>;
38
45
  export interface Suite {
39
46
  name: string;
40
47
  mode: RunMode;
41
48
  tasks: Task[];
42
49
  file?: File;
50
+ hooks: {
51
+ beforeAll: HookListener<[Suite]>[];
52
+ afterAll: HookListener<[Suite]>[];
53
+ beforeEach: HookListener<[Task, Suite]>[];
54
+ afterEach: HookListener<[Task, Suite]>[];
55
+ };
43
56
  }
44
57
  export interface SuiteCollector {
45
- name: string;
46
- mode: RunMode;
58
+ readonly name: string;
59
+ readonly mode: RunMode;
47
60
  test: TestCollector;
48
61
  collect: (file?: File) => Promise<Suite>;
49
62
  clear: () => void;
63
+ on: <T extends keyof Suite['hooks']>(name: T, ...fn: Suite['hooks'][T]) => void;
50
64
  }
51
65
  export declare type TestFactory = (test: (name: string, fn: TestFunction) => void) => Awaitable<void>;
52
66
  export interface File {
@@ -65,14 +79,14 @@ export interface GlobalContext {
65
79
  currentSuite: SuiteCollector | null;
66
80
  }
67
81
  export interface Reporter {
68
- onStart: (userOptions: Config) => Awaitable<void>;
69
- onCollected: (ctx: RunnerContext) => Awaitable<void>;
70
- onFinished: (ctx: RunnerContext) => Awaitable<void>;
71
- onSuiteBegin: (suite: Suite, ctx: RunnerContext) => Awaitable<void>;
72
- onSuiteEnd: (suite: Suite, ctx: RunnerContext) => Awaitable<void>;
73
- onFileBegin: (file: File, ctx: RunnerContext) => Awaitable<void>;
74
- onFileEnd: (file: File, ctx: RunnerContext) => Awaitable<void>;
75
- onTaskBegin: (task: Task, ctx: RunnerContext) => Awaitable<void>;
76
- onTaskEnd: (task: Task, ctx: RunnerContext) => Awaitable<void>;
77
- onSnapshotUpdate: () => Awaitable<void>;
82
+ onStart?: (userOptions: Config) => Awaitable<void>;
83
+ onCollected?: (ctx: RunnerContext) => Awaitable<void>;
84
+ onFinished?: (ctx: RunnerContext) => Awaitable<void>;
85
+ onSuiteBegin?: (suite: Suite, ctx: RunnerContext) => Awaitable<void>;
86
+ onSuiteEnd?: (suite: Suite, ctx: RunnerContext) => Awaitable<void>;
87
+ onFileBegin?: (file: File, ctx: RunnerContext) => Awaitable<void>;
88
+ onFileEnd?: (file: File, ctx: RunnerContext) => Awaitable<void>;
89
+ onTaskBegin?: (task: Task, ctx: RunnerContext) => Awaitable<void>;
90
+ onTaskEnd?: (task: Task, ctx: RunnerContext) => Awaitable<void>;
91
+ onSnapshotUpdate?: () => Awaitable<void>;
78
92
  }
package/global.d.ts CHANGED
@@ -3,19 +3,16 @@ declare global {
3
3
  const test: typeof import('vitest')['test']
4
4
  const describe: typeof import('vitest')['describe']
5
5
  const it: typeof import('vitest')['it']
6
+ const chai: typeof import('vitest')['chai']
6
7
  const expect: typeof import('vitest')['expect']
7
8
  const assert: typeof import('vitest')['assert']
9
+ const sinon: typeof import('vitest')['sinon']
8
10
  const spy: typeof import('vitest')['spy']
9
11
  const mock: typeof import('vitest')['mock']
10
12
  const stub: typeof import('vitest')['stub']
11
- const sinon: typeof import('vitest')['sinon']
12
13
  const beforeAll: typeof import('vitest')['beforeAll']
13
14
  const afterAll: typeof import('vitest')['afterAll']
14
15
  const beforeEach: typeof import('vitest')['beforeEach']
15
16
  const afterEach: typeof import('vitest')['afterEach']
16
- const beforeFile: typeof import('vitest')['beforeFile']
17
- const afterFile: typeof import('vitest')['afterFile']
18
- const beforeSuite: typeof import('vitest')['beforeSuite']
19
- const afterSuite: typeof import('vitest')['afterSuite']
20
17
  }
21
18
  export {}
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './dist/index'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitest",
3
- "version": "0.0.13",
3
+ "version": "0.0.17",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/antfu/vitest#readme",
@@ -42,6 +42,8 @@
42
42
  "find-up": "^6.2.0",
43
43
  "jest-snapshot": "^27.4.2",
44
44
  "jest-util": "^27.4.2",
45
+ "jsdom": "^19.0.0",
46
+ "listr": "^0.14.3",
45
47
  "minimist": "^1.2.5",
46
48
  "ora": "^6.0.1",
47
49
  "picocolors": "^1.0.0",
@@ -51,6 +53,8 @@
51
53
  "devDependencies": {
52
54
  "@antfu/eslint-config": "^0.11.1",
53
55
  "@antfu/ni": "^0.11.0",
56
+ "@types/jsdom": "^16.2.13",
57
+ "@types/listr": "^0.14.4",
54
58
  "@types/minimist": "^1.2.2",
55
59
  "@types/node": "^16.11.11",
56
60
  "@types/sinon": "^10.0.6",
package/dist/cli-entry.js DELETED
@@ -1,28 +0,0 @@
1
- var _a;
2
- import minimist from 'minimist';
3
- import c from 'picocolors';
4
- import { run } from './run';
5
- const { log } = console;
6
- const argv = minimist(process.argv.slice(2), {
7
- alias: {
8
- u: 'update',
9
- },
10
- string: ['root', 'config'],
11
- boolean: ['update', 'dev', 'global'],
12
- unknown(name) {
13
- if (name[0] === '-') {
14
- console.error(c.red(`Unknown argument: ${name}`));
15
- help();
16
- process.exit(1);
17
- }
18
- return true;
19
- },
20
- });
21
- // @ts-expect-error
22
- const server = (_a = process === null || process === void 0 ? void 0 : process.__vite_node__) === null || _a === void 0 ? void 0 : _a.server;
23
- const viteConfig = (server === null || server === void 0 ? void 0 : server.config) || {};
24
- const testOptions = viteConfig.test || {};
25
- await run(Object.assign(Object.assign({}, testOptions), { server, global: argv.global, updateSnapshot: argv.update, rootDir: argv.root || process.cwd(), nameFilters: argv._ }));
26
- function help() {
27
- log('Help: finish help');
28
- }
package/dist/hooks.d.ts DELETED
@@ -1,49 +0,0 @@
1
- import { File, Suite, Task } from './types';
2
- export declare const beforeAllHook: {
3
- on(fn: (...args: any[]) => void | Promise<void>): void;
4
- fire(...args: any[]): Promise<void>;
5
- clear(): void;
6
- };
7
- export declare const afterAllHook: {
8
- on(fn: (...args: any[]) => void | Promise<void>): void;
9
- fire(...args: any[]): Promise<void>;
10
- clear(): void;
11
- };
12
- export declare const beforeEachHook: {
13
- on(fn: (args_0: Task) => void | Promise<void>): void;
14
- fire(args_0: Task): Promise<void>;
15
- clear(): void;
16
- };
17
- export declare const afterEachHook: {
18
- on(fn: (args_0: Task) => void | Promise<void>): void;
19
- fire(args_0: Task): Promise<void>;
20
- clear(): void;
21
- };
22
- export declare const beforeFileHook: {
23
- on(fn: (args_0: File) => void | Promise<void>): void;
24
- fire(args_0: File): Promise<void>;
25
- clear(): void;
26
- };
27
- export declare const afterFileHook: {
28
- on(fn: (args_0: File) => void | Promise<void>): void;
29
- fire(args_0: File): Promise<void>;
30
- clear(): void;
31
- };
32
- export declare const beforeSuiteHook: {
33
- on(fn: (args_0: Suite) => void | Promise<void>): void;
34
- fire(args_0: Suite): Promise<void>;
35
- clear(): void;
36
- };
37
- export declare const afterSuiteHook: {
38
- on(fn: (args_0: Suite) => void | Promise<void>): void;
39
- fire(args_0: Suite): Promise<void>;
40
- clear(): void;
41
- };
42
- export declare const beforeAll: (fn: (...args: any[]) => void | Promise<void>) => void;
43
- export declare const afterAll: (fn: (...args: any[]) => void | Promise<void>) => void;
44
- export declare const beforeEach: (fn: (args_0: Task) => void | Promise<void>) => void;
45
- export declare const afterEach: (fn: (args_0: Task) => void | Promise<void>) => void;
46
- export declare const beforeFile: (fn: (args_0: File) => void | Promise<void>) => void;
47
- export declare const afterFile: (fn: (args_0: File) => void | Promise<void>) => void;
48
- export declare const beforeSuite: (fn: (args_0: Suite) => void | Promise<void>) => void;
49
- export declare const afterSuite: (fn: (args_0: Suite) => void | Promise<void>) => void;
package/dist/hooks.js DELETED
@@ -1,17 +0,0 @@
1
- import { createHook } from './utils/hook';
2
- export const beforeAllHook = createHook();
3
- export const afterAllHook = createHook();
4
- export const beforeEachHook = createHook();
5
- export const afterEachHook = createHook();
6
- export const beforeFileHook = createHook();
7
- export const afterFileHook = createHook();
8
- export const beforeSuiteHook = createHook();
9
- export const afterSuiteHook = createHook();
10
- export const beforeAll = beforeAllHook.on;
11
- export const afterAll = afterAllHook.on;
12
- export const beforeEach = beforeEachHook.on;
13
- export const afterEach = afterEachHook.on;
14
- export const beforeFile = beforeFileHook.on;
15
- export const afterFile = afterFileHook.on;
16
- export const beforeSuite = beforeSuiteHook.on;
17
- export const afterSuite = afterSuiteHook.on;
@@ -1,9 +0,0 @@
1
- import { use as chaiUse } from 'chai';
2
- declare type FirstFunctionArgument<T> = T extends (arg: infer A) => unknown ? A : never;
3
- declare type ChaiPlugin = FirstFunctionArgument<typeof chaiUse>;
4
- export interface SnapshotOptions {
5
- rootDir: string;
6
- update?: boolean;
7
- }
8
- export declare function SnapshotPlugin(options: SnapshotOptions): Promise<ChaiPlugin>;
9
- export {};