@gfdelarue/testkit 0.6.2 → 0.6.3
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/testkit.mjs
CHANGED
|
@@ -32,11 +32,13 @@ if (!hostNodeIsSupported(process.versions.node)) {
|
|
|
32
32
|
const versionMismatch = versionDrift.checkCliVersionDrift(effectiveArgs, {
|
|
33
33
|
binUrl: import.meta.url,
|
|
34
34
|
});
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
})
|
|
39
|
-
|
|
35
|
+
const json = versionDrift.isJsonMode(effectiveArgs);
|
|
36
|
+
let handedOff = false;
|
|
37
|
+
if (versionMismatch) {
|
|
38
|
+
const { handOffToProductCli } = await import("../dist/cli/product-handoff.js");
|
|
39
|
+
handedOff = await handOffToProductCli(versionMismatch, process.argv.slice(2), { json });
|
|
40
|
+
}
|
|
41
|
+
if (!handedOff && !versionDrift.emitCliVersionDriftAndExit(versionMismatch, { json })) {
|
|
40
42
|
const { executeCli } = await import("../dist/cli/index.js");
|
|
41
43
|
await executeCli(
|
|
42
44
|
effectiveArgs,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import o from"node:fs";import e from"node:path";import{isUnknownRecord as l}from"../kernel/unknown-values.js";import{runProductCli as u}from"../process/product-cli.js";export async function runInstalledProductCli(r,n,{onStart:i}){const t=s(r);return t===null?!1:(i(),await u(t,n),!0)}function s(r){let n;try{n=JSON.parse(o.readFileSync(e.join(r,"package.json"),"utf8"))}catch{return null}if(!l(n))return null;const i=l(n.bin)?n.bin.testkit:n.bin;if(typeof i!="string")return null;const t=e.resolve(r,i);return o.statSync(t,{throwIfNoEntry:!1})?.isFile()?t:null}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{runInstalledProductCli as i}from"../app/product-handoff.js";export async function handOffToProductCli(t,e,{json:n=!1}={}){const{packageRoot:r,version:o}=t.product;return r===null?!1:await i(r,e,{onStart:()=>{n||process.stderr.write(`Using the product's @gfdelarue/testkit ${String(o)} (${r}) instead of ${t.current.version}
|
|
2
|
+
`)}})}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"entrypoint": "dist/process/process.js",
|
|
4
4
|
"sourceSha256": "e7301ca010796bb92d983c039db47f36e155c26ccfb42ff2d057d47addab3121",
|
|
5
5
|
"bundleSha256": "db5da25a23e4577451c0c047360de70af8abbd63be686dd7b97d65486cbba3b8",
|
|
6
|
-
"packageLockSha256": "
|
|
6
|
+
"packageLockSha256": "baeb7a46d3a7c0a092ff04f5a5d82115ff9ed748bb9563fdda2e154aa9ab19e3",
|
|
7
7
|
"esbuildVersion": "0.28.1",
|
|
8
8
|
"options": {
|
|
9
9
|
"format": "esm",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{spawn as f}from"node:child_process";const i=process.platform==="win32"?["SIGINT","SIGBREAK"]:["SIGINT","SIGTERM","SIGHUP"];export async function runProductCli(c,n){const e=f(process.execPath,[...process.execArgv,c,...n],{stdio:"inherit"}),r=o=>{process.platform!=="win32"&&e.kill(o)};for(const o of i)process.on(o,r);let s;try{s=await new Promise((o,t)=>{e.once("error",t),e.once("exit",(l,p)=>{o({code:l,signal:p})})})}finally{for(const o of i)process.off(o,r)}s.signal?process.kill(process.pid,s.signal):process.exitCode=s.code??1}
|
package/docs/release-notes.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
# 0.6.3
|
|
2
|
+
|
|
3
|
+
## A global Testkit runs the product's own install
|
|
4
|
+
|
|
5
|
+
When you start the CLI in a product that installs a different version of
|
|
6
|
+
`@gfdelarue/testkit`, the CLI now runs the product's install with the same
|
|
7
|
+
arguments. That covers a global install, a Homebrew, Scoop, AUR, or Chocolatey
|
|
8
|
+
package, and `npx @gfdelarue/testkit@latest`. Before, the CLI stopped with
|
|
9
|
+
`testkit_cli_version_mismatch` and printed the command to run the product's
|
|
10
|
+
install instead.
|
|
11
|
+
|
|
12
|
+
The CLI names the install it runs in one line on stderr, except in `--json`
|
|
13
|
+
mode. The exit code comes from the product's install. On Linux and macOS, a
|
|
14
|
+
stop signal sent to the CLI reaches the product's install, and the CLI ends
|
|
15
|
+
with the signal that ended it. A product that declares a version of
|
|
16
|
+
`@gfdelarue/testkit` but doesn't install one still gets
|
|
17
|
+
`testkit_cli_version_mismatch`.
|
|
18
|
+
|
|
1
19
|
# 0.6.2
|
|
2
20
|
|
|
3
21
|
## Static imports from `@gfdelarue/testkit/playwright` work in a CommonJS product
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gfdelarue/testkit",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"description": "Test orchestration platform for product acceptance and QA workflows",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "module",
|
|
@@ -96,9 +96,9 @@
|
|
|
96
96
|
],
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@eslint/js": "^10.0.1",
|
|
99
|
-
"@gfdelarue/code-budget": "0.1.2",
|
|
100
99
|
"@homebridge/node-pty-prebuilt-multiarch": "^0.13.1",
|
|
101
100
|
"@kitschpatrol/tokei": "2.0.2",
|
|
101
|
+
"@moontern-labs/code-budget": "0.1.3",
|
|
102
102
|
"@types/picomatch": "4.0.3",
|
|
103
103
|
"@types/yauzl": "3.4.0",
|
|
104
104
|
"dts-bundle-generator": "9.5.1",
|