vitest 0.0.73 → 0.0.77
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/cli.js +133 -71
- package/dist/{constants-d4c70610.js → constants-2435fa16.js} +11 -1
- package/dist/entry.js +58 -24
- package/dist/{error-5a04e54b.js → error-c9295525.js} +47 -31
- package/dist/{global-e40b54d6.js → global-38c2f902.js} +4 -4
- package/dist/index-6feda5ef.js +33 -0
- package/dist/{index-6427e0f2.js → index-9e71c815.js} +0 -0
- package/dist/index.d.ts +42 -14
- package/dist/index.js +3 -3
- package/dist/middleware-37267df8.js +34 -0
- package/dist/{suite-819c135e.js → suite-95be5909.js} +42 -41
- package/dist/worker.js +3 -2
- package/package.json +9 -37
- package/README.gh.md +0 -105
- package/README.npm.md +0 -9
- package/dist/index-e37648e9.js +0 -31
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
|
-
[](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)
|
package/dist/index-e37648e9.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { s as suite, d as defaultSuite, c as createSuiteHooks, t as test, a as describe, i as it, b as beforeAll, e as afterAll, f as beforeEach, g as afterEach, h as clearContext } from './suite-819c135e.js';
|
|
2
|
-
import chai, { assert, should, expect } from 'chai';
|
|
3
|
-
import sinon from 'sinon';
|
|
4
|
-
|
|
5
|
-
const { mock, spy, stub } = sinon;
|
|
6
|
-
sinon.fn = sinon.spy;
|
|
7
|
-
|
|
8
|
-
var index = /*#__PURE__*/Object.freeze({
|
|
9
|
-
__proto__: null,
|
|
10
|
-
suite: suite,
|
|
11
|
-
defaultSuite: defaultSuite,
|
|
12
|
-
createSuiteHooks: createSuiteHooks,
|
|
13
|
-
test: test,
|
|
14
|
-
describe: describe,
|
|
15
|
-
it: it,
|
|
16
|
-
beforeAll: beforeAll,
|
|
17
|
-
afterAll: afterAll,
|
|
18
|
-
beforeEach: beforeEach,
|
|
19
|
-
afterEach: afterEach,
|
|
20
|
-
clearContext: clearContext,
|
|
21
|
-
assert: assert,
|
|
22
|
-
should: should,
|
|
23
|
-
expect: expect,
|
|
24
|
-
chai: chai,
|
|
25
|
-
sinon: sinon,
|
|
26
|
-
mock: mock,
|
|
27
|
-
spy: spy,
|
|
28
|
-
stub: stub
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export { stub as a, index as i, mock as m, spy as s };
|