mirror of
https://github.com/denoland/deno.git
synced 2024-11-26 16:09:27 -05:00
bundle/run handles Deno.args better. (denoland/deno_std#514)
Original: 02262c6161
This commit is contained in:
parent
684805919a
commit
a02c3bd388
2 changed files with 4 additions and 4 deletions
|
@ -64,7 +64,7 @@ fixtureModules.set("modA", {
|
||||||
});
|
});
|
||||||
|
|
||||||
test(async function loadBundle(): Promise<void> {
|
test(async function loadBundle(): Promise<void> {
|
||||||
const result = await load(["", "./bundle/testdata/bundle.js"]);
|
const result = await load(["", "./bundle/testdata/bundle.js", "--foo"]);
|
||||||
assert(result != null);
|
assert(result != null);
|
||||||
assert(
|
assert(
|
||||||
result.includes(
|
result.includes(
|
||||||
|
@ -79,7 +79,7 @@ test(async function loadBadArgs(): Promise<void> {
|
||||||
await load(["bundle/test.ts"]);
|
await load(["bundle/test.ts"]);
|
||||||
},
|
},
|
||||||
AssertionError,
|
AssertionError,
|
||||||
"Expected exactly two arguments."
|
"Expected at least two arguments."
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
import { assertStrictEq, assert } from "../testing/asserts.ts";
|
import { assert } from "../testing/asserts.ts";
|
||||||
import { exists } from "../fs/exists.ts";
|
import { exists } from "../fs/exists.ts";
|
||||||
|
|
||||||
export interface DefineFactory {
|
export interface DefineFactory {
|
||||||
|
@ -98,7 +98,7 @@ export function instantiate(
|
||||||
/** Load the bundle and return the contents asynchronously. */
|
/** Load the bundle and return the contents asynchronously. */
|
||||||
export async function load(args: string[]): Promise<string> {
|
export async function load(args: string[]): Promise<string> {
|
||||||
// TODO(kitsonk) allow loading of remote bundles via fetch.
|
// TODO(kitsonk) allow loading of remote bundles via fetch.
|
||||||
assertStrictEq(args.length, 2, "Expected exactly two arguments.");
|
assert(args.length >= 2, "Expected at least two arguments.");
|
||||||
const [, bundleFileName] = args;
|
const [, bundleFileName] = args;
|
||||||
assert(
|
assert(
|
||||||
await exists(bundleFileName),
|
await exists(bundleFileName),
|
||||||
|
|
Loading…
Reference in a new issue