diff --git a/packages/babel-cli/src/babel/options.js b/packages/babel-cli/src/babel/options.js index 6e4dfeaed2d4..9fc6f1a640c5 100644 --- a/packages/babel-cli/src/babel/options.js +++ b/packages/babel-cli/src/babel/options.js @@ -140,6 +140,7 @@ commander.option( "--relative", "Compile into an output directory relative to input directory or file. Requires --out-dir [out]", ); + commander.option( "-D, --copy-files", "When compiling a directory copy over non-compilable files.", @@ -148,6 +149,11 @@ commander.option( "--include-dotfiles", "Include dotfiles when compiling and copying non-compilable files.", ); +commander.option( + "--no-copy-ignored", + "Exclude ignored files when copying non-compilable files.", +); + commander.option( "--verbose", "Log everything. This option conflicts with --quiet", @@ -165,11 +171,6 @@ commander.option( "Use a specific extension for the output files", ); -commander.option( - "--copy-ignored", - "Include ignored files when copying non-compilable files.", -); - commander.version(pkg.version + " (@babel/core " + version + ")"); commander.usage("[options] "); // register an empty action handler so that commander.js can throw on @@ -315,12 +316,12 @@ export default function parseArgv(args: Array): CmdOptions | null { outDir: opts.outDir, relative: opts.relative, copyFiles: opts.copyFiles, + copyIgnored: opts.copyFiles && opts.copyIgnored, includeDotfiles: opts.includeDotfiles, verbose: opts.verbose, quiet: opts.quiet, deleteDirOnStart: opts.deleteDirOnStart, sourceMapTarget: opts.sourceMapTarget, - copyIgnored: opts.copyIgnored, }, }; } diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/out-files/lib/foo/.foo.js b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/out-files/lib/foo/.foo.js new file mode 100644 index 000000000000..31142aabfe70 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/out-files/lib/foo/.foo.js @@ -0,0 +1 @@ +a; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/in-files/src/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/out-files/lib/foo/index.js similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/in-files/src/foo/bar.js rename to packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/out-files/lib/foo/index.js diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore/out-files/lib/foo/.foo.js b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore/out-files/lib/foo/.foo.js new file mode 100644 index 000000000000..31142aabfe70 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore/out-files/lib/foo/.foo.js @@ -0,0 +1 @@ +a; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/out-files/lib/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore/out-files/lib/foo/index.js similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/out-files/lib/foo/bar.js rename to packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore/out-files/lib/foo/index.js diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/in-files/src/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with only/out-files/lib/index.js similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/in-files/src/index.js rename to packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with only/out-files/lib/index.js diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles/out-files/lib/foo/foo.js b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles/out-files/lib/foo/foo.js index e69de29bb2d1..3918c74e4463 100644 --- a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles/out-files/lib/foo/foo.js +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles/out-files/lib/foo/foo.js @@ -0,0 +1 @@ +"use strict"; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/.babelignore b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/.babelignore similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/.babelignore rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/.babelignore diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/in-files/src/.foorc b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/in-files/src/.foorc similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/in-files/src/.foorc rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/in-files/src/.foorc diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/in-files/src/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/in-files/src/README.md similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/in-files/src/README.md rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/in-files/src/README.md diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/in-files/src/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/in-files/src/foo/bar.js similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/in-files/src/foo/bar.js rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/in-files/src/foo/bar.js diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/in-files/src/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/in-files/src/index.js similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/in-files/src/index.js rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/in-files/src/index.js diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/options.json b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/options.json similarity index 79% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/options.json rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/options.json index d16d70e6ffec..4b73dd790e1f 100644 --- a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/options.json +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/options.json @@ -4,7 +4,7 @@ "--out-dir", "lib", "--copy-files", - "--copy-ignored", + "--no-copy-ignored", "--verbose" ] } diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/out-files/lib/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/out-files/lib/README.md similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/out-files/lib/README.md rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/out-files/lib/README.md diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/out-files/lib/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/out-files/lib/index.js similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/out-files/lib/index.js rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/out-files/lib/index.js diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/stdout.txt b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/stdout.txt similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/stdout.txt rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with babelignore/stdout.txt diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/.babelrc b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/.babelrc similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/.babelrc rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/.babelrc diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/in-files/src/.foorc b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/in-files/src/.foorc similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/in-files/src/.foorc rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/in-files/src/.foorc diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/in-files/src/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/in-files/src/README.md similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/in-files/src/README.md rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/in-files/src/README.md diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/out-files/lib/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/in-files/src/foo/bar.js similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/out-files/lib/foo/bar.js rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/in-files/src/foo/bar.js diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/in-files/src/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/in-files/src/index.js similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/in-files/src/index.js rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/in-files/src/index.js diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/options.json b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/options.json similarity index 79% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/options.json rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/options.json index d16d70e6ffec..4b73dd790e1f 100644 --- a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/options.json +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/options.json @@ -4,7 +4,7 @@ "--out-dir", "lib", "--copy-files", - "--copy-ignored", + "--no-copy-ignored", "--verbose" ] } diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/out-files/lib/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/out-files/lib/README.md similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/out-files/lib/README.md rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/out-files/lib/README.md diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/out-files/lib/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/out-files/lib/index.js similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/out-files/lib/index.js rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/out-files/lib/index.js diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/stdout.txt b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/stdout.txt similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/stdout.txt rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore in babelrc/stdout.txt diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/in-files/src/.foorc b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/in-files/src/.foorc similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/in-files/src/.foorc rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/in-files/src/.foorc diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/in-files/src/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/in-files/src/README.md similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/in-files/src/README.md rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/in-files/src/README.md diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/in-files/src/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/in-files/src/foo/bar.js similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/in-files/src/foo/bar.js rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/in-files/src/foo/bar.js diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/in-files/src/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/in-files/src/index.js similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/in-files/src/index.js rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/in-files/src/index.js diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/options.json b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/options.json similarity index 83% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/options.json rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/options.json index f49a79c08fe5..8654a9282e58 100644 --- a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/options.json +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/options.json @@ -6,7 +6,7 @@ "--copy-files", "--ignore", "src/foo", - "--copy-ignored", + "--no-copy-ignored", "--verbose" ] } diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/out-files/lib/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/out-files/lib/README.md similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/out-files/lib/README.md rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/out-files/lib/README.md diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/out-files/lib/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/out-files/lib/index.js similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/out-files/lib/index.js rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/out-files/lib/index.js diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/stdout.txt b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/stdout.txt similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/stdout.txt rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with ignore/stdout.txt diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/in-files/src/.foorc b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/in-files/src/.foorc similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/in-files/src/.foorc rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/in-files/src/.foorc diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/in-files/src/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/in-files/src/README.md similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/in-files/src/README.md rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/in-files/src/README.md diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/out-files/lib/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/in-files/src/foo/bar.js similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/out-files/lib/foo/bar.js rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/in-files/src/foo/bar.js diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/out-files/lib/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/in-files/src/index.js similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/out-files/lib/index.js rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/in-files/src/index.js diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/options.json b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/options.json similarity index 83% rename from packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/options.json rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/options.json index f3adb3c91b91..d8b67e9dca82 100644 --- a/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/options.json +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/options.json @@ -6,7 +6,7 @@ "--copy-files", "--only", "src/foo/*", - "--copy-ignored", + "--no-copy-ignored", "--verbose" ] } diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/out-files/lib/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/out-files/lib/README.md similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/out-files/lib/README.md rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/out-files/lib/README.md diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/out-files/lib/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/out-files/lib/foo/bar.js similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/out-files/lib/foo/bar.js rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/out-files/lib/foo/bar.js diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/stdout.txt b/packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/stdout.txt similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/stdout.txt rename to packages/babel-cli/test/fixtures/babel/--copy-files --no-copy-ignored with only/stdout.txt diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/in-files/src/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/out-files/lib/foo/bar.js similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/in-files/src/foo/bar.js rename to packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/out-files/lib/foo/bar.js diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/out-files/lib/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/out-files/lib/foo/bar.js new file mode 100644 index 000000000000..e46160df1c7a --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/out-files/lib/foo/bar.js @@ -0,0 +1 @@ +bar; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore/out-files/lib/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore/out-files/lib/foo/bar.js new file mode 100644 index 000000000000..e46160df1c7a --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore/out-files/lib/foo/bar.js @@ -0,0 +1 @@ +bar; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with only/out-files/lib/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files with only/out-files/lib/index.js new file mode 100644 index 000000000000..c6788558edcb --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with only/out-files/lib/index.js @@ -0,0 +1 @@ +index; diff --git a/packages/babel-cli/test/index.js b/packages/babel-cli/test/index.js index e7ee2cbb6f40..c9f993b04cbb 100644 --- a/packages/babel-cli/test/index.js +++ b/packages/babel-cli/test/index.js @@ -94,20 +94,21 @@ const assertTest = function(stdout, stderr, opts, cwd) { const actualFiles = readDir(tmpLoc, fileFilter); Object.keys(actualFiles).forEach(function(filename) { - if ( - // saveInFiles always creates an empty .babelrc, so lets exclude for now - filename !== ".babelrc" && - filename !== ".babelignore" && - !Object.prototype.hasOwnProperty.call(opts.inFiles, filename) - ) { - const expected = opts.outFiles[filename]; - const actual = actualFiles[filename]; - - expect(expected).not.toBeUndefined(); - - if (expected) { - expect(actual).toBe(expected); + try { + if ( + // saveInFiles always creates an empty .babelrc, so lets exclude for now + filename !== ".babelrc" && + filename !== ".babelignore" && + !Object.prototype.hasOwnProperty.call(opts.inFiles, filename) + ) { + const expected = opts.outFiles[filename]; + const actual = actualFiles[filename]; + + expect(actual).toBe(expected ?? ""); } + } catch (e) { + e.message += "\n at " + filename; + throw e; } });