-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[resolvers/webpack] [new] add cache option
- Loading branch information
Showing
5 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
'use strict'; | ||
|
||
const chai = require('chai'); | ||
const expect = chai.expect; | ||
const path = require('path'); | ||
|
||
const resolve = require('../index').resolve; | ||
|
||
const file = path.join(__dirname, 'files', 'src', 'jsx', 'dummy.js'); | ||
|
||
describe('cache', function () { | ||
it('can distinguish different config files', function () { | ||
const setting1 = { | ||
config: require(path.join(__dirname, './files/webpack.function.config.js')), | ||
argv: { | ||
mode: 'test', | ||
}, | ||
cache: true, | ||
}; | ||
expect(resolve('baz', file, setting1)).to.have.property('path') | ||
.and.equal(path.join(__dirname, 'files', 'some', 'bar', 'bar.js')); | ||
const setting2 = { | ||
config: require(path.join(__dirname, './files/webpack.function.config.multiple.js')), | ||
cache: true, | ||
}; | ||
expect(resolve('baz', file, setting2)).to.have.property('path') | ||
.and.equal(path.join(__dirname, 'files', 'some', 'goofy', 'path', 'foo.js')); | ||
}); | ||
|
||
it('can distinguish different config', function () { | ||
const setting1 = { | ||
config: require(path.join(__dirname, './files/webpack.function.config.js')), | ||
env: { | ||
dummy: true, | ||
}, | ||
cache: true, | ||
}; | ||
expect(resolve('bar', file, setting1)).to.have.property('path') | ||
.and.equal(path.join(__dirname, 'files', 'some', 'goofy', 'path', 'bar.js')); | ||
const setting2 = { | ||
config: require(path.join(__dirname, './files/webpack.function.config.multiple.js')), | ||
cache: true, | ||
}; | ||
const result = resolve('bar', file, setting2); | ||
expect(result).not.to.have.property('path'); | ||
expect(result).to.have.property('found').to.be.false; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters