don't raise error when no packages present - fixes #58
This commit is contained in:
parent
caf2043fa1
commit
3c4402129b
1
fixtures/empty.json
Normal file
1
fixtures/empty.json
Normal file
@ -0,0 +1 @@
|
||||
{}
|
8
test.js
8
test.js
@ -8,6 +8,7 @@ import {tmpdir} from "os";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const testFile = resolve(__dirname, "fixtures/test.json");
|
||||
const emptyFile = resolve(__dirname, "fixtures/empty.json");
|
||||
const testPkg = JSON.parse(readFileSync(testFile, "utf8"));
|
||||
const testDir = mkdtempSync(join(tmpdir(), "updates-"));
|
||||
const script = join(__dirname, "bin/updates.js");
|
||||
@ -121,6 +122,13 @@ test("simple", async () => {
|
||||
expect(exitCode).toEqual(0);
|
||||
});
|
||||
|
||||
test("empty", async () => {
|
||||
const {stdout, stderr, exitCode} = await execa(script, ["-C", "-G", githubUrl, "-f", emptyFile]);
|
||||
expect(stderr).toEqual("");
|
||||
expect(stdout).toContain("No packages");
|
||||
expect(exitCode).toEqual(0);
|
||||
});
|
||||
|
||||
test("version", async () => {
|
||||
const {stdout, stderr, exitCode} = await execa(script, ["-v"]);
|
||||
expect(stderr).toEqual("");
|
||||
|
@ -657,7 +657,7 @@ async function main() {
|
||||
}
|
||||
|
||||
if (!Object.keys(deps).length && !Object.keys(maybeUrlDeps).length) {
|
||||
finish(new Error(`No packages ${include || exclude ? "match the given filters" : "found"}`));
|
||||
finish(`No packages ${include || exclude ? "match the given filters" : "present"}`);
|
||||
}
|
||||
|
||||
const entries = await Promise.all(Object.keys(deps).map(key => {
|
||||
|
Loading…
Reference in New Issue
Block a user