Remove unused parser tests

Parser tests are not used anymore, since the parser is
now living in a separate package.
This commit is contained in:
Jakob Linskeseder
2022-10-14 13:06:51 +02:00
committed by Jay Linski
parent 69dbe65c19
commit 903ca504b5
+1 -35
View File
@@ -1,10 +1,7 @@
const childProcess = require('child_process');
const fs = require('fs');
const path = require('path');
module.exports = {
execNodeJsScriptWithInheritedOutput,
execFileWithInheritedOutput
execNodeJsScriptWithInheritedOutput
};
async function execNodeJsScriptWithInheritedOutput(command, args) {
@@ -18,34 +15,3 @@ async function execNodeJsScriptWithInheritedOutput(command, args) {
});
});
}
async function execFileWithInheritedOutput(command, args) {
return new Promise((resolve, reject) => {
const resolvedCommand = preferLocalDependencies(command);
const child = childProcess.spawn(resolvedCommand, args, {
stdio: 'inherit'
});
child.on('exit', code => {
if (code !== 0) {
reject(new Error(`Child process failed with exit-code ${code}`));
}
resolve();
});
});
}
function preferLocalDependencies(command) {
const localCandidate = resolveLocalCandidate(command);
if (fs.existsSync(localCandidate)) {
return localCandidate;
}
return command;
}
function resolveLocalCandidate(command) {
if (process.platform === 'win32') {
return path.join('node_modules', '.bin', command + '.cmd');
}
return path.join('node_modules', '.bin', command);
}