@ux-ui/vitest-runner 0.1.0
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 +41 -0
- package/bin/vitest-runner.mjs +24 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ux-ui.pro
|
|
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
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# @ux-ui/vitest-runner
|
|
2
|
+
|
|
3
|
+
A thin [Vitest](https://vitest.dev) launcher for the `ux-ui-pro` npm portfolio. It works around a
|
|
4
|
+
Windows-only Vitest 4 crash — `Cannot read properties of undefined (reading 'config')` — caused by
|
|
5
|
+
a drive-letter case mismatch (`d:` vs `D:`) in the ESM-resolved path (`assembly.md` §6/§7). On
|
|
6
|
+
Linux/macOS (and in CI) the normalization is a no-op.
|
|
7
|
+
|
|
8
|
+
This replaces the per-repo `run-vitest.mjs` scripts: the fix lives in one published dev-tool.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install -D @ux-ui/vitest-runner vitest
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`vitest` is a peer dependency — the consuming package owns its version.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
In a package `package.json`:
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"scripts": {
|
|
29
|
+
"test:unit": "vitest-runner run src"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Arguments are forwarded verbatim to Vitest (`vitest-runner run src`, `vitest-runner run tests`,
|
|
35
|
+
`vitest-runner --coverage`, …). With no arguments it defaults to `run` (single, non-watch run).
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## License
|
|
40
|
+
|
|
41
|
+
MIT
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
|
|
6
|
+
// Windows fix (assembly.md §6/§7): Vitest 4 crashes with
|
|
7
|
+
// "Cannot read properties of undefined (reading 'config')" when the drive-letter
|
|
8
|
+
// case in the ESM-resolved path differs (d: vs D:). Normalize it to upper-case.
|
|
9
|
+
const normalizeDrive = (value) => value.replace(/^[a-z]:/, (drive) => drive.toUpperCase());
|
|
10
|
+
|
|
11
|
+
const require = createRequire(import.meta.url);
|
|
12
|
+
const vitestPkgPath = normalizeDrive(require.resolve('vitest/package.json'));
|
|
13
|
+
const vitestBin = normalizeDrive(join(dirname(vitestPkgPath), 'vitest.mjs'));
|
|
14
|
+
const cwd = normalizeDrive(process.cwd());
|
|
15
|
+
|
|
16
|
+
const forwarded = process.argv.slice(2);
|
|
17
|
+
const args = forwarded.length > 0 ? forwarded : ['run'];
|
|
18
|
+
|
|
19
|
+
const result = spawnSync(process.execPath, [vitestBin, ...args], {
|
|
20
|
+
cwd,
|
|
21
|
+
stdio: 'inherit',
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
process.exit(result.status ?? 1);
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ux-ui/vitest-runner",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Vitest launcher with Windows drive-letter normalization for the ux-ui-pro npm portfolio (assembly.md §6/§7).",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"author": "ux-ui.pro",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/ux-ui-pro/vitest-runner.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/ux-ui-pro/vitest-runner/issues"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/ux-ui-pro/vitest-runner",
|
|
16
|
+
"packageManager": "npm@10.9.3",
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=20.19.0"
|
|
19
|
+
},
|
|
20
|
+
"bin": {
|
|
21
|
+
"vitest-runner": "./bin/vitest-runner.mjs"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"test:unit": "node ./bin/vitest-runner.mjs run tests",
|
|
25
|
+
"pack:check": "npm pack --dry-run && publint",
|
|
26
|
+
"verify": "npm run test:unit && npm run pack:check",
|
|
27
|
+
"prepublishOnly": "npm run verify"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"bin",
|
|
31
|
+
"README.md",
|
|
32
|
+
"LICENSE"
|
|
33
|
+
],
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"vitest": ">=4.0.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"publint": "^0.3.21",
|
|
42
|
+
"vitest": "^4.1.9"
|
|
43
|
+
},
|
|
44
|
+
"keywords": [
|
|
45
|
+
"vitest",
|
|
46
|
+
"runner",
|
|
47
|
+
"windows",
|
|
48
|
+
"test",
|
|
49
|
+
"ux-ui-pro"
|
|
50
|
+
]
|
|
51
|
+
}
|