Skip folders in CLI pattern (#3411)

master
Lucas Duailibe 2017-12-05 20:01:59 -02:00 committed by GitHub
commit 7b299fb94e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 1 deletions

View File

@ -281,7 +281,7 @@ function eachFilename(argv, patterns, callback) {
try {
const filePaths = globby
.sync(patterns, { dot: true })
.sync(patterns, { dot: true, nodir: true })
.map(filePath => path.relative(process.cwd(), filePath));
if (filePaths.length === 0) {

View File

@ -0,0 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`skip folders passed specifically (stdout) 1`] = `
"a/file.js
b/file.js
"
`;
exports[`skip folders passed specifically (write) 1`] = `Array []`;
exports[`skips folders in glob (stdout) 1`] = `
"a/file.js
b/file.js
"
`;
exports[`skips folders in glob (write) 1`] = `Array []`;

View File

@ -0,0 +1,22 @@
"use strict";
const runPrettier = require("../runPrettier");
expect.addSnapshotSerializer(require("../path-serializer"));
describe("skips folders in glob", () => {
runPrettier("cli/skip-folders", ["**/*", "-l"]).test({
status: 1,
stderr: ""
});
});
describe("skip folders passed specifically", () => {
runPrettier("cli/skip-folders", [
"a",
"a/file.js",
"b",
"b/file.js",
"-l"
]).test({ status: 1, stderr: "" });
});

View File

@ -0,0 +1 @@
fooA( )

View File

@ -0,0 +1 @@
fooB( )