vitest 0.0.76 → 0.0.80

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/worker.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import { resolve, dirname } from 'path';
2
- import { n as nanoid } from './index-6427e0f2.js';
3
- import { b as distDir } from './constants-d4c70610.js';
2
+ import { n as nanoid } from './index-9e71c815.js';
3
+ import { e as distDir } from './constants-9da0006f.js';
4
4
  import { builtinModules, createRequire } from 'module';
5
5
  import { pathToFileURL, fileURLToPath } from 'url';
6
6
  import vm from 'vm';
7
7
  import { s as slash } from './utils-9dcc4050.js';
8
+ import { s as send } from './rpc-7de86f29.js';
8
9
 
9
10
  const defaultInline = [
10
11
  "vitest/dist",
@@ -208,6 +209,14 @@ const moduleCache = new Map();
208
209
  async function init(ctx) {
209
210
  if (_run)
210
211
  return _run;
212
+ const processExit = process.exit;
213
+ process.on("beforeExit", (code) => {
214
+ send("processExit", code);
215
+ });
216
+ process.exit = (code = process.exitCode || 0) => {
217
+ send("processExit", code);
218
+ return processExit(code);
219
+ };
211
220
  const { config } = ctx;
212
221
  _run = (await executeInViteNode({
213
222
  root: config.root,
package/global.d.ts CHANGED
@@ -5,10 +5,9 @@ declare global {
5
5
  const it: typeof import('vitest')['it']
6
6
  const expect: typeof import('vitest')['expect']
7
7
  const assert: typeof import('vitest')['assert']
8
- const sinon: typeof import('vitest')['sinon']
9
8
  const spy: typeof import('vitest')['spy']
10
- const mock: typeof import('vitest')['mock']
11
- const stub: typeof import('vitest')['stub']
9
+ const spyOn: typeof import('vitest')['spyOn']
10
+ const vitest: typeof import('vitest')['vitest']
12
11
  const beforeAll: typeof import('vitest')['beforeAll']
13
12
  const afterAll: typeof import('vitest')['afterAll']
14
13
  const beforeEach: typeof import('vitest')['beforeEach']
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitest",
3
- "version": "0.0.76",
3
+ "version": "0.0.80",
4
4
  "description": "A blazing fast unit test framework powered by Vite",
5
5
  "keywords": [
6
6
  "vite",
@@ -38,74 +38,38 @@
38
38
  "bin",
39
39
  "*.d.ts"
40
40
  ],
41
- "scripts": {
42
- "build": "rimraf dist && rollup -c",
43
- "coverage": "node bin/vitest.mjs -r test/core --coverage",
44
- "dev": "rollup -c -w src",
45
- "docs": "npm -C docs run dev",
46
- "docs:build": "npm -C docs run build",
47
- "docs:serve": "npm -C docs run serve",
48
- "lint": "eslint \"{src,test}/**/*.ts\"",
49
- "prepublishOnly": "nr build",
50
- "release": "bumpp --commit --push --tag && esmo scripts/publish.ts",
51
- "test": "node bin/vitest.mjs -r test/core",
52
- "test:all": "cross-env CI=true pnpm -r --stream --filter !vitest run test --",
53
- "test:ci": "cross-env CI=true pnpm -r --stream --filter !vitest --filter !@vitest/test-fails run test --",
54
- "typecheck": "tsc --noEmit && nr lint",
55
- "ci": "ni && nr typecheck && nr lint && nr build && nr test:all"
56
- },
57
41
  "dependencies": {
58
42
  "@types/chai": "^4.3.0",
59
43
  "@types/chai-subset": "^1.3.3",
60
- "@types/sinon": "^10.0.6",
61
- "@types/sinon-chai": "^3.2.6",
62
44
  "chai": "^4.3.4",
63
45
  "chai-subset": "^1.6.0",
64
46
  "fast-glob": "^3.2.7",
47
+ "flatted": "^3.2.4",
65
48
  "local-pkg": "^0.4.0",
66
49
  "micromatch": "^4.0.4",
67
50
  "piscina": "^3.2.0",
68
- "sinon": "^12.0.1",
69
- "sinon-chai": "^3.7.0",
70
- "source-map": "^0.7.3"
51
+ "source-map": "^0.7.3",
52
+ "tinyspy": "^0.0.6"
71
53
  },
72
54
  "devDependencies": {
73
- "@antfu/eslint-config": "^0.13.1",
74
- "@antfu/ni": "^0.12.0",
75
- "@rollup/plugin-alias": "^3.1.8",
76
- "@rollup/plugin-commonjs": "^21.0.1",
77
- "@rollup/plugin-json": "^4.1.0",
78
- "@rollup/plugin-node-resolve": "^13.0.6",
79
55
  "@types/diff": "^5.0.1",
80
56
  "@types/jsdom": "^16.2.13",
81
57
  "@types/micromatch": "^4.0.2",
82
58
  "@types/natural-compare": "^1.4.1",
83
59
  "@types/node": "^16.11.12",
84
- "@types/sade": "^1.7.3",
85
- "bumpp": "^7.1.1",
86
60
  "c8": "^7.10.0",
87
61
  "cac": "^6.7.12",
88
62
  "cli-truncate": "^3.1.0",
89
- "cross-env": "^7.0.3",
90
63
  "diff": "^5.0.0",
91
- "eslint": "^8.4.1",
92
- "esno": "^0.12.1",
93
64
  "find-up": "^6.2.0",
94
65
  "happy-dom": "^2.24.5",
95
66
  "jsdom": "^19.0.0",
96
67
  "log-update": "^5.0.0",
97
68
  "nanoid": "^3.1.30",
98
69
  "natural-compare": "^1.4.0",
99
- "npm-run-all": "^4.1.5",
100
70
  "picocolors": "^1.0.0",
101
71
  "pretty-format": "^27.4.2",
102
- "rimraf": "^3.0.2",
103
- "rollup-plugin-dts": "^4.0.1",
104
- "rollup-plugin-esbuild": "^4.7.2",
105
- "strip-ansi": "^7.0.1",
106
- "tsup": "^5.11.1",
107
- "typescript": "^4.5.3",
108
- "vite": "^2.7.1"
72
+ "strip-ansi": "^7.0.1"
109
73
  },
110
74
  "peerDependencies": {
111
75
  "c8": "*",
@@ -126,5 +90,10 @@
126
90
  },
127
91
  "engines": {
128
92
  "node": ">=16.0.0"
93
+ },
94
+ "scripts": {
95
+ "build": "rimraf dist && rollup -c",
96
+ "dev": "rollup -c --watch src",
97
+ "typecheck": "tsc --noEmit"
129
98
  }
130
- }
99
+ }
package/README.gh.md DELETED
@@ -1,105 +0,0 @@
1
- <p align="center">
2
- <img src="https://user-images.githubusercontent.com/11247099/145112184-a9ff6727-661c-439d-9ada-963124a281f7.png" height="200">
3
- </p>
4
-
5
- <h1 align="center">
6
- Vitest
7
- </h1>
8
- <p align="center">
9
- A blazing fast unit test framework powered by Vite.
10
- <p>
11
- <p align="center">
12
- <a href="https://www.npmjs.com/package/vitest"><img src="https://img.shields.io/npm/v/vitest?color=a1b858&label="></a>
13
- <p>
14
- <h2 align="center">
15
- <a href="https://preview.vitest.dev">Open the Docs</a>
16
- </h2>
17
- <h3 align="center">
18
- <a href=https://discord.com/invite/2zYZNngd7y"><i>Get involved!</i></a>
19
- </h3>
20
- <br>
21
- <br>
22
-
23
- > 💖 **This project is currently in closed beta exclusively for Sponsors.**<br>
24
- > Become a Sponsor of [@patak-dev](https://github.com/sponsors/patak-dev) or [@antfu](https://github.com/sponsors/antfu) to access the source code and issues tracker.
25
-
26
- > ⚠️ **DISCLAIMER**: Vitest is still in development and not stable yet. It's not recommended to use it in production.
27
-
28
- > Vitest requires Vite v2.7 and Node v16
29
-
30
-
31
- Switch to Vitest by following the [Getting Started Guide](https://preview.vitest.dev/guide) or learn [why we are building a new test runner](https://preview.vitest.dev/guide).
32
-
33
- ## Features
34
-
35
- - [Vite](https://vitejs.dev/)'s config, transformers, resolvers, and plugins. Use the same setup from your app!
36
- - [Jest Snapshot](https://jestjs.io/docs/snapshot-testing)
37
- - [Chai](https://www.chaijs.com/) built-in for assertions, with [Jest expect](https://jestjs.io/docs/expect) compatible APIs.
38
- - [Smart & instant watch mode](#watch-mode), like HMR for tests!
39
- - [Native code coverage](#coverage) via [c8](https://github.com/bcoe/c8)
40
- - [Sinon](https://sinonjs.org/) built-in for mocking, stubbing, and spies.
41
- - [JSDOM](https://github.com/jsdom/jsdom) and [happy-dom](https://github.com/capricorn86/happy-dom) for DOM and browser API mocking
42
- - Components testing ([Vue](./test/vue), [React](./test/react), [Lit](./test/lit), [Vitesse](./test/vitesse))
43
- - Workers multi-threading via [Piscina](https://github.com/piscinajs/piscina)
44
- - ESM first, top level await
45
- - Out-of-box TypeScript / JSX support
46
- - Filtering, timeouts, concurrent for suite and tests
47
-
48
- ```ts
49
- import { it, describe, expect, assert } from 'vitest'
50
-
51
- describe('suite name', () => {
52
- it('foo', () => {
53
- expect(1 + 1).toEqual(2)
54
- expect(true).to.be.true
55
- })
56
-
57
- it('bar', () => {
58
- assert.equal(Math.sqrt(4), 2)
59
- })
60
-
61
- it('snapshot', () => {
62
- expect({ foo: 'bar' }).toMatchSnapshot()
63
- })
64
- })
65
- ```
66
-
67
- ```bash
68
- $ npx vitest
69
- ```
70
-
71
- ## Examples
72
-
73
- - [Unit Testing](./test/core)
74
- - [Vue Component Testing](./test/vue)
75
- - [React Component Testing](./test/react)
76
- - [Lit Component Testing](./test/lit)
77
- - [Vitesse Component Testing](./test/vitesse)
78
-
79
- ## Projects using Vitest
80
-
81
- - [unocss](https://github.com/antfu/unocss)
82
- - [unplugin-auto-import](https://github.com/antfu/unplugin-auto-import)
83
- - [unplugin-vue-components](https://github.com/antfu/unplugin-vue-components)
84
- - [vitesse-lite](https://github.com/antfu/vitesse-lite)
85
-
86
- ## Sponsors
87
-
88
- <p align="center">
89
- <a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg">
90
- <img src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg'/>
91
- </a>
92
- </p>
93
-
94
- ## Credits
95
-
96
- Thanks to:
97
-
98
- - [@patak-dev](https://github.com/patak-dev) for the awesome package name!
99
- - [The Vite team](https://github.com/vitejs/vite) for brainstorming the initial idea.
100
- - [@pi0](https://github.com/pi0) for the idea and implementation of using Vite to transform and bundle the server code.
101
- - [@lukeed](https://github.com/lukeed) for the work on [uvu](https://github.com/lukeed/uvu) where we are inspired a lot from.
102
-
103
- ## License
104
-
105
- [MIT](./LICENSE) License © 2021 [Anthony Fu](https://github.com/antfu)
package/README.npm.md DELETED
@@ -1,9 +0,0 @@
1
- # vitest
2
-
3
- [![NPM version](https://img.shields.io/npm/v/vitest?color=a1b858&label=)](https://www.npmjs.com/package/vitest)
4
-
5
- A blazing fast unit test framework powered by Vite.
6
-
7
- > **This project is currently in closed beta exclusively for Sponsors.**<br>
8
- > Become a Sponsor of [@patak-dev](https://github.com/sponsors/patak-dev) or [@antfu](https://github.com/sponsors/antfu) to access the source code and issues tracker.
9
- > Learn more at [vitest.dev](https://vitest.dev)
@@ -1,16 +0,0 @@
1
- import { g as globalApis } from './constants-d4c70610.js';
2
- import { i as index } from './index-bf952d9c.js';
3
- import 'path';
4
- import 'url';
5
- import './suite-1bc54c1b.js';
6
- import './index-6427e0f2.js';
7
- import 'chai';
8
- import 'sinon';
9
-
10
- function registerApiGlobally() {
11
- globalApis.forEach((api) => {
12
- globalThis[api] = index[api];
13
- });
14
- }
15
-
16
- export { registerApiGlobally };