Skip to content

Commit

Permalink
prescript errors halt runs
Browse files Browse the repository at this point in the history
  • Loading branch information
timbrinded committed Nov 14, 2024
1 parent d676ba3 commit 9b557fd
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .changeset/olive-lions-enjoy.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
---

November Update
- [[#435](https://github.com/Moonsong-Labs/moonwall/issues/435)] Zombienets dont require parachains anymore
- [[#435](https://github.com/Moonsong-Labs/moonwall/issues/435)] Zombienets dont require parachains anymore
- [[#408](https://github.com/Moonsong-Labs/moonwall/issues/408)] preScript failures halt test runs
7 changes: 3 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,9 @@ jobs:
cd test
bun moonwall download moonbeam latest ./tmp
# Change these to latest once MB is compatible with 1.2.0
bun moonwall download polkadot 1.8.0 ./tmp
bun moonwall download polkadot-execute-worker 1.8.0 ./tmp
bun moonwall download polkadot-prepare-worker 1.8.0 ./tmp
bun moonwall download polkadot stable2407 ./tmp
bun moonwall download polkadot-execute-worker stable2407 ./tmp
bun moonwall download polkadot-prepare-worker stable2407 ./tmp
- name: Run ${{matrix.suite}}
run: |
cd test
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/cmds/runTests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Environment } from "@moonwall/types";
import chalk from "chalk";
import path from "node:path";
import type { UserConfig, Vitest } from "vitest";
import type { UserConfig, Vitest } from "vitest/node";
import { startVitest } from "vitest/node";
import { clearNodeLogs } from "../internal/cmdFunctions/tempLogs";
import { commonChecks } from "../internal/launcherCommon";
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/internal/launcherCommon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ export async function executeScript(scriptCommand: string, args?: string) {
default:
console.log(`${ext} not supported, skipping ${script}`);
}
} catch (err) {
} catch (err: any) {
console.error(`Error executing script: ${chalk.bgGrey.redBright(err)}`);
throw new Error(err);
}
}
1 change: 0 additions & 1 deletion packages/cli/src/lib/globalContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ export class MoonwallContext {
process.env.MOON_RELAY_WSS = network.relay[0].wsUri;

if (Object.entries(network.paras).length > 0) {
console.dir(network.paras, { depth: null });
process.env.MOON_PARA_WSS = Object.values(network.paras)[0].nodes[0].wsUri;
}

Expand Down
14 changes: 14 additions & 0 deletions test/moonwall.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,19 @@
]
}
},
{
"name": "failing_prescript",
"testFileDir": ["suites/basic"],
"description": "Test that failing pre-scripts are caught",
"runScripts": ["failing-script.ts"],
"foundation": {
"type": "read_only",
"launchSpec": {
"disableRuntimeVersionCheck": true
}
},
"connections": []
},
{
"name": "dev_tanssi",
"testFileDir": ["suites/tanssi"],
Expand Down Expand Up @@ -186,6 +199,7 @@
}
}
},

{
"name": "para_test",
"testFileDir": ["suites/zombie"],
Expand Down
3 changes: 3 additions & 0 deletions test/scripts/failing-script.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
console.log("This script will fail on purpose.")

process.exit(1)

0 comments on commit 9b557fd

Please sign in to comment.