Skip to content

Commit d88beb8

Browse files
committed
test: restore 100% branch coverage
1 parent 9d50f5b commit d88beb8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/load-parser-config.test.js

+11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import test from "ava";
2+
import importFrom from "import-from-esm";
3+
import sinon from "sinon";
24
import loadParserConfig from "../lib/load-parser-config.js";
35

46
const cwd = process.cwd();
@@ -100,3 +102,12 @@ test('Throw error if "config" doesn`t exist', async (t) => {
100102
test('Throw error if "preset" doesn`t exist', async (t) => {
101103
await t.throwsAsync(loadParserConfig({ preset: "unknown-preset" }, { cwd }), { code: "MODULE_NOT_FOUND" });
102104
});
105+
106+
test.serial("Load preset and config correctly when importFrom.silent fails", async (t) => {
107+
sinon.stub(importFrom, "silent").returns(undefined);
108+
109+
await loadPreset(t, "angular");
110+
await loadConfig(t, "angular");
111+
112+
sinon.restore();
113+
});

0 commit comments

Comments
 (0)