mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-12-05 08:15:41 -08:00
Stop each console before its assert in the pointer test, so a failing run leaves no server up
AI Assisted
This commit is contained in:
1 parent
615e98e11e
commit
ec45430eda
1 file changed
+4
-2
@@ -386,17 +386,19 @@ test("only an installed console's open leaves the console-dir pointer; status, h
|
|||||||
assert.match(usage.stderr, /keep/, "the usage line names every command");
|
assert.match(usage.stderr, /keep/, "the usage line names every command");
|
||||||
assert.equal(fs.existsSync(pointer), false);
|
assert.equal(fs.existsSync(pointer), false);
|
||||||
// A source checkout never points every skill stub at itself.
|
// A source checkout never points every skill stub at itself.
|
||||||
|
// Each console is stopped before its assert, so a failing assert leaves no server running.
|
||||||
const fromSource = cli(["open", "--no-open"], { env });
|
const fromSource = cli(["open", "--no-open"], { env });
|
||||||
assert.equal(fs.existsSync(pointer), false, "a source checkout leaves no pointer");
|
const sourcePointer = fs.existsSync(pointer);
|
||||||
cli(["stop", "--session", fromSource.json.sid, "--force"], { env });
|
cli(["stop", "--session", fromSource.json.sid, "--force"], { env });
|
||||||
|
assert.equal(sourcePointer, false, "a source checkout leaves no pointer");
|
||||||
// An installed console (a version folder) does.
|
// An installed console (a version folder) does.
|
||||||
const installed = path.join(home, "9.9.9");
|
const installed = path.join(home, "9.9.9");
|
||||||
fs.cpSync(path.join(ROOT, "src", "web-console"), installed, { recursive: true });
|
fs.cpSync(path.join(ROOT, "src", "web-console"), installed, { recursive: true });
|
||||||
const res = spawnSync(process.execPath, [path.join(installed, "console.mjs"), "open", "--no-open"], { env: { ...ENV, ...env }, encoding: "utf8", cwd: ROOT });
|
const res = spawnSync(process.execPath, [path.join(installed, "console.mjs"), "open", "--no-open"], { env: { ...ENV, ...env }, encoding: "utf8", cwd: ROOT });
|
||||||
assert.equal(res.status, 0, res.stderr);
|
assert.equal(res.status, 0, res.stderr);
|
||||||
assert.equal(fs.readFileSync(pointer, "utf8").trim(), installed);
|
|
||||||
const sid = JSON.parse(res.stdout.trim().split(/\r?\n/)[0]).sid;
|
const sid = JSON.parse(res.stdout.trim().split(/\r?\n/)[0]).sid;
|
||||||
spawnSync(process.execPath, [path.join(installed, "console.mjs"), "stop", "--session", sid, "--force"], { env: { ...ENV, ...env }, encoding: "utf8", cwd: ROOT });
|
spawnSync(process.execPath, [path.join(installed, "console.mjs"), "stop", "--session", sid, "--force"], { env: { ...ENV, ...env }, encoding: "utf8", cwd: ROOT });
|
||||||
|
assert.equal(fs.readFileSync(pointer, "utf8").trim(), installed);
|
||||||
} finally {
|
} finally {
|
||||||
fs.rmSync(home, { recursive: true, force: true });
|
fs.rmSync(home, { recursive: true, force: true });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user