Fix printing ignored files with --debug-check (#4066)

master
Lucas Duailibe 2018-03-01 13:03:54 -03:00 committed by GitHub
parent 2b283908cf
commit 240f09794b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 1 deletions

View File

@ -339,7 +339,9 @@ function formatFiles(context) {
const fileIgnored = ignorer.filter([filename]).length === 0;
if (
fileIgnored &&
(context.argv["write"] || context.argv["list-different"])
(context.argv["debug-check"] ||
context.argv["write"] ||
context.argv["list-different"])
) {
return;
}

View File

@ -1,5 +1,14 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ignore file when using --debug-check (stderr) 1`] = `""`;
exports[`ignore file when using --debug-check (stdout) 1`] = `
"other-regular-modules.js
"
`;
exports[`ignore file when using --debug-check (write) 1`] = `Array []`;
exports[`ignore path (stderr) 1`] = `""`;
exports[`ignore path (stdout) 1`] = `

View File

@ -19,6 +19,12 @@ describe("support .prettierignore", () => {
});
});
describe("ignore file when using --debug-check", () => {
runPrettier("cli/ignore-path", ["**/*.js", "--debug-check"]).test({
status: 0
});
});
describe("outputs files as-is if no --write", () => {
runPrettier("cli/ignore-path", ["regular-module.js"]).test({
status: 0