Skip to content

Commit

Permalink
fix windows tests
Browse files Browse the repository at this point in the history
the `api.matcher.js` tests were for posix and should have been skipped on windows.
  • Loading branch information
jonschlinkert committed Mar 24, 2022
1 parent 32fe3fe commit 4201cb4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions test/api.matcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ describe('.matcher()', () => {
});

describe('backlashes for path separators, on posix', () => {
if (process.platform === 'win32') return;
let format = str => str;

it('should return an array of matches for a literal string', () => {
Expand Down
14 changes: 7 additions & 7 deletions test/bash.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const isWindows = () => process.platform === 'win32' || path.sep === '\\';
const format = str => str.replace(/\\/g, '/').replace(/^\.\//, '');

// from the Bash 4.3 specification/unit tests
const fixtures = ['*', '**', '\\*', 'a', 'a/*', 'abc', 'abd', 'abe', 'b', 'bb', 'bcd', 'bdir/', 'Beware', 'c', 'ca', 'cb', 'd', 'dd', 'de'];
const fixtures = ['\\\\', '*', '**', '\\*', 'a', 'a/*', 'abc', 'abd', 'abe', 'b', 'bb', 'bcd', 'bdir/', 'Beware', 'c', 'ca', 'cb', 'd', 'dd', 'de'];

describe('bash options and features:', () => {
// $echo a/{1..3}/b
Expand Down Expand Up @@ -77,13 +77,13 @@ describe('bash options and features:', () => {
// should not match backslashes on windows, since backslashes are path
// separators and negation character classes should not match path separators
// unless it's explicitly defined in the character class
assert.deepEqual(mm(f, '[^a-c]*'), ['d', 'dd', 'de', 'Beware', 'BewAre', 'BZZ', '*', '**'].sort());
assert.deepEqual(mm(f, '[^a-c]*', { bash: false }), ['d', 'dd', 'de', 'BewAre', 'Beware', 'BZZ', '*', '**'].sort());
assert.deepEqual(mm(f, '[^a-c]*', { nocase: true }), ['d', 'dd', 'de', '*', '**'].sort());
assert.deepEqual(mm(f, '[^a-c]*'), ['d', 'dd', 'de', 'Beware', 'BewAre', 'BZZ', '*', '**', '\\*'].sort());
assert.deepEqual(mm(f, '[^a-c]*', { bash: false }), ['d', 'dd', 'de', 'BewAre', 'Beware', 'BZZ', '*', '**', '\\*'].sort());
assert.deepEqual(mm(f, '[^a-c]*', { nocase: true }), ['d', 'dd', 'de', '*', '**', '\\*'].sort());
} else {
assert.deepEqual(mm(f, '[^a-c]*'), ['*', '**', 'BZZ', 'BewAre', 'Beware', '\\*', 'd', 'dd', 'de'].sort());
assert.deepEqual(mm(f, '[^a-c]*', { bash: false }), ['*', '**', 'BZZ', 'BewAre', 'Beware', '\\*', 'd', 'dd', 'de'].sort());
assert.deepEqual(mm(f, '[^a-c]*', { nocase: true }), ['*', '**', '\\*', 'd', 'dd', 'de'].sort());
assert.deepEqual(mm(f, '[^a-c]*'), ['*', '**', 'BZZ', 'BewAre', 'Beware', '\\*', 'd', 'dd', 'de', '\\\\'].sort());
assert.deepEqual(mm(f, '[^a-c]*', { bash: false }), ['*', '**', 'BZZ', 'BewAre', 'Beware', '\\*', 'd', 'dd', 'de', '\\\\'].sort());
assert.deepEqual(mm(f, '[^a-c]*', { nocase: true }), ['*', '**', '\\*', 'd', 'dd', 'de', '\\\\'].sort());
}
});

Expand Down

0 comments on commit 4201cb4

Please sign in to comment.