summaryrefslogtreecommitdiff
path: root/flags/tests/stop_early.ts
blob: ca64bf97ecbd7cd7a2ea1b9b98b48df220aaf337 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { test, assertEqual } from "../../testing/mod.ts";
import { parse } from "../index.ts";

// stops parsing on the first non-option when stopEarly is set
test(function stopParsing() {
  const argv = parse(["--aaa", "bbb", "ccc", "--ddd"], {
    stopEarly: true
  });

  assertEqual(argv, {
    aaa: "bbb",
    _: ["ccc", "--ddd"]
  });
});