From 75c1448e46a940402d825a2865e97c7d941aee1c Mon Sep 17 00:00:00 2001 From: liuxingbaoyu <30521560+liuxingbaoyu@users.noreply.github.com> Date: Fri, 27 May 2022 17:25:49 +0800 Subject: [PATCH] improve --- packages/babel-parser/test/helpers/run-fixture-tests.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/babel-parser/test/helpers/run-fixture-tests.js b/packages/babel-parser/test/helpers/run-fixture-tests.js index 345509b87a59..8d247a5fb54b 100644 --- a/packages/babel-parser/test/helpers/run-fixture-tests.js +++ b/packages/babel-parser/test/helpers/run-fixture-tests.js @@ -86,7 +86,7 @@ const toJustErrors = result => ({ function runParseTest(parse, test, onlyCompareErrors) { const { adjust, expected, source, filename, options } = test; - if (expected.threw && expected.ast) { + if (!OVERWRITE && expected.threw && expected.ast) { throw Error( "File expected.json exists although options specify throws. Remove expected.json.", ); @@ -140,7 +140,7 @@ function runParseTest(parse, test, onlyCompareErrors) { // otherwise remove it. if (Object.keys(newOptions).length <= 0) { rmf(optionsLocation); - } else if (throws) { + } else if (throws !== expectedThrows) { // The idea here is that we shouldn't need to change anything if this doesn't // throw, and stringify will produce different output than what prettier // wants.