Test babel-cli --source-maps and errors (#5377)

This commit is contained in:
Aaron Ang
2017-02-25 00:13:22 -08:00
committed by Logan Smyth
parent 9aec4ad159
commit dad55ef1d6
35 changed files with 71 additions and 24 deletions

View File

@@ -162,20 +162,20 @@ export default function parseArgv(args: Array<string>) {
filenames.forEach(function(filename) {
if (!fs.existsSync(filename)) {
errors.push(filename + " doesn't exist");
errors.push(filename + " does not exist");
}
});
if (commander.outDir && !filenames.length) {
errors.push("filenames required for --out-dir");
errors.push("--out-dir requires filenames");
}
if (commander.outFile && commander.outDir) {
errors.push("cannot have --out-file and --out-dir");
errors.push("--out-file and --out-dir cannot be used together");
}
if (commander.relative && !commander.outDir) {
errors.push("output directory required for --relative");
errors.push("--relative requires --out-dir usage");
}
if (commander.watch) {
@@ -207,7 +207,10 @@ export default function parseArgv(args: Array<string>) {
}
if (errors.length) {
console.error(errors.join(". "));
console.error("babel:");
errors.forEach(function (e) {
console.error(" " + e);
});
process.exit(2);
}