Skip to content

Commit

Permalink
fix: correct mainModule code (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret authored Feb 11, 2024
1 parent a1ce30e commit beb8dff
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
12 changes: 12 additions & 0 deletions packages/shim-deno/src/deno/stable/variables/mainModule.test.ts
Original file line number Diff line number Diff line change
@@ -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());
});
2 changes: 1 addition & 1 deletion packages/shim-deno/src/deno/stable/variables/mainModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
1 change: 1 addition & 0 deletions packages/shim-deno/tools/working_test_files.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit beb8dff

Please sign in to comment.