Skip to content

Commit

Permalink
[Tests] filter out npm warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Dec 10, 2021
1 parent 56ca7ad commit 2627cfa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/index.js
Expand Up @@ -16,7 +16,11 @@ test('fix option', (t) => {
t.ok(error, 'errors');
t.ok(error.message.startsWith('Command failed: '), 'expected error message');
t.equal(error.code, 1, 'error code is 1');
t.match(String(error).split('\n')[1], /^npm ERR! code (EAUDITNOLOCK|ENOLOCK)$/, 'error message has EAUDITNOLOCK or ENOLOCK');
t.match(
String(error).split('\n').filter((x) => !(/^npm WARN npm npm does not support Node.js /).test(x))[1],
/^npm ERR! code (EAUDITNOLOCK|ENOLOCK)$/,
'error message has EAUDITNOLOCK or ENOLOCK'
);
t.equal(stdout, '', 'no stdout output');
t.match(stderr.split('\n')[0], /^npm ERR! code (EAUDITNOLOCK|ENOLOCK)$/, 'stderr starts with expected error code');
});
Expand Down

0 comments on commit 2627cfa

Please sign in to comment.