@activate-core/test-forge 0.18.7 → 0.18.8
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/cli/index.js +11 -0
- package/dist/core/harness.js +6 -0
- package/dist/core/run-tests.js +21 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -92,6 +92,8 @@ function printUsage() {
|
|
|
92
92
|
console.log(' testforge env Write .env.testing.example from docs');
|
|
93
93
|
console.log(' testforge run [--area a] [--journey j] Run the generated tests (Jest/Playwright)');
|
|
94
94
|
console.log(' testforge run --env-file <file> Run against another server (e.g. .env.dev / .env.staging)');
|
|
95
|
+
console.log(' testforge run --headed | --ui | --debug Watch the browser / open the Playwright UI');
|
|
96
|
+
console.log(' testforge run -- <flags> Pass anything else straight to the runner');
|
|
95
97
|
}
|
|
96
98
|
async function main() {
|
|
97
99
|
if (command === 'update') {
|
|
@@ -125,10 +127,19 @@ async function main() {
|
|
|
125
127
|
runEnvTemplate('docs', '.env.testing.example', '.', generatedScanDirs());
|
|
126
128
|
}
|
|
127
129
|
else if (command === 'run') {
|
|
130
|
+
// Anything after `--`, plus the runner flags people reach for most, goes
|
|
131
|
+
// straight to the test runner. Watching a UI suite is an ordinary thing to
|
|
132
|
+
// want and should not mean rebuilding the command by hand.
|
|
133
|
+
const dashIdx = process.argv.indexOf('--');
|
|
134
|
+
const passThrough = [
|
|
135
|
+
...['--headed', '--ui', '--debug'].filter((f) => process.argv.includes(f)),
|
|
136
|
+
...(dashIdx === -1 ? [] : process.argv.slice(dashIdx + 1)),
|
|
137
|
+
];
|
|
128
138
|
const code = runTests({
|
|
129
139
|
area: flagValue('--area'),
|
|
130
140
|
journey: flagValue('--journey'),
|
|
131
141
|
envFile: flagValue('--env-file'),
|
|
142
|
+
passThrough,
|
|
132
143
|
});
|
|
133
144
|
process.exitCode = code;
|
|
134
145
|
}
|
package/dist/core/harness.js
CHANGED
|
@@ -315,6 +315,12 @@ export function playwrightConfig(testDirRelToPackage, globalSetupRelToPackage, c
|
|
|
315
315
|
` testMatch: /.*\\.(test|spec)\\.[jt]s$/,`,
|
|
316
316
|
` globalSetup: require.resolve('${globalSetupRelToPackage}'),`,
|
|
317
317
|
` timeout: 60000,`,
|
|
318
|
+
` // Serial, like the Jest config: these suites share ONE test database`,
|
|
319
|
+
` // and seed/reset it, so parallel workers race on the same rows and the`,
|
|
320
|
+
` // same run gives different answers twice. It also keeps --headed to a`,
|
|
321
|
+
` // single browser window instead of one per worker.`,
|
|
322
|
+
` fullyParallel: false,`,
|
|
323
|
+
` workers: 1,`,
|
|
318
324
|
` // Console line output. The last reporter auto-publishes the run to the`,
|
|
319
325
|
` // TestForge dashboard (needs TESTFORGE_KEY in env + project/dashboardUrl`,
|
|
320
326
|
` // in testforge.config.json).`,
|
package/dist/core/run-tests.js
CHANGED
|
@@ -59,7 +59,25 @@ export function runTests(opts = {}) {
|
|
|
59
59
|
if (!cmd) {
|
|
60
60
|
if (framework === 'playwright') {
|
|
61
61
|
const target = opts.journey ? `${rel}/${opts.journey}` : rel;
|
|
62
|
-
|
|
62
|
+
// Name the config explicitly. It is written beside the AREA's tests
|
|
63
|
+
// (tests/Feature/playwright.config.js for tests/Feature/Web), not at
|
|
64
|
+
// the package root, so Playwright's own discovery finds nothing and
|
|
65
|
+
// silently falls back to defaults — no globalSetup, no reporters, and
|
|
66
|
+
// therefore no run published to the dashboard. Walk up from the test
|
|
67
|
+
// directory to the package root and take the first config found.
|
|
68
|
+
let cfgFlag = '';
|
|
69
|
+
for (let dir = rel;; dir = dirname(dir)) {
|
|
70
|
+
const hit = ['playwright.config.js', 'playwright.config.ts']
|
|
71
|
+
.map((f) => (dir === '.' ? f : join(dir, f)))
|
|
72
|
+
.find((f) => existsSync(join(root, f)));
|
|
73
|
+
if (hit) {
|
|
74
|
+
cfgFlag = ` --config=${hit}`;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
if (dir === '.' || dir === dirname(dir))
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
cmd = `npx playwright test${cfgFlag} ${target}`;
|
|
63
81
|
}
|
|
64
82
|
else {
|
|
65
83
|
cmd = opts.journey
|
|
@@ -67,6 +85,8 @@ export function runTests(opts = {}) {
|
|
|
67
85
|
: `npx jest ${rel}`;
|
|
68
86
|
}
|
|
69
87
|
}
|
|
88
|
+
if (opts.passThrough?.length)
|
|
89
|
+
cmd += ` ${opts.passThrough.join(' ')}`;
|
|
70
90
|
ranAnything = true;
|
|
71
91
|
console.log(`\n=== ${area} (${framework}) ===`);
|
|
72
92
|
console.log(`$ ${cmd} [cwd: ${root}]`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activate-core/test-forge",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.8",
|
|
4
4
|
"description": "AI-powered QA automation. Scans a project, drafts journey docs, and generates seeded Jest/Playwright tests. Works in any project, with any AI CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|