From 4a067d6145125175439a0f3dca6e540e7f255d72 Mon Sep 17 00:00:00 2001 From: Taisia Pitko Date: Fri, 10 Nov 2023 13:36:29 +0300 Subject: [PATCH] [patch] fix reruning only prefiltered (#20) --- src/bin/cy-grep.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/bin/cy-grep.js b/src/bin/cy-grep.js index 8fed775..35b6b9d 100644 --- a/src/bin/cy-grep.js +++ b/src/bin/cy-grep.js @@ -190,16 +190,19 @@ try { if (existsSync(prefilterFile)) { // run all tests from prefiltered file or all console.log(`${packagename} Will run tests from ${prefilterFile}`); + const existingGrep = grep; - if (!grep) { - try { - // update grep from prefiltered file - grep = JSON.parse(readFileSync(prefilterFile)).grep; - grepExpression = getGrepEnvVariableStr(grep); - } catch (e) { - console.log(`${packagename} Could not read/parse ${prefilterFile}: ${e.message}`); - } + try { + // update grep from prefiltered file + grep = JSON.parse(readFileSync(prefilterFile)).grep; + } catch (e) { + console.log(`${packagename} Could not read/parse ${prefilterFile}: ${e.message}`); } + + if (existingGrep) { + grep = `(${grep}&(${existingGrep}))`; + } + grepExpression = getGrepEnvVariableStr(grep); } else { resultsFileEnvVariableStr = ''; console.log(