vitest-environment-wasm-quickjs-dom 0.0.0-stage → 0.0.1
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/LICENSE +21 -0
- package/README.md +35 -2
- package/index.d.ts +1 -0
- package/index.js +5 -0
- package/package.json +61 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SoraKumo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the \"Software\"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
1
|
-
#
|
|
1
|
+
# vitest-environment-wasm-quickjs-dom
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The [`wasm-quickjs-dom`](https://www.npmjs.com/package/wasm-quickjs-dom) environment for [Vitest](https://vitest.dev/), under the name Vitest looks for.
|
|
4
|
+
|
|
5
|
+
Vitest turns `environment: "<name>"` into the package `vitest-environment-<name>` and resolves it from the project's root. This package is that name, so the config is one line, whatever the package manager does with `node_modules` (pnpm does not hoist, which is what breaks a path or a subpath of another package in a monorepo).
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pnpm add -D vitest vitest-environment-wasm-quickjs-dom
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
// vitest.config.ts
|
|
13
|
+
import { defineConfig } from "vitest/config";
|
|
14
|
+
|
|
15
|
+
export default defineConfig({
|
|
16
|
+
test: {
|
|
17
|
+
environment: "wasm-quickjs-dom",
|
|
18
|
+
environmentOptions: {
|
|
19
|
+
wasmQuickjsDom: { url: "http://localhost:3000" }, // any JSDOMOptions
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
In a monorepo whose root config lists the projects of the packages, give each project its own `root`, so the environment is looked up from the package that depends on it:
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
projects: [
|
|
29
|
+
{
|
|
30
|
+
root: "apps/app",
|
|
31
|
+
test: { environment: "wasm-quickjs-dom", include: ["test/client/**/*.test.tsx"] },
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The environment itself is `wasm-quickjs-dom/vitest`; its options and what it provides are described in the [`wasm-quickjs-dom` README](https://www.npmjs.com/package/wasm-quickjs-dom). This package has the same version as `wasm-quickjs-dom` and depends on exactly that version.
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "wasm-quickjs-dom/vitest";
|
package/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Vitest loads an environment by the name `vitest-environment-<name>`, resolved from the project's root. This package is
|
|
2
|
+
// that name for `wasm-quickjs-dom`, so a config can say `environment: "wasm-quickjs-dom"` and nothing else, however the
|
|
3
|
+
// package manager lays out node_modules (pnpm does not hoist, so the environment of a dependency of another package is
|
|
4
|
+
// not reachable by its own name from the root of a monorepo).
|
|
5
|
+
export { default } from "wasm-quickjs-dom/vitest";
|
package/package.json
CHANGED
|
@@ -1,6 +1,61 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "vitest-environment-wasm-quickjs-dom",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "vitest-environment-wasm-quickjs-dom",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "The wasm-quickjs-dom environment for Vitest, under the name Vitest looks for: environment: \"wasm-quickjs-dom\"",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.js",
|
|
7
|
+
"types": "./index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./index.d.ts",
|
|
11
|
+
"import": "./index.js",
|
|
12
|
+
"default": "./index.js"
|
|
13
|
+
},
|
|
14
|
+
"./vitest": {
|
|
15
|
+
"types": "./index.d.ts",
|
|
16
|
+
"import": "./index.js",
|
|
17
|
+
"default": "./index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"index.js",
|
|
22
|
+
"index.d.ts",
|
|
23
|
+
"README.md",
|
|
24
|
+
"LICENSE"
|
|
25
|
+
],
|
|
26
|
+
"author": "SoraKumo <info@croud.jp>",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/SoraKumo001/wasm-html-to-image.git",
|
|
30
|
+
"directory": "packages/vitest-environment-wasm-quickjs-dom"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://sorakumo001.github.io/wasm-html-to-image/master/docs/",
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/SoraKumo001/wasm-html-to-image/issues"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"vitest",
|
|
38
|
+
"vitest-environment",
|
|
39
|
+
"jsdom",
|
|
40
|
+
"dom",
|
|
41
|
+
"quickjs",
|
|
42
|
+
"wasm"
|
|
43
|
+
],
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=20.0.0"
|
|
46
|
+
},
|
|
47
|
+
"license": "MIT",
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"wasm-quickjs-dom": "workspace:*"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"vitest": ">=2.0.0"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"test": "vitest run"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"vitest": "^5.1.0",
|
|
59
|
+
"@types/node": "26.6.6"
|
|
60
|
+
}
|
|
61
|
+
}
|