Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support running CLI in project without config file #80

Merged
merged 2 commits into from
Apr 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ process.on("exit", () => {
if (cli.flags.config) {
logger.error("Configuration file not found");
process.exit(EXIT_CODES.configuration);
} else {
configObj = {};
}
}
} catch (e) {
Expand Down
7 changes: 6 additions & 1 deletion test/cli.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe("CLI", function(){
});

it("should fail with an invalid SVG", async function(){
const { failed, exitCode } = await execCliWith([INVALID_SVG]);
const { failed, exitCode } = await execCliWith([INVALID_SVG], "test/projects/with-config");
expect(failed).toBeTruthy();
expect(exitCode).toBe(1);
});
Expand Down Expand Up @@ -101,4 +101,9 @@ describe("Configuration files", function() {
const { failed } = await execCliWith([VALID_SVG], "test/projects/cjs/bar/a/b/c");
expect(failed).toBeFalsy();
});

it("should succeed in a project without a config file", async function () {
const { stdout } = await execCliWith([VALID_SVG], "test/projects/without-config");
expect(stdout).toNotMatch("Failed to lint");
});
});
File renamed without changes.
Empty file.