diff --git a/packages/shim-deno/src/deno/stable/variables/mainModule.test.ts b/packages/shim-deno/src/deno/stable/variables/mainModule.test.ts new file mode 100644 index 0000000..7723e0c --- /dev/null +++ b/packages/shim-deno/src/deno/stable/variables/mainModule.test.ts @@ -0,0 +1,12 @@ +import assert from "assert/strict"; +import { fileURLToPath, pathToFileURL } from "url"; +import { join, resolve } from "path"; + +import { mainModule } from "./mainModule.js"; + +Deno.test("should get entrypoint", () => { + const path = resolve( + join(fileURLToPath(import.meta.url), "../../../../../tools/run_tests.mjs"), + ); + assert.equal(mainModule, pathToFileURL(path).toString()); +}); diff --git a/packages/shim-deno/src/deno/stable/variables/mainModule.ts b/packages/shim-deno/src/deno/stable/variables/mainModule.ts index 83868b7..4746786 100644 --- a/packages/shim-deno/src/deno/stable/variables/mainModule.ts +++ b/packages/shim-deno/src/deno/stable/variables/mainModule.ts @@ -3,5 +3,5 @@ import { join } from "path"; import { pathToFileURL } from "url"; export const mainModule: typeof Deno.mainModule = pathToFileURL( - process.argv[1] ?? join(Deno.cwd(), "$deno$repl.ts"), + process.argv[1] ?? join(process.cwd(), "$deno$repl.ts"), ).href; diff --git a/packages/shim-deno/tools/working_test_files.txt b/packages/shim-deno/tools/working_test_files.txt index ce0cbe5..823d11d 100644 --- a/packages/shim-deno/tools/working_test_files.txt +++ b/packages/shim-deno/tools/working_test_files.txt @@ -2,6 +2,7 @@ src/deno/internal/streams.test.ts src/deno/stable/functions/open.test.ts src/deno/stable/functions/resolveDns.test.ts src/deno/stable/functions/run.test.ts +src/deno/stable/variables/mainModule.test.ts third_party/deno/cli/tests/unit/abort_controller_test.ts third_party/deno/cli/tests/unit/blob_test.ts third_party/deno/cli/tests/unit/build_test.ts