Skip to content

Commit dd153f0

Browse files
committed
Merge branch 'master' of https://github.com/h5bp/create-html5-boilerplate into prettier
2 parents ad5a485 + a5f686a commit dd153f0

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
require('./cli')();
1+
require("./cli")().catch(console.error);

tests/test.js

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const all_versions = [
2424
const cases = [
2525
null,
2626
"-r=latest",
27+
"-r=7",
2728
"-r=7.2.0",
2829
"-r=v7.2.0",
2930
"-r=v7.2",
@@ -49,7 +50,7 @@ const runCli = async (version = null) => {
4950
(v) => v !== version && v !== versionFolder(version)
5051
); //revert process args
5152
} else {
52-
process.chdir(prevCwd);//revert process current dir
53+
process.chdir(prevCwd); //revert process current dir
5354
}
5455
};
5556
describe.each(cases)("Downloading %s", (version) => {
@@ -111,14 +112,29 @@ describe.each(cases)("Downloading %s", (version) => {
111112
});
112113

113114
describe("Errors", () => {
114-
test("Wrong version 6..2.3", async () => {//maybe create test.each() for more errors scenarios
115-
const mockExit = jest.spyOn(process, "exit").mockImplementation(() => {});
115+
test("Wrong version 6..2.3", async () => {
116+
//maybe create test.each() for more errors scenarios
116117
const version = "-r=6..2.3";
118+
try {
119+
await runCli(version);
120+
} catch (err) {
121+
expect(err).toBe("ETARGET");
122+
} finally {
123+
await fs.remove(versionFolder(version));
124+
}
125+
});
126+
});
117127

118-
await runCli(version);
119-
120-
await fs.remove(versionFolder(version));
121-
expect(mockExit).toHaveBeenCalledWith(1);
122-
mockExit.mockRestore();
128+
describe("Unexpected errors", () => {
129+
test("Unexpected error 6..2.3,7.2.3", async () => {
130+
//maybe create test.each() for more errors scenarios
131+
const version = "-r=6..2.3,7.2.3";
132+
try {
133+
await runCli(version);
134+
} catch (err) {
135+
expect(err).not.toBe("ETARGET");
136+
} finally {
137+
await fs.remove(versionFolder(version));
138+
}
123139
});
124140
});

0 commit comments

Comments
 (0)