From 09254410eabc232a664e96f6480a3b63eec4e2e0 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 5 Aug 2020 16:27:06 -0400 Subject: [PATCH] FIX: Only raise proper `"error"` messages Also support "1" for `QUNIT_FAIL_FAST` to make it consistent with other arguments. --- app/assets/javascripts/discourse/app/lib/ajax.js | 2 +- test/run-qunit.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/app/lib/ajax.js b/app/assets/javascripts/discourse/app/lib/ajax.js index 45059a60750..c08a29d87ba 100644 --- a/app/assets/javascripts/discourse/app/lib/ajax.js +++ b/app/assets/javascripts/discourse/app/lib/ajax.js @@ -121,7 +121,7 @@ export function ajax() { // 0 represents the `UNSENT` state if (xhr.readyState === 0) { // Make sure we log pretender errors in test mode - if (isTesting()) { + if (textStatus === "error" && isTesting()) { throw errorThrown; } return; diff --git a/test/run-qunit.js b/test/run-qunit.js index 14e9046de44..90a9eb2cd34 100644 --- a/test/run-qunit.js +++ b/test/run-qunit.js @@ -109,10 +109,11 @@ async function runAllTests() { Page.navigate({ url: args[0] }); Page.loadEventFired(async () => { + let qff = process.env.QUNIT_FAIL_FAST; await Runtime.evaluate({ expression: `const QUNIT_FAIL_FAST = ` + - (process.env.QUNIT_FAIL_FAST === "true").toString() + + (qff === "1" || qff === "true").toString() + ";" }); await Runtime.evaluate({ @@ -262,7 +263,7 @@ function logQUnit() { if (context.failed) { console.log("\nUse this filter to run in the same order:"); console.log( - "QUNIT_FAIL_FAST=true QUNIT_SEED=" + + "QUNIT_FAIL_FAST=1 QUNIT_SEED=" + QUnit.config.seed + " rake qunit:test\n" );