2017-10-02 11:08:34 -05:00
|
|
|
describe("multiple patterns", () => {
|
2023-04-11 08:44:23 +08:00
|
|
|
runCli("cli/patterns", [
|
2017-07-04 18:55:06 +03:00
|
|
|
"directory/**/*.js",
|
|
|
|
|
"other-directory/**/*.js",
|
|
|
|
|
"-l",
|
2017-10-02 11:08:34 -05:00
|
|
|
]).test({
|
|
|
|
|
status: 1,
|
|
|
|
|
});
|
2017-07-04 18:55:06 +03:00
|
|
|
});
|
|
|
|
|
|
2017-10-02 11:08:34 -05:00
|
|
|
describe("multiple patterns with non exists pattern", () => {
|
2023-04-11 08:44:23 +08:00
|
|
|
runCli("cli/patterns", ["directory/**/*.js", "non-existent.js", "-l"]).test({
|
2020-03-17 01:34:32 +02:00
|
|
|
status: 2,
|
2017-10-02 11:08:34 -05:00
|
|
|
});
|
2017-07-04 18:55:06 +03:00
|
|
|
});
|
|
|
|
|
|
2017-10-02 11:08:34 -05:00
|
|
|
describe("multiple patterns with ignore nested directories pattern", () => {
|
2023-04-11 08:44:23 +08:00
|
|
|
runCli("cli/patterns", ["**/*.js", "!**/nested-directory/**", "-l"]).test({
|
2017-10-02 11:08:34 -05:00
|
|
|
status: 1,
|
|
|
|
|
});
|
2017-07-04 18:55:06 +03:00
|
|
|
});
|
|
|
|
|
|
2017-10-02 11:08:34 -05:00
|
|
|
describe("multiple patterns by with ignore pattern, ignores node_modules by default", () => {
|
2023-04-11 08:44:23 +08:00
|
|
|
runCli("cli/patterns", ["**/*.js", "!directory/**", "-l"]).test({
|
2019-11-02 01:02:34 +08:00
|
|
|
status: 1,
|
|
|
|
|
});
|
2017-07-04 18:55:06 +03:00
|
|
|
});
|
|
|
|
|
|
2017-10-02 11:08:34 -05:00
|
|
|
describe("multiple patterns by with ignore pattern, ignores node_modules by with ./**/*.js", () => {
|
2023-04-11 08:44:23 +08:00
|
|
|
runCli("cli/patterns", ["./**/*.js", "!./directory/**", "-l"]).test({
|
2017-10-02 11:08:34 -05:00
|
|
|
status: 1,
|
|
|
|
|
});
|
2017-07-04 18:55:06 +03:00
|
|
|
});
|
|
|
|
|
|
2017-10-02 11:08:34 -05:00
|
|
|
describe("multiple patterns by with ignore pattern, doesn't ignore node_modules with --with-node-modules flag", () => {
|
2023-04-11 08:44:23 +08:00
|
|
|
runCli("cli/patterns", [
|
2017-07-04 18:55:06 +03:00
|
|
|
"**/*.js",
|
|
|
|
|
"!directory/**",
|
|
|
|
|
"-l",
|
|
|
|
|
"--with-node-modules",
|
2017-10-02 11:08:34 -05:00
|
|
|
]).test({
|
|
|
|
|
status: 1,
|
|
|
|
|
});
|
2017-07-04 18:55:06 +03:00
|
|
|
});
|
|
|
|
|
|
2017-10-02 11:08:34 -05:00
|
|
|
describe("no errors on empty patterns", () => {
|
2018-05-23 16:55:06 -03:00
|
|
|
// --parser is mandatory if no filepath is passed
|
2023-04-11 08:44:23 +08:00
|
|
|
runCli("cli/patterns", ["--parser", "babel"]).test({
|
2017-10-02 11:08:34 -05:00
|
|
|
status: 0,
|
|
|
|
|
});
|
2017-07-04 18:55:06 +03:00
|
|
|
});
|
|
|
|
|
|
2017-10-02 11:08:34 -05:00
|
|
|
describe("multiple patterns, throw error and exit with non zero code on non existing files", () => {
|
2023-04-11 08:44:23 +08:00
|
|
|
runCli("cli/patterns", [
|
2017-07-04 18:55:06 +03:00
|
|
|
"non-existent.js",
|
|
|
|
|
"other-non-existent.js",
|
|
|
|
|
"-l",
|
2017-10-02 11:08:34 -05:00
|
|
|
]).test({
|
|
|
|
|
status: 2,
|
|
|
|
|
});
|
2017-07-04 18:55:06 +03:00
|
|
|
});
|
2023-11-07 10:25:24 +08:00
|
|
|
|
|
|
|
|
describe("file names with special characters", () => {
|
|
|
|
|
runCli("cli/patterns-special-characters/square-brackets/", [
|
|
|
|
|
"[with-square-brackets].js",
|
|
|
|
|
"-l",
|
|
|
|
|
]).test({
|
|
|
|
|
status: 1,
|
|
|
|
|
write: [],
|
|
|
|
|
stderr: "",
|
|
|
|
|
stdout: "[with-square-brackets].js",
|
|
|
|
|
});
|
|
|
|
|
runCli("cli/patterns-special-characters/dots/", [
|
|
|
|
|
"[...with-square-and-dots-brackets].js",
|
|
|
|
|
"-l",
|
|
|
|
|
]).test({
|
|
|
|
|
status: 1,
|
|
|
|
|
write: [],
|
|
|
|
|
stderr: "",
|
|
|
|
|
stdout: "[...with-square-and-dots-brackets].js",
|
|
|
|
|
});
|
|
|
|
|
});
|