| 295 | const snapshotName = "snapshot"; |
| 296 | |
| 297 | async function runTest(test: string) { |
| 298 | const tempTestFileName = "test.ts"; |
| 299 | const tempTestFilePath = join(tempDir, tempTestFileName); |
| 300 | await Deno.writeTextFile(tempTestFilePath, test); |
| 301 | |
| 302 | const process = new Deno.Command(Deno.execPath(), { |
| 303 | args: [ |
| 304 | "test", |
| 305 | "--no-lock", |
| 306 | "--allow-all", |
| 307 | tempTestFilePath, |
| 308 | "--", |
| 309 | "-u", |
| 310 | ], |
| 311 | stdout: "piped", |
| 312 | stderr: "piped", |
| 313 | }); |
| 314 | const { stdout, stderr } = await process.output(); |
| 315 | |
| 316 | return { |
| 317 | output: new TextDecoder().decode(stdout), |
| 318 | error: new TextDecoder().decode(stderr), |
| 319 | }; |
| 320 | } |
| 321 | |
| 322 | const result = await runTest(` |
| 323 | import { assertSnapshot } from "${SNAPSHOT_MODULE_URL}"; |