Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(test-runner): add import into try/catch and show error and stack … #1615

Merged
merged 3 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
...
}: let
# this change on each change of dependencies, unfortunately this hash not yet automatically updated from SRI of package.lock
npmDepsHash = "sha256-zJZeKIwYJF2JAeBPTyMgbxZkKR4t2hMQyzu/m3PDDAE=";
npmDepsHash = "sha256-ruo1UWlwlKxhfh7/PWgYSakFhe8Q8Q+9bg7uPDqnLNI=";
####

# there is officia polkadot on nixpkgs, but it has no local rococo wasm to run
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import { NetworkNode } from "../networkNode";
import { FnArgs } from "../types";
const utilCrypto = require("@polkadot/util-crypto");

const debug = require("debug")("zombie::test-runner");

const DEFAULT_INDIVIDUAL_TEST_TIMEOUT = 10; // seconds

// helper
Expand Down Expand Up @@ -296,10 +298,12 @@ const CustomJs = ({
connect,
registerParachain,
};
const jsScript = await import(resolvedJsFilePath);

let values;
try {
// import user defined code
const jsScript = await import(resolvedJsFilePath);

const resp: any = await Promise.race([
Promise.all(
nodes.map((node: any) =>
Expand All @@ -323,6 +327,8 @@ const CustomJs = ({
`Error running script: ${file_path!}`,
)} \t ${decorators.bright(err.message)}\n`,
);

debug(err.stack || "can't print the stack");
throw new Error(err);
}

Expand Down
Loading