datagrok-tools 5.1.6 → 5.1.7
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/bin/commands/test.js +48 -4
- package/package.json +1 -1
package/bin/commands/test.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.test = test;
|
|
8
|
+
var _child_process = require("child_process");
|
|
8
9
|
var _fs = _interopRequireDefault(require("fs"));
|
|
9
10
|
var _os = _interopRequireDefault(require("os"));
|
|
10
11
|
var _path = _interopRequireDefault(require("path"));
|
|
@@ -38,6 +39,19 @@ function detectDartLibraryCategory() {
|
|
|
38
39
|
if (normalizedPath.includes('/dml/') || normalizedPath.endsWith('/dml')) return 'Core: dml';
|
|
39
40
|
return undefined;
|
|
40
41
|
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Traverses up from startDir to find the git repository root (.git directory).
|
|
45
|
+
*/
|
|
46
|
+
function findGitRoot(startDir) {
|
|
47
|
+
let current = startDir;
|
|
48
|
+
while (true) {
|
|
49
|
+
if (_fs.default.existsSync(_path.default.join(current, '.git'))) return current;
|
|
50
|
+
const parent = _path.default.dirname(current);
|
|
51
|
+
if (parent === current) return undefined;
|
|
52
|
+
current = parent;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
41
55
|
async function test(args) {
|
|
42
56
|
const config = _jsYaml.default.load(_fs.default.readFileSync(confPath, {
|
|
43
57
|
encoding: 'utf-8'
|
|
@@ -45,12 +59,42 @@ async function test(args) {
|
|
|
45
59
|
isArgsValid(args);
|
|
46
60
|
utils.setHost(args.host, config);
|
|
47
61
|
|
|
48
|
-
//
|
|
49
|
-
if (!args.
|
|
62
|
+
// If running from a core Dart library directory, delegate to DevTools package
|
|
63
|
+
if (!args.package) {
|
|
50
64
|
const detectedCategory = detectDartLibraryCategory();
|
|
51
65
|
if (detectedCategory) {
|
|
52
|
-
args.category
|
|
53
|
-
|
|
66
|
+
const category = args.category ?? detectedCategory;
|
|
67
|
+
const gitRoot = findGitRoot(curDir);
|
|
68
|
+
const devToolsDir = gitRoot ? _path.default.join(gitRoot, 'public', 'packages', 'DevTools') : undefined;
|
|
69
|
+
if (!devToolsDir || !_fs.default.existsSync(devToolsDir)) {
|
|
70
|
+
color.error(`Cannot run core tests from this directory: DevTools package not found.`);
|
|
71
|
+
color.error(`Run 'grok test --category="${category}"' from 'public/packages/DevTools' instead.`);
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
color.info(`Detected core library directory. Delegating to DevTools with category: "${category}"`);
|
|
75
|
+
const cmdArgs = ['test', `--category=${category}`];
|
|
76
|
+
if (args.host) cmdArgs.push(`--host=${args.host}`);
|
|
77
|
+
if (args.test) cmdArgs.push(`--test=${args.test}`);
|
|
78
|
+
if (args.csv) cmdArgs.push('--csv');
|
|
79
|
+
if (args.gui) cmdArgs.push('--gui');
|
|
80
|
+
if (args.verbose) cmdArgs.push('--verbose');
|
|
81
|
+
if (args.benchmark) cmdArgs.push('--benchmark');
|
|
82
|
+
if (args['stress-test']) cmdArgs.push('--stress-test');
|
|
83
|
+
if (args['skip-build']) cmdArgs.push('--skip-build');
|
|
84
|
+
if (args['skip-publish']) cmdArgs.push('--skip-publish');
|
|
85
|
+
if (args.link) cmdArgs.push('--link');
|
|
86
|
+
if (args.record) cmdArgs.push('--record');
|
|
87
|
+
if (args.catchUnhandled) cmdArgs.push('--catchUnhandled');
|
|
88
|
+
if (args.report) cmdArgs.push('--report');
|
|
89
|
+
if (args.debug) cmdArgs.push('--debug');
|
|
90
|
+
if (args['ci-cd']) cmdArgs.push('--ci-cd');
|
|
91
|
+
if (args['no-retry']) cmdArgs.push('--no-retry');
|
|
92
|
+
const grokScript = _path.default.resolve(__dirname, '..', 'grok.js');
|
|
93
|
+
const result = (0, _child_process.spawnSync)(process.execPath, [grokScript, ...cmdArgs], {
|
|
94
|
+
cwd: devToolsDir,
|
|
95
|
+
stdio: 'inherit'
|
|
96
|
+
});
|
|
97
|
+
process.exit(result.status ?? 1);
|
|
54
98
|
}
|
|
55
99
|
}
|
|
56
100
|
let packageJsonData = undefined;
|
package/package.json
CHANGED