From b5254e973b9e278c708f3a3e6642e1006c77147a Mon Sep 17 00:00:00 2001 From: Clement Denis Date: Thu, 11 Mar 2021 02:12:03 +0000 Subject: [PATCH] crash on file notfound instead of comparing strings --- js/tests/tell-it-cypher_test.mjs | 5 ++--- js/tests/tell-me-vip_test.mjs | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/js/tests/tell-it-cypher_test.mjs b/js/tests/tell-it-cypher_test.mjs index b4bb14805..33aa48078 100644 --- a/js/tests/tell-it-cypher_test.mjs +++ b/js/tests/tell-it-cypher_test.mjs @@ -20,9 +20,8 @@ export const setup = async ({ path }) => { ) const newFileName = newFile || (keyword === 'encode' ? 'cypher.txt' : 'clear.txt') - const fileContent = await readFile(newFileName, 'utf8').catch((err) => - err.code === 'ENOENT' ? 'output file not found' : err, - ) + const fileContent = await readFile(newFileName, 'utf8') + return { data: fileContent } } diff --git a/js/tests/tell-me-vip_test.mjs b/js/tests/tell-me-vip_test.mjs index 3f3bd2003..4f3778ee6 100644 --- a/js/tests/tell-me-vip_test.mjs +++ b/js/tests/tell-me-vip_test.mjs @@ -22,9 +22,8 @@ export const setup = async ({ path }) => { const run = async cmd => { const cmdPath = isAbsolute(cmd) ? cmd : join(dir, cmd) const { stdout } = await exec(`node ${path} ${cmdPath}`) - const fileContent = await readFile(`vip.txt`, 'utf8').catch(err => - err.code === 'ENOENT' ? 'output file not found' : err, - ) + const fileContent = await readFile(`vip.txt`, 'utf8') + return { data: fileContent } }