Skip to content

Commit

Permalink
fix: convert back-slashes (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardogobbosouza authored Oct 7, 2019
1 parent 9b37d90 commit 41b0f53
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/LintDirtyModulesPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class LintDirtyModulesPlugin {
}

const dirtyOptions = { ...this.options };
const glob = dirtyOptions.files.join('|');
const glob = dirtyOptions.files.join('|').replace(/\\/g, '/');
const changedFiles = this.getChangedFiles(compilation.fileTimestamps, glob);

this.prevTimestamps = compilation.fileTimestamps;
Expand Down
15 changes: 11 additions & 4 deletions test/lint-dirty-modules-only.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('lint dirty modules only', () => {
beforeAll(() => {
callback = jest.fn();

plugin = new LintDirtyModulesPlugin(null, { files: ['**/*.s?(c|a)ss'] });
plugin = new LintDirtyModulesPlugin(null, { files: ['**\\*.s?(c|a)ss'] });
plugin.isFirstRun = false;
});

Expand All @@ -32,9 +32,16 @@ describe('lint dirty modules only', () => {
});

it('linting on change file', () => {
const fileTimestamps = new Map([['changed.scss', 1], ['new-file.scss']]);

plugin.prevTimestamps = new Map([['changed.scss', 2]]);
const fileTimestamps = new Map([
['foo/changed.scss', 1],
['bar\\changed.scss', 1],
['new-file.scss'],
]);

plugin.prevTimestamps = new Map([
['foo/changed.scss', 2],
['bar\\changed.scss', 2],
]);
plugin.apply({ fileTimestamps }, callback);

expect(linter).toBeCalledTimes(1);
Expand Down

0 comments on commit 41b0f53

Please sign in to comment.