Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
@@ -0,0 +1,49 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { runLighthouse } from "./run-lighthouse.mjs";
|
||||
|
||||
function createStream() {
|
||||
let output = "";
|
||||
return {
|
||||
stream: { write: (chunk) => { output += chunk; } },
|
||||
get output() {
|
||||
return output;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
describe("run-lighthouse", () => {
|
||||
it("skips cleanly when npx is unavailable", () => {
|
||||
const stdout = createStream();
|
||||
const exitCode = runLighthouse({
|
||||
spawn: () => ({ error: { code: "ENOENT" }, stdout: "", stderr: "", status: null }),
|
||||
stdout: stdout.stream,
|
||||
stderr: createStream().stream,
|
||||
});
|
||||
|
||||
expect(exitCode).toBe(0);
|
||||
expect(stdout.output).toContain("SKIP lhci not installable");
|
||||
});
|
||||
|
||||
it("skips cleanly when Chrome is unavailable", () => {
|
||||
const stdout = createStream();
|
||||
const exitCode = runLighthouse({
|
||||
spawn: () => ({ stdout: "Chrome installation not found\nHealthcheck failed!\n", stderr: "", status: 1 }),
|
||||
stdout: stdout.stream,
|
||||
stderr: createStream().stream,
|
||||
});
|
||||
|
||||
expect(exitCode).toBe(0);
|
||||
expect(stdout.output).toContain("SKIP Chrome not installed");
|
||||
});
|
||||
|
||||
it("returns the lhci exit status for real failures", () => {
|
||||
const exitCode = runLighthouse({
|
||||
spawn: () => ({ stdout: "assertion failed\n", stderr: "", status: 1 }),
|
||||
stdout: createStream().stream,
|
||||
stderr: createStream().stream,
|
||||
});
|
||||
|
||||
expect(exitCode).toBe(1);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user