vona-cli-set-api 1.0.147 → 1.0.150
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { BeanCliBase } from '@cabloy/cli';
|
|
3
|
+
import { catchError } from '@cabloy/utils';
|
|
3
4
|
import fse from 'fs-extra';
|
|
4
5
|
import { rimraf } from 'rimraf';
|
|
5
6
|
import { getAbsolutePathOfModule } from "../utils.js";
|
|
@@ -48,12 +49,15 @@ export class CliBinTest extends BeanCliBase {
|
|
|
48
49
|
args.push('--import=why-is-node-running/include');
|
|
49
50
|
}
|
|
50
51
|
args = args.concat(['--experimental-transform-types', '--loader=ts-node/esm', testFile, projectPath, (!!argv.coverage).toString(), patterns.join(',')]);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
// ignore error special in windows
|
|
53
|
+
await catchError(() => {
|
|
54
|
+
return this.helper.spawnExe({
|
|
55
|
+
cmd: 'node',
|
|
56
|
+
args,
|
|
57
|
+
options: {
|
|
58
|
+
cwd: projectPath,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
57
61
|
});
|
|
58
62
|
}
|
|
59
63
|
async _outputCoverageReportViewer(projectPath) {
|
|
@@ -61,12 +65,14 @@ export class CliBinTest extends BeanCliBase {
|
|
|
61
65
|
const lcovCliFile = getAbsolutePathOfModule('@lcov-viewer/cli/lib/index.js', '');
|
|
62
66
|
// run
|
|
63
67
|
const args = [lcovCliFile, 'lcov', '-o', './coverage/report', './coverage/lcov.info'];
|
|
64
|
-
await
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
await catchError(() => {
|
|
69
|
+
return this.helper.spawnExe({
|
|
70
|
+
cmd: 'node',
|
|
71
|
+
args,
|
|
72
|
+
options: {
|
|
73
|
+
cwd: projectPath,
|
|
74
|
+
},
|
|
75
|
+
});
|
|
70
76
|
});
|
|
71
77
|
}
|
|
72
78
|
_combineTestPatterns(projectPath, modulesMeta) {
|
|
@@ -3,11 +3,11 @@ import os from 'node:os';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { run } from 'node:test';
|
|
5
5
|
import { lcov, spec } from 'node:test/reporters';
|
|
6
|
-
import { sleep } from '@cabloy/utils';
|
|
6
|
+
import { catchError, sleep } from '@cabloy/utils';
|
|
7
7
|
import TableClass from 'cli-table3';
|
|
8
8
|
import fse from 'fs-extra';
|
|
9
9
|
import { globby } from 'globby';
|
|
10
|
-
import {
|
|
10
|
+
import { createGeneralApp } from 'vona-core';
|
|
11
11
|
import whyIsNodeRunning from 'why-is-node-running';
|
|
12
12
|
import { resolveTemplatePath } from "../../utils.js";
|
|
13
13
|
const argv = process.argv.slice(2);
|
|
@@ -61,6 +61,7 @@ async function testRun(projectPath, coverage, patterns) {
|
|
|
61
61
|
'src/suite-vendor/*/modules/*/templates/**/*.ts',
|
|
62
62
|
];
|
|
63
63
|
return new Promise(resolve => {
|
|
64
|
+
let app;
|
|
64
65
|
const testStream = run({
|
|
65
66
|
isolation: 'none',
|
|
66
67
|
concurrency,
|
|
@@ -71,7 +72,7 @@ async function testRun(projectPath, coverage, patterns) {
|
|
|
71
72
|
cwd: projectPath,
|
|
72
73
|
files,
|
|
73
74
|
setup: async () => {
|
|
74
|
-
await createGeneralApp(projectPath);
|
|
75
|
+
app = await createGeneralApp(projectPath);
|
|
75
76
|
},
|
|
76
77
|
})
|
|
77
78
|
.on('test:coverage', data => {
|
|
@@ -82,7 +83,12 @@ async function testRun(projectPath, coverage, patterns) {
|
|
|
82
83
|
})
|
|
83
84
|
.on('test:pass', async (t) => {
|
|
84
85
|
if (t.name === '---done---') {
|
|
85
|
-
await
|
|
86
|
+
const [_, err] = await catchError(() => {
|
|
87
|
+
return app.close();
|
|
88
|
+
});
|
|
89
|
+
if (err) {
|
|
90
|
+
console.error(err);
|
|
91
|
+
}
|
|
86
92
|
// handles
|
|
87
93
|
if (process.env.TEST_WHYISNODERUNNING === 'true') {
|
|
88
94
|
await sleep(2000);
|