summaryrefslogtreecommitdiff
path: root/cli/tests/node_compat/test/parallel/test-module-run-main.js
blob: 8e30de267189c68eb3c381933e4a94db7086fc26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// deno-fmt-ignore-file
// deno-lint-ignore-file

"use strict";

const Module = require("module");
const assert = require("assert/strict");
const path = require("path");

const file = path.join(__dirname, "..", "fixtures", "run-main.js");
process.argv = [process.argv[0], file];
Module.runMain();

// The required file via `Module.runMain()` sets this global
assert.equal(globalThis.foo, 42);