|
1 | | -import * as path from "@std/path"; |
2 | 1 | import { expect } from "@std/expect"; |
3 | 2 |
|
4 | 3 | Deno.test("JSX precompile - check config", async () => { |
5 | | - const cwd = path.join(import.meta.dirname!, "fixture_precompile", "invalid"); |
6 | | - const output = await new Deno.Command(Deno.execPath(), { |
7 | | - args: [ |
8 | | - "run", |
9 | | - "-A", |
10 | | - path.join(cwd, "dev.ts"), |
11 | | - ], |
12 | | - cwd, |
| 4 | + const { stderr, success } = await new Deno.Command(Deno.execPath(), { |
| 5 | + args: ["run", "-A", "dev.ts"], |
| 6 | + cwd: new URL("./fixture_precompile/invalid", import.meta.url), |
13 | 7 | }).output(); |
14 | 8 |
|
15 | | - const stderr = new TextDecoder().decode(output.stderr); |
16 | | - expect(stderr).toContain("jsxPrecompileSkipElements to contain"); |
17 | | - expect(output.code).toEqual(1); |
| 9 | + const stderrText = new TextDecoder().decode(stderr); |
| 10 | + expect(stderrText).toContain("jsxPrecompileSkipElements to contain"); |
| 11 | + expect(success).toEqual(false); |
18 | 12 | }); |
19 | 13 |
|
20 | 14 | Deno.test("JSX precompile - run vnode hooks", async () => { |
21 | | - const cwd = path.join(import.meta.dirname!, "fixture_precompile", "valid"); |
22 | | - const output = await new Deno.Command(Deno.execPath(), { |
23 | | - args: [ |
24 | | - "run", |
25 | | - "-A", |
26 | | - path.join(cwd, "main.tsx"), |
27 | | - ], |
28 | | - cwd, |
| 15 | + const { stdout, success } = await new Deno.Command(Deno.execPath(), { |
| 16 | + args: ["run", "-A", "main.tsx"], |
| 17 | + cwd: new URL("./fixture_precompile/valid", import.meta.url), |
29 | 18 | }).output(); |
30 | 19 |
|
31 | | - const stdout = new TextDecoder().decode(output.stdout); |
32 | | - expect(stdout).toContain('<img src="/foo.jpg?__frsh_c='); |
33 | | - expect(stdout).toContain('<source src="/bar.jpg?__frsh_c='); |
34 | | - expect(stdout).toContain('<div f-client-nav="true">'); |
35 | | - expect(stdout).toContain('<span f-client-nav="false">'); |
36 | | - expect(output.code).toEqual(0); |
| 20 | + const stdoutText = new TextDecoder().decode(stdout); |
| 21 | + expect(stdoutText).toContain('<img src="/foo.jpg?__frsh_c='); |
| 22 | + expect(stdoutText).toContain('<source src="/bar.jpg?__frsh_c='); |
| 23 | + expect(stdoutText).toContain('<div f-client-nav="true">'); |
| 24 | + expect(stdoutText).toContain('<span f-client-nav="false">'); |
| 25 | + expect(success).toEqual(true); |
37 | 26 | }); |
0 commit comments