Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
epidemian
GitHub Repository: epidemian/eslint-plugin-import
Path: blob/main/resolvers/webpack/test/fallback.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', 'src', 'dummy.js');
11
12
describe('fallback', function () {
13
it('works', function () {
14
expect(resolve('fb-module', file)).property('path')
15
.to.equal(path.join(__dirname, 'files', 'fallback', 'fb-module.js'));
16
});
17
it('really works', function () {
18
expect(resolve('jsx/some-fb-file', file)).property('path')
19
.to.equal(path.join(__dirname, 'files', 'fallback', 'jsx', 'some-fb-file.js'));
20
});
21
it('prefer root', function () {
22
expect(resolve('jsx/some-file', file)).property('path')
23
.to.equal(path.join(__dirname, 'files', 'src', 'jsx', 'some-file.js'));
24
});
25
it('supports definition as an array', function () {
26
expect(resolve('fb-module', file, { config: 'webpack.array-root.config.js' }))
27
.property('path')
28
.to.equal(path.join(__dirname, 'files', 'fallback', 'fb-module.js'));
29
});
30
});
31
32