@deot/dev-tester 2.9.7 → 2.9.9
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/index.cjs +11 -5
- package/dist/index.js +10 -5
- package/package.json +8 -8
- package/shared.config.ts +35 -31
package/dist/index.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const path = require('node:path');
|
|
6
|
+
const os = require('node:os');
|
|
6
7
|
const node_url = require('node:url');
|
|
7
8
|
const devShared = require('@deot/dev-shared');
|
|
8
9
|
const node = require('vitest/node');
|
|
@@ -28,6 +29,7 @@ function _interopNamespaceDefault(e) {
|
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
const path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
|
|
32
|
+
const os__namespace = /*#__PURE__*/_interopNamespaceDefault(os);
|
|
31
33
|
|
|
32
34
|
const ALL_PACKAGE = "All Packages";
|
|
33
35
|
const getOptions = async () => {
|
|
@@ -38,10 +40,10 @@ const getOptions = async () => {
|
|
|
38
40
|
message: `Select Package To ${isDev ? "Develop" : "Test"}:`,
|
|
39
41
|
source: (term) => {
|
|
40
42
|
const input = typeof term === "undefined" ? "cli" : term;
|
|
41
|
-
return new Promise(($resolve) => {
|
|
43
|
+
return new Promise((($resolve) => {
|
|
42
44
|
const filter = input ? packages$.filter((item) => item.includes(input)) : packages$;
|
|
43
45
|
$resolve(filter);
|
|
44
|
-
});
|
|
46
|
+
}));
|
|
45
47
|
}
|
|
46
48
|
});
|
|
47
49
|
let subpackageFolderName = "";
|
|
@@ -52,10 +54,10 @@ const getOptions = async () => {
|
|
|
52
54
|
source: (term) => {
|
|
53
55
|
const input = typeof term === "undefined" ? "" : term;
|
|
54
56
|
const subpackages = [ALL_PACKAGE, ...subpackagesMap[packageFolderName]];
|
|
55
|
-
return new Promise(($resolve) => {
|
|
57
|
+
return new Promise((($resolve) => {
|
|
56
58
|
const filter = input ? subpackages.filter((item) => item.includes(input)) : subpackages;
|
|
57
59
|
$resolve(filter);
|
|
58
|
-
});
|
|
60
|
+
}));
|
|
59
61
|
}
|
|
60
62
|
});
|
|
61
63
|
}
|
|
@@ -87,7 +89,7 @@ const run = (options) => devShared.Utils.autoCatch(async () => {
|
|
|
87
89
|
if (typeof options.dryRun === "undefined") {
|
|
88
90
|
options.dryRun = process.env.NODE_ENV === "UNIT";
|
|
89
91
|
}
|
|
90
|
-
if (locals.workspace && !options.packageName) {
|
|
92
|
+
if (locals.workspace && (!options.packageName && !options.include)) {
|
|
91
93
|
const promptOptions = await getOptions();
|
|
92
94
|
options = {
|
|
93
95
|
...options,
|
|
@@ -128,6 +130,10 @@ const run = (options) => devShared.Utils.autoCatch(async () => {
|
|
|
128
130
|
options.useReact = !!isReactPackage;
|
|
129
131
|
const options$ = {
|
|
130
132
|
environment,
|
|
133
|
+
execArgv: [
|
|
134
|
+
"--localstorage-file",
|
|
135
|
+
path__namespace.resolve(os__namespace.tmpdir(), `vitest-${process.pid}.localstorage`)
|
|
136
|
+
],
|
|
131
137
|
coverage: {
|
|
132
138
|
enabled: !!coverage
|
|
133
139
|
},
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as path from 'node:path';
|
|
2
|
+
import * as os from 'node:os';
|
|
2
3
|
import { fileURLToPath } from 'node:url';
|
|
3
4
|
import { Locals, Utils, Shell, Logger } from '@deot/dev-shared';
|
|
4
5
|
import { startVitest } from 'vitest/node';
|
|
@@ -14,10 +15,10 @@ const getOptions = async () => {
|
|
|
14
15
|
message: `Select Package To ${isDev ? "Develop" : "Test"}:`,
|
|
15
16
|
source: (term) => {
|
|
16
17
|
const input = typeof term === "undefined" ? "cli" : term;
|
|
17
|
-
return new Promise(($resolve) => {
|
|
18
|
+
return new Promise((($resolve) => {
|
|
18
19
|
const filter = input ? packages$.filter((item) => item.includes(input)) : packages$;
|
|
19
20
|
$resolve(filter);
|
|
20
|
-
});
|
|
21
|
+
}));
|
|
21
22
|
}
|
|
22
23
|
});
|
|
23
24
|
let subpackageFolderName = "";
|
|
@@ -28,10 +29,10 @@ const getOptions = async () => {
|
|
|
28
29
|
source: (term) => {
|
|
29
30
|
const input = typeof term === "undefined" ? "" : term;
|
|
30
31
|
const subpackages = [ALL_PACKAGE, ...subpackagesMap[packageFolderName]];
|
|
31
|
-
return new Promise(($resolve) => {
|
|
32
|
+
return new Promise((($resolve) => {
|
|
32
33
|
const filter = input ? subpackages.filter((item) => item.includes(input)) : subpackages;
|
|
33
34
|
$resolve(filter);
|
|
34
|
-
});
|
|
35
|
+
}));
|
|
35
36
|
}
|
|
36
37
|
});
|
|
37
38
|
}
|
|
@@ -63,7 +64,7 @@ const run = (options) => Utils.autoCatch(async () => {
|
|
|
63
64
|
if (typeof options.dryRun === "undefined") {
|
|
64
65
|
options.dryRun = process.env.NODE_ENV === "UNIT";
|
|
65
66
|
}
|
|
66
|
-
if (locals.workspace && !options.packageName) {
|
|
67
|
+
if (locals.workspace && (!options.packageName && !options.include)) {
|
|
67
68
|
const promptOptions = await getOptions();
|
|
68
69
|
options = {
|
|
69
70
|
...options,
|
|
@@ -104,6 +105,10 @@ const run = (options) => Utils.autoCatch(async () => {
|
|
|
104
105
|
options.useReact = !!isReactPackage;
|
|
105
106
|
const options$ = {
|
|
106
107
|
environment,
|
|
108
|
+
execArgv: [
|
|
109
|
+
"--localstorage-file",
|
|
110
|
+
path.resolve(os.tmpdir(), `vitest-${process.pid}.localstorage`)
|
|
111
|
+
],
|
|
107
112
|
coverage: {
|
|
108
113
|
enabled: !!coverage
|
|
109
114
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deot/dev-tester",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@deot/dev-react": "^2.9.
|
|
24
|
-
"@deot/dev-shared": "^2.9.
|
|
25
|
-
"@deot/dev-vue": "^2.9.
|
|
26
|
-
"@vitest/coverage-istanbul": "^4.0.
|
|
23
|
+
"@deot/dev-react": "^2.9.9",
|
|
24
|
+
"@deot/dev-shared": "^2.9.9",
|
|
25
|
+
"@deot/dev-vue": "^2.9.9",
|
|
26
|
+
"@vitest/coverage-istanbul": "^4.0.17",
|
|
27
27
|
"cross-env": "^10.1.0",
|
|
28
|
-
"inquirer": "^
|
|
29
|
-
"jsdom": "^27.
|
|
30
|
-
"vitest": "^4.0.
|
|
28
|
+
"inquirer": "^13.2.0",
|
|
29
|
+
"jsdom": "^27.4.0",
|
|
30
|
+
"vitest": "^4.0.17"
|
|
31
31
|
}
|
|
32
32
|
}
|
package/shared.config.ts
CHANGED
|
@@ -32,7 +32,7 @@ const cwd = process.cwd();
|
|
|
32
32
|
|
|
33
33
|
// options
|
|
34
34
|
const options = JSON.parse(decodeURIComponent(process.env.TEST_OPTIONS || '{}'));
|
|
35
|
-
const { workspace, packageFolderName = '*', subpackageFolderName, subpackagesMap } = options;
|
|
35
|
+
const { include, workspace, packageFolderName = '*', subpackageFolderName, subpackagesMap } = options;
|
|
36
36
|
|
|
37
37
|
let tests: string[] = [];
|
|
38
38
|
let collects: string[] = [];
|
|
@@ -40,41 +40,45 @@ let collects: string[] = [];
|
|
|
40
40
|
const TEST_PATTEN = `**/*.{test,spec}.[jt]s?(x)`;
|
|
41
41
|
const COLLECT_PATTEN = `**/*.{[jt]s?(x),vue}`;
|
|
42
42
|
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
if (include) {
|
|
44
|
+
tests.push(include);
|
|
45
|
+
} else {
|
|
46
|
+
if (workspace) {
|
|
47
|
+
const prefixDir = `${workspace}/${packageFolderName || '*'}`;
|
|
48
|
+
tests.push(`${prefixDir}/__tests__/${TEST_PATTEN}`);
|
|
49
|
+
collects.push(`${prefixDir}/src/${COLLECT_PATTEN}`);
|
|
47
50
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
if (packageFolderName === '*') {
|
|
52
|
+
Object.keys(subpackagesMap).forEach((packageFolderName$: string) => {
|
|
53
|
+
const subpackages = subpackagesMap[packageFolderName$];
|
|
54
|
+
if (subpackages.length) {
|
|
55
|
+
const prefixDir$ = `${workspace}/${packageFolderName$}`;
|
|
56
|
+
const subpackagesPatten = `{${subpackages.join(',')},}`;
|
|
54
57
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
tests.push(`${prefixDir$}/${subpackagesPatten}/__tests__/${TEST_PATTEN}`);
|
|
59
|
+
collects.push(`${prefixDir$}/${subpackagesPatten}/${COLLECT_PATTEN}`);
|
|
60
|
+
collects.push(`${prefixDir$}/index*.ts`);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
} else if (subpackagesMap[packageFolderName]?.length) {
|
|
64
|
+
if (subpackageFolderName) {
|
|
65
|
+
tests = [];
|
|
66
|
+
collects = [];
|
|
64
67
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
tests.push(`${prefixDir}/${subpackageFolderName}/__tests__/${TEST_PATTEN}`);
|
|
69
|
+
collects.push(`${prefixDir}/${subpackageFolderName}/${COLLECT_PATTEN}`);
|
|
70
|
+
} else {
|
|
71
|
+
const subpackages = subpackagesMap[packageFolderName];
|
|
72
|
+
const subpackagesPatten = `{${subpackages.join(',')},}`;
|
|
73
|
+
tests.push(`${prefixDir}/${subpackagesPatten}/__tests__/${TEST_PATTEN}`);
|
|
74
|
+
collects.push(`${prefixDir}/${subpackagesPatten}/${COLLECT_PATTEN}`);
|
|
75
|
+
collects.push(`${prefixDir}/index*.ts`);
|
|
76
|
+
}
|
|
73
77
|
}
|
|
78
|
+
} else {
|
|
79
|
+
tests.push(`__tests__/${TEST_PATTEN}`);
|
|
80
|
+
collects.push(`src/${COLLECT_PATTEN}`);
|
|
74
81
|
}
|
|
75
|
-
} else {
|
|
76
|
-
tests.push(`__tests__/${TEST_PATTEN}`);
|
|
77
|
-
collects.push(`src/${COLLECT_PATTEN}`);
|
|
78
82
|
}
|
|
79
83
|
|
|
80
84
|
// alias
|