@rpcbase/test 0.280.0 → 0.281.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/package.json +3 -3
- package/src/vitest.config.mjs +31 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpcbase/test",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.281.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
@@ -55,13 +55,13 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@playwright/test": "1.57.0",
|
|
58
|
-
"esbuild": "0.27.
|
|
58
|
+
"esbuild": "0.27.2",
|
|
59
59
|
"istanbul-lib-coverage": "3.2.2",
|
|
60
60
|
"istanbul-lib-report": "3.0.1",
|
|
61
61
|
"istanbul-reports": "3.2.0",
|
|
62
62
|
"lodash": "4.17.21",
|
|
63
63
|
"picomatch": "4.0.3",
|
|
64
64
|
"v8-to-istanbul": "9.3.0",
|
|
65
|
-
"vitest": "4.0.
|
|
65
|
+
"vitest": "4.0.16"
|
|
66
66
|
}
|
|
67
67
|
}
|
package/src/vitest.config.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import path from "node:path"
|
|
2
|
+
import fs from "node:fs"
|
|
2
3
|
import { createRequire } from "node:module"
|
|
3
4
|
|
|
4
5
|
import { defineConfig } from "vitest/config"
|
|
@@ -6,6 +7,10 @@ import { defineConfig } from "vitest/config"
|
|
|
6
7
|
|
|
7
8
|
const require = createRequire(import.meta.url)
|
|
8
9
|
|
|
10
|
+
function escapeRegex(str) {
|
|
11
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
|
|
12
|
+
}
|
|
13
|
+
|
|
9
14
|
function loadTsconfig() {
|
|
10
15
|
let ts
|
|
11
16
|
try {
|
|
@@ -55,11 +60,35 @@ function pathsToAlias(tsconfig) {
|
|
|
55
60
|
for (const [key, targets] of Object.entries(paths)) {
|
|
56
61
|
if (!Array.isArray(targets)) continue
|
|
57
62
|
|
|
58
|
-
const find = key.replace(/\*$/, "")
|
|
59
|
-
|
|
60
63
|
for (const target of targets) {
|
|
64
|
+
if (key.includes("*") && target.includes("*")) {
|
|
65
|
+
const wildcardPattern = target.endsWith("*") ? "(.+)" : "([^/]+)"
|
|
66
|
+
const find = new RegExp(
|
|
67
|
+
`^${escapeRegex(key).split("\\*").join(wildcardPattern)}$`,
|
|
68
|
+
)
|
|
69
|
+
let groupIndex = 0
|
|
70
|
+
const replacedTarget = target.replace(/\*/g, () => `$${++groupIndex}`)
|
|
71
|
+
const replacement = path.resolve(baseUrl, replacedTarget)
|
|
72
|
+
const checkPath = replacement.replace(/\$\\d+/g, "")
|
|
73
|
+
if (
|
|
74
|
+
checkPath.includes(`${path.sep}node_modules${path.sep}`) &&
|
|
75
|
+
!fs.existsSync(checkPath)
|
|
76
|
+
) {
|
|
77
|
+
continue
|
|
78
|
+
}
|
|
79
|
+
alias.push({ find, replacement })
|
|
80
|
+
continue
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const find = key.replace(/\*$/, "")
|
|
61
84
|
const cleanTarget = target.replace(/\*$/, "")
|
|
62
85
|
const replacement = path.resolve(baseUrl, cleanTarget)
|
|
86
|
+
if (
|
|
87
|
+
replacement.includes(`${path.sep}node_modules${path.sep}`) &&
|
|
88
|
+
!fs.existsSync(replacement)
|
|
89
|
+
) {
|
|
90
|
+
continue
|
|
91
|
+
}
|
|
63
92
|
alias.push({ find, replacement })
|
|
64
93
|
}
|
|
65
94
|
}
|