summaryrefslogtreecommitdiff
path: root/tests/wpt/runner/utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'tests/wpt/runner/utils.ts')
-rw-r--r--tests/wpt/runner/utils.ts21
1 files changed, 18 insertions, 3 deletions
diff --git a/tests/wpt/runner/utils.ts b/tests/wpt/runner/utils.ts
index 1674419cd..140c388ec 100644
--- a/tests/wpt/runner/utils.ts
+++ b/tests/wpt/runner/utils.ts
@@ -76,7 +76,10 @@ export function getManifest(): Manifest {
/// WPT TEST EXPECTATIONS
-const EXPECTATION_PATH = join(ROOT_PATH, "./tests/wpt/runner/expectation.json");
+export const EXPECTATION_PATH = join(
+ ROOT_PATH,
+ "./tests/wpt/runner/expectation.json",
+);
export interface Expectation {
[key: string]: Expectation | boolean | string[] | { ignore: boolean };
@@ -87,9 +90,12 @@ export function getExpectation(): Expectation {
return JSON.parse(expectationText);
}
-export function saveExpectation(expectation: Expectation) {
+export function saveExpectation(
+ expectation: Expectation,
+ path: string = EXPECTATION_PATH,
+) {
Deno.writeTextFileSync(
- EXPECTATION_PATH,
+ path,
JSON.stringify(expectation, undefined, " ") + "\n",
);
}
@@ -134,6 +140,15 @@ export function runPy<T extends Omit<Deno.CommandOptions, "cwd">>(
}).spawn();
}
+export async function runGitDiff(args: string[]): string {
+ await new Deno.Command("git", {
+ args: ["diff", ...args],
+ stdout: "inherit",
+ stderr: "inherit",
+ cwd: ROOT_PATH,
+ }).output();
+}
+
export async function checkPy3Available() {
const { success, stdout } = await runPy(["--version"], {
stdout: "piped",