-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
99aa73a
commit 24e0a24
Showing
8 changed files
with
114 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env -S deno run --allow-read --allow-write | ||
import { walk } from "jsr:@std/fs/walk"; | ||
|
||
import init, { format } from "../pkg/biome_fmt.js"; | ||
|
||
await init(); | ||
|
||
const test_root = new URL(import.meta.resolve("../test_data")); | ||
|
||
for await (const entry of walk(test_root, { | ||
includeDirs: false, | ||
exts: ["html", "vue", "json", "tsx"], | ||
})) { | ||
if (entry.name.startsWith(".")) { | ||
continue; | ||
} | ||
|
||
const expect_path = entry.path + ".snap"; | ||
const input = Deno.readTextFileSync(entry.path); | ||
|
||
const actual = format(input, entry.path); | ||
Deno.writeTextFileSync(expect_path, actual); | ||
} | ||
console.log("done"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
import init, { format } from "../pkg/biome_fmt.js"; | ||
import { assertEquals } from "jsr:@std/assert"; | ||
import { walk } from "jsr:@std/fs/walk"; | ||
|
||
import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts"; | ||
import { walk } from "https://deno.land/[email protected]/fs/walk.ts"; | ||
import { relative } from "https://deno.land/[email protected]/path/mod.ts"; | ||
import init, { format } from "../pkg/biome_fmt.js"; | ||
|
||
await init(); | ||
|
||
const update = Deno.args.includes("--update"); | ||
|
||
const test_root = new URL("../test_data", import.meta.url); | ||
const test_root = new URL(import.meta.resolve("../test_data")); | ||
|
||
for await (const entry of walk(test_root, { | ||
includeDirs: false, | ||
|
@@ -18,18 +15,14 @@ for await (const entry of walk(test_root, { | |
continue; | ||
} | ||
|
||
const input = Deno.readTextFileSync(entry.path); | ||
const input_path = entry.path; | ||
const expect_path = input_path + ".snap"; | ||
|
||
if (update) { | ||
const actual = format(input, entry.name); | ||
Deno.writeTextFileSync(entry.path + ".snap", actual); | ||
} else { | ||
const test_name = relative(test_root.pathname, entry.path); | ||
const expected = Deno.readTextFileSync(entry.path + ".snap"); | ||
const input = Deno.readTextFileSync(input_path); | ||
const expected = Deno.readTextFileSync(expect_path); | ||
|
||
Deno.test(test_name, () => { | ||
const actual = format(input, entry.name); | ||
assertEquals(actual, expected); | ||
}); | ||
} | ||
Deno.test(input_path, () => { | ||
const actual = format(input, entry.path); | ||
assertEquals(actual, expected); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env -S deno run --allow-read --allow-write | ||
import { walk } from "jsr:@std/fs/walk"; | ||
|
||
import init, { format } from "../pkg/web_fmt.js"; | ||
|
||
await init(); | ||
|
||
const test_root = new URL(import.meta.resolve("../test_data")); | ||
|
||
for await (const entry of walk(test_root, { | ||
includeDirs: false, | ||
exts: ["html", "vue", "json", "tsx"], | ||
})) { | ||
if (entry.name.startsWith(".")) { | ||
continue; | ||
} | ||
|
||
const expect_path = entry.path + ".snap"; | ||
const input = Deno.readTextFileSync(entry.path); | ||
|
||
const actual = format(input, entry.path); | ||
Deno.writeTextFileSync(expect_path, actual); | ||
} | ||
console.log("done"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
import init, { format } from "../pkg/web_fmt.js"; | ||
import { assertEquals } from "jsr:@std/assert"; | ||
import { walk } from "jsr:@std/fs/walk"; | ||
|
||
import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts"; | ||
import { walk } from "https://deno.land/[email protected]/fs/walk.ts"; | ||
import { relative } from "https://deno.land/[email protected]/path/mod.ts"; | ||
import init, { format } from "../pkg/web_fmt.js"; | ||
|
||
await init(); | ||
|
||
const update = Deno.args.includes("--update"); | ||
|
||
const test_root = new URL("../test_data", import.meta.url); | ||
const test_root = new URL(import.meta.resolve("../test_data")); | ||
|
||
for await (const entry of walk(test_root, { | ||
includeDirs: false, | ||
|
@@ -18,18 +15,14 @@ for await (const entry of walk(test_root, { | |
continue; | ||
} | ||
|
||
const input = Deno.readTextFileSync(entry.path); | ||
const input_path = entry.path; | ||
const expect_path = input_path + ".snap"; | ||
|
||
if (update) { | ||
const actual = format(input, entry.name); | ||
Deno.writeTextFileSync(entry.path + ".snap", actual); | ||
} else { | ||
const test_name = relative(test_root.pathname, entry.path); | ||
const expected = Deno.readTextFileSync(entry.path + ".snap"); | ||
const input = Deno.readTextFileSync(input_path); | ||
const expected = Deno.readTextFileSync(expect_path); | ||
|
||
Deno.test(test_name, () => { | ||
const actual = format(input, entry.name); | ||
assertEquals(actual, expected); | ||
}); | ||
} | ||
Deno.test(input_path, () => { | ||
const actual = format(input, entry.path); | ||
assertEquals(actual, expected); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters