From 7a03da5536f4df4ec668261adcae6ba9bdab146c Mon Sep 17 00:00:00 2001 From: claudiahdz Date: Fri, 17 Jul 2020 17:05:34 -0500 Subject: [PATCH] test: patch child.js test --- test/child.js | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/test/child.js b/test/child.js index 9492dc9..6ec0244 100644 --- a/test/child.js +++ b/test/child.js @@ -144,15 +144,25 @@ test('runCommand with opts.command', t => { test('runCommand with opts.call and opts.shell', { skip: process.platform === 'win32' && 'Windows passes different flags to shell' }, t => { - return child.runCommand(null, { - shell: 'node', - call: './child.js', - stdio: 'pipe' - }).then(res => { - t.deepEqual(res, { - code: 0, - stdout: '', - stderr: '' + // Starting from node 12.17.x, the fact that spawn-wrap generates + // an extensionless file causes an ERR_UNKNOWN_FILE_EXTENSION error. + // Previous versions of node didn't throw. Updating nyc to 15.x.x fixes + // this, but we can't update because it breaks on Node 6 which we + // currently support. + const version = process.version.replace('v', '').split('.').map(n => +n) + if (version[0] > 12 || version[0] === 12 && version[1] >= 17) { + t.end() + } else { + return child.runCommand(null, { + shell: 'node', + call: './child.js', + stdio: 'pipe' + }).then(res => { + t.deepEqual(res, { + code: 0, + stdout: '', + stderr: '' + }) }) - }) + } })