Skip to content

Commit

Permalink
test: restore 100% branch coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
sheerlox committed Oct 11, 2023
1 parent 6c82fef commit 5f6ac30
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/load-parser-config.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import test from "ava";
import importFrom from "import-from-esm";
import sinon from "sinon";
import loadParserConfig from "../lib/load-parser-config.js";

const cwd = process.cwd();
Expand Down Expand Up @@ -100,3 +102,12 @@ test('Throw error if "config" doesn`t exist', async (t) => {
test('Throw error if "preset" doesn`t exist', async (t) => {
await t.throwsAsync(loadParserConfig({ preset: "unknown-preset" }, { cwd }), { code: "MODULE_NOT_FOUND" });
});

test.serial("Load preset and config correctly when importFrom.silent fails", async (t) => {
sinon.stub(importFrom, "silent").returns(undefined);

await loadPreset(t, "angular");
await loadConfig(t, "angular");

sinon.restore();
});

0 comments on commit 5f6ac30

Please sign in to comment.