mirror of
https://github.com/morluto/rea.git
synced 2026-10-12 02:19:24 +00:00
fix(deps): run freshness check from escaped paths
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const REMEDIATION = "Run `npm ci`, then retry.";
|
||||
|
||||
@@ -57,4 +58,4 @@ const main = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
if (process.argv[1] === new URL(import.meta.url).pathname) await main();
|
||||
if (process.argv[1] === fileURLToPath(import.meta.url)) await main();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mkdtemp, mkdir, rm, writeFile } from "node:fs/promises";
|
||||
import { copyFile, mkdtemp, mkdir, rm, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { spawnSync } from "node:child_process";
|
||||
@@ -79,4 +79,20 @@ describe("dependency install freshness", () => {
|
||||
);
|
||||
expect(result.stderr.match(/npm ci/gu)).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("runs from a script path containing URL-escaped characters", async () => {
|
||||
const root = await fixture("0.9.0");
|
||||
const scriptDirectory = join(root, "path with spaces");
|
||||
const copiedScript = join(scriptDirectory, "check-dependency-install.mjs");
|
||||
await mkdir(scriptDirectory);
|
||||
await copyFile(script, copiedScript);
|
||||
|
||||
const result = spawnSync(process.execPath, [copiedScript], {
|
||||
cwd: root,
|
||||
encoding: "utf8",
|
||||
});
|
||||
|
||||
expect(result.status).toBe(1);
|
||||
expect(result.stderr).toContain("alpha: installed 0.9.0, expected 1.0.0");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user