Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
epidemian
GitHub Repository: epidemian/eslint-plugin-import
Path: blob/main/resolvers/webpack/test/extensions.js
829 views
1
'use strict';
2
3
const chai = require('chai');
4
const expect = chai.expect;
5
const path = require('path');
6
7
const resolve = require('../index').resolve;
8
9
10
const file = path.join(__dirname, 'files', 'dummy.js');
11
const extensions = path.join(__dirname, 'custom-extensions', 'dummy.js');
12
13
describe('extensions', function () {
14
it('respects the defaults', function () {
15
expect(resolve('./foo', file)).to.have.property('path')
16
.and.equal(path.join(__dirname, 'files', 'foo.web.js'));
17
});
18
19
describe('resolve.extensions set', function () {
20
it('works', function () {
21
expect(resolve('./foo', extensions)).to.have.property('path')
22
.and.equal(path.join(__dirname, 'custom-extensions', 'foo.js'));
23
});
24
25
it('replaces defaults', function () {
26
expect(resolve('./baz', extensions)).to.have.property('found', false);
27
});
28
29
it('finds .coffee', function () {
30
expect(resolve('./bar', extensions)).to.have.property('path')
31
.and.equal(path.join(__dirname, 'custom-extensions', 'bar.coffee'));
32
});
33
});
34
});
35
36