test-foundation.sh and test-discord.sh ran a nested node --test that would exit 0 on failure under a parent runner. Both clear the variable now, and each has a check that fails the suite if it comes back. Darkwing wrote it, Filbert approved it (e464be6c). Nine suites green on an index export. Co-Authored-By: Claude Opus 5.5 <[email protected]>
45 lines
2.7 KiB
Diff
45 lines
2.7 KiB
Diff
diff --git a/scripts/test-discord.sh b/scripts/test-discord.sh
|
||
index 6044100c..9ec4ddda 100755
|
||
--- a/scripts/test-discord.sh
|
||
+++ b/scripts/test-discord.sh
|
||
@@ -139,7 +139,16 @@ else
|
||
fi
|
||
|
||
# --- the seven offline groups ---
|
||
-node --test --test-reporter=spec packages/discord/tests/ >"$SANDBOX/node-test.log" 2>&1
|
||
+# A nested `node --test` inherits a parent runner's NODE_TEST_CONTEXT, reports
|
||
+# to that runner and exits 0 whatever its tests do, so the suite clears it
|
||
+# (#1508 N13). The planted failing test proves a failure still fails here.
|
||
+node_tests() { env -u NODE_TEST_CONTEXT node --test "$@"; }
|
||
+mkdir -p "$SANDBOX/planted"
|
||
+printf '%s\n' 'import { test } from "node:test";' 'import assert from "node:assert/strict";' 'test("planted failure", () => assert.equal(1, 2));' >"$SANDBOX/planted/planted.test.mjs"
|
||
+NODE_TEST_CONTEXT=child-v8 node_tests "$SANDBOX/planted/" >"$SANDBOX/planted.log" 2>&1
|
||
+[ $? -eq 1 ] && grep -q '^✖ planted failure' "$SANDBOX/planted.log"
|
||
+check "a failing nested test fails the run under a parent runner's NODE_TEST_CONTEXT" $?
|
||
+node_tests --test-reporter=spec packages/discord/tests/ >"$SANDBOX/node-test.log" 2>&1
|
||
NODE_RC=$?
|
||
check "node --test packages/discord/tests/ ($(grep -E '^ℹ pass' "$SANDBOX/node-test.log" | tr -d '\n' || echo 'summary missing'))" $NODE_RC
|
||
if [ "$NODE_RC" -ne 0 ]; then
|
||
diff --git a/scripts/test-foundation.sh b/scripts/test-foundation.sh
|
||
index 251eb674..b94dab5c 100755
|
||
--- a/scripts/test-foundation.sh
|
||
+++ b/scripts/test-foundation.sh
|
||
@@ -73,7 +73,16 @@ done
|
||
check "checked-in demo bundles equal a fresh generation" $DEMO_OK
|
||
|
||
# --- unit, CLI, privacy, non-effect and fixture-index tests ---
|
||
-node --test scripts/foundation/ >"$SANDBOX/node-test.log" 2>&1
|
||
+# A nested `node --test` inherits a parent runner's NODE_TEST_CONTEXT, reports
|
||
+# to that runner and exits 0 whatever its tests do, so the suite clears it
|
||
+# (#1508 N13). The planted failing test proves a failure still fails here.
|
||
+node_tests() { env -u NODE_TEST_CONTEXT node --test "$@"; }
|
||
+mkdir -p "$SANDBOX/planted"
|
||
+printf '%s\n' 'import { test } from "node:test";' 'import assert from "node:assert/strict";' 'test("planted failure", () => assert.equal(1, 2));' >"$SANDBOX/planted/planted.test.mjs"
|
||
+NODE_TEST_CONTEXT=child-v8 node_tests "$SANDBOX/planted/" >"$SANDBOX/planted.log" 2>&1
|
||
+[ $? -eq 1 ] && grep -q '^✖ planted failure' "$SANDBOX/planted.log"
|
||
+check "a failing nested test fails the run under a parent runner's NODE_TEST_CONTEXT" $?
|
||
+node_tests scripts/foundation/ >"$SANDBOX/node-test.log" 2>&1
|
||
NODE_RC=$?
|
||
check "node --test scripts/foundation/ ($(grep -E '^ℹ pass' "$SANDBOX/node-test.log" | tr -d '\n' || echo 'summary missing'))" $NODE_RC
|
||
[ "$NODE_RC" -ne 0 ] && grep -E "^✖|AssertionError" "$SANDBOX/node-test.log" | head -20
|