-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: lint modules that are cached with webpack's filesystem cache
If webpack is setup with cache type `filesystem`, the `succeedModule` hook is not called for cached modules and no linting is run for them. Tap the `stillValidModule` hook to lint cached modules. Fixes #130
- Loading branch information
Showing
3 changed files
with
64 additions
and
4 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { join } from 'path'; | ||
|
||
import { removeSync } from 'fs-extra'; | ||
|
||
import webpack from 'webpack'; | ||
|
||
import conf from './utils/conf'; | ||
|
||
describe('error (cached module)', () => { | ||
const cacheLocation = join(__dirname, 'cache'); | ||
|
||
beforeEach(() => { | ||
removeSync(cacheLocation); | ||
}); | ||
|
||
afterAll(() => { | ||
removeSync(cacheLocation); | ||
}); | ||
|
||
it('should return error even if module is cached', (done) => { | ||
const config = conf('error'); | ||
config.cache = { | ||
type: 'filesystem', | ||
idleTimeout: 0, | ||
idleTimeoutAfterLargeChanges: 0, | ||
idleTimeoutForInitialStore: 0, | ||
cacheLocation, | ||
}; | ||
|
||
const c1 = webpack(config); | ||
|
||
c1.run((err1, stats1) => { | ||
expect(err1).toBeNull(); | ||
expect(stats1.hasWarnings()).toBe(false); | ||
expect(stats1.hasErrors()).toBe(true); | ||
|
||
c1.close(() => { | ||
const c2 = webpack(config); | ||
c2.run((err2, stats2) => { | ||
expect(err2).toBeNull(); | ||
expect(stats2.hasWarnings()).toBe(false); | ||
expect(stats2.hasErrors()).toBe(true); | ||
|
||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
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