diff --git a/deno.json b/deno.json index 7f15e9987..03923ed9f 100644 --- a/deno.json +++ b/deno.json @@ -2,7 +2,7 @@ "lock": false, "tasks": { "test": "deno test --allow-run=deno", - "test:node": "deno task build:npm 0.0.0 && node test/main/node.mjs", + "test:node": "deno task build:npm 0.0.0 && node test/main/node.mjs hello world", "build:npm": "deno run -A tasks/build-npm.ts" }, "lint": { diff --git a/lib/main.ts b/lib/main.ts index b95a09d09..7c024b126 100644 --- a/lib/main.ts +++ b/lib/main.ts @@ -86,7 +86,7 @@ export async function main( //@ts-expect-error type-checked by Deno, run on Node process.on("SIGINT", interrupt); //@ts-expect-error type-checked by Deno, run on Node - yield* body(global.process.argv.slice()); + yield* body(global.process.argv.slice(2)); } finally { //@ts-expect-error this runs on Node process.off("SIGINT", interrupt); diff --git a/test/main/node.mjs b/test/main/node.mjs index 18de7ca20..64767e7da 100644 --- a/test/main/node.mjs +++ b/test/main/node.mjs @@ -1,5 +1,8 @@ import { main } from "../../build/npm/esm/mod.js"; -await main(function* () { +await main(function* ([hello, world]) { + if (hello !== "hello" && world !== "world") { + throw new Error("arguments were not properly passed to main operation"); + } console.log("hello world"); });