Skip to content

Commit

Permalink
Add tests for win32 paths
Browse files Browse the repository at this point in the history
  • Loading branch information
martpie committed Mar 5, 2019
1 parent 799e005 commit f41e942
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions __tests__/regexps.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ describe('generateIncludes', () => {
expect(anymatch(includes, '../../node_modules/something-else/test.js')).toBe(false);
expect(anymatch(includes, 'node_modules/and-yet-another/test.js')).toBe(false);
});

test('should handle win32 path delimiters well', () => {
const module = '@scoped/something';
const anotherModule = '@scoped\\something';

expect(anymatch(includes, `C:\\test\\node_modules\\${module}\\sub\\test.js`)).toBe(true);
expect(anymatch(includes, `C:\\test\\node_modules\\${anotherModule}\\sub\\test.js`)).toBe(true);
expect(anymatch(includes, `C:\\test\\node_modules\\unused\\sub\\test.js`)).toBe(false);
});
});

describe('generateExcludes', () => {
Expand Down Expand Up @@ -67,6 +76,15 @@ describe('generateExcludes', () => {
expect(anymatch(excludes, '../../node_modules/something-else')).toBe(true);
expect(anymatch(excludes, 'node_modules/and-yet-another')).toBe(true);
});

test('should handle win32 path delimiters well', () => {
const module = '@scoped/something';
const anotherModule = '@scoped\\something';

expect(anymatch(excludes, `C:\\test\\node_modules\\${module}\\sub\\test.js`)).toBe(false);
expect(anymatch(excludes, `C:\\test\\node_modules\\${anotherModule}\\sub\\test.js`)).toBe(false);
expect(anymatch(excludes, `C:\\test\\node_modules\\unused\\sub\\test.js`)).toBe(true);
});
});

describe('regexEqual', () => {
Expand Down

0 comments on commit f41e942

Please sign in to comment.