()
| 27 | * @returns {{ id: string, input: string }[]} every input (handles the `stylesheet_bytes` shape) |
| 28 | */ |
| 29 | const loadCases = () => { |
| 30 | const cases = []; |
| 31 | for (const file of fs.readdirSync(casesDir)) { |
| 32 | if (!file.endsWith(".json")) continue; |
| 33 | const data = JSON.parse(fs.readFileSync(path.join(casesDir, file), "utf8")); |
| 34 | let index = 0; |
| 35 | // The suite is a flat [input, expected, …] array; inputs are even-indexed. |
| 36 | for (const [i, value] of data.entries()) { |
| 37 | if (i % 2 !== 0) continue; |
| 38 | let input; |
| 39 | if (typeof value === "string") { |
| 40 | input = value; |
| 41 | } else if (value && typeof value.css_bytes === "string") { |
| 42 | input = value.css_bytes; |
| 43 | } else { |
| 44 | continue; |
| 45 | } |
| 46 | cases.push({ id: `${file} #${index}`, input }); |
| 47 | index++; |
| 48 | } |
| 49 | } |
| 50 | return cases; |
| 51 | }; |
| 52 | |
| 53 | /** |
| 54 | * Compile a batch of inputs as separate CSS entries in one compilation. |
no test coverage detected