Debian Codegraph @

ncjsm/test/lib/get-node-resolver.js

raw
1 "use strict";
2
3 const PassThru = require("../../utils/pass-thru")
4 , isModuleNotFoundError = require("../../is-module-not-found-error");
5
6 const resolver = function () { return new PassThru(null); };
7
8 module.exports = function (t, a) {
9 const resolve = t(resolver, resolver);
10 a.throws(() => { resolve(); }, TypeError);
11 a.throws(() => { resolve("asdfa"); }, TypeError);
12 a.throws(() => { resolve("asdfa", ""); }, TypeError);
13 try {
14 resolve("asdfa", "elo");
15 throw new Error("Unexpected");
16 } catch (error) {
17 a(isModuleNotFoundError(error, "elo"), true);
18 }
19 };