Skip to content

Commit 305e798

Browse files
committed
Adds a test
1 parent 64f0452 commit 305e798

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

tests/files/node_modules/eslint-import-resolver-foo/index.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/src/core/resolve.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ describe('resolve', function () {
9494
)).to.equal(utils.testFilePath('./bar.jsx'))
9595
})
9696

97+
it('finds resolvers from the source files rather than eslint-module-utils', function () {
98+
const testContext = utils.testContext({ 'import/resolver': { 'foo': {} } })
99+
100+
expect(resolve( '../files/foo'
101+
, Object.assign({}, testContext, { getFilename: function () { return utils.getFilename('foo.js') } }),
102+
)).to.equal(utils.testFilePath('./bar.jsx'))
103+
})
104+
97105
it('reports invalid import/resolver config', function () {
98106
const testContext = utils.testContext({ 'import/resolver': 123.456 })
99107
const testContextReports = []

tests/src/rules/no-unresolved.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,19 +343,19 @@ ruleTester.run('no-unresolved unknown resolver', rule, {
343343
// logs resolver load error
344344
test({
345345
code: 'import "./malformed.js"',
346-
settings: { 'import/resolver': 'foo' },
346+
settings: { 'import/resolver': 'doesnt-exist' },
347347
errors: [
348-
`Resolve error: unable to load resolver "foo".`,
348+
`Resolve error: unable to load resolver "doesnt-exist".`,
349349
`Unable to resolve path to module './malformed.js'.`,
350350
],
351351
}),
352352

353353
// only logs resolver message once
354354
test({
355355
code: 'import "./malformed.js"; import "./fake.js"',
356-
settings: { 'import/resolver': 'foo' },
356+
settings: { 'import/resolver': 'doesnt-exist' },
357357
errors: [
358-
`Resolve error: unable to load resolver "foo".`,
358+
`Resolve error: unable to load resolver "doesnt-exist".`,
359359
`Unable to resolve path to module './malformed.js'.`,
360360
`Unable to resolve path to module './fake.js'.`,
361361
],

0 commit comments

Comments
 (0)