diff options
Diffstat (limited to 'tests/node_compat/runner.ts')
-rw-r--r-- | tests/node_compat/runner.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/node_compat/runner.ts b/tests/node_compat/runner.ts new file mode 100644 index 000000000..4695037cc --- /dev/null +++ b/tests/node_compat/runner.ts @@ -0,0 +1,14 @@ +// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +import "./polyfill_globals.js"; +import { createRequire } from "node:module"; +import { toFileUrl } from "@test_util/std/path/mod.ts"; +const file = Deno.args[0]; +if (!file) { + throw new Error("No file provided"); +} + +if (file.endsWith(".mjs")) { + await import(toFileUrl(file).href); +} else { + createRequire(import.meta.url)(file); +} |