Skip to content

Commit

Permalink
fix: add windowsPathsNoEscape to preserve behaviour on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe committed Jun 10, 2024
1 parent a1955c5 commit f9dca2b
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 102 deletions.
1 change: 0 additions & 1 deletion .taprc
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
timeout: 360
bail: true
disable-coverage: true
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class TestExclude {

globSync(cwd = this.cwd) {
const globPatterns = getExtensionPattern(this.extension || []);
const globOptions = { cwd, nodir: true, dot: true };
const globOptions = { cwd, nodir: true, dot: true, posix: true };
/* If we don't have any excludeNegated then we can optimize glob by telling
* it to not iterate into unwanted directory trees (like node_modules). */
if (this.excludeNegated.length === 0) {
Expand All @@ -118,7 +118,7 @@ class TestExclude {

async glob(cwd = this.cwd) {
const globPatterns = getExtensionPattern(this.extension || []);
const globOptions = { cwd, nodir: true, dot: true };
const globOptions = { cwd, nodir: true, dot: true, posix: true };
/* If we don't have any excludeNegated then we can optimize glob by telling
* it to not iterate into unwanted directory trees (like node_modules). */
if (this.excludeNegated.length === 0) {
Expand Down
2 changes: 1 addition & 1 deletion is-outside-dir-win32.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const path = require('path');
const { minimatch } = require('minimatch');

const dot = { dot: true };
const dot = { dot: true, windowsPathsNoEscape: true };

module.exports = function(dir, filename) {
return !minimatch(path.resolve(dir, filename), path.join(dir, '**'), dot);
Expand Down
124 changes: 26 additions & 98 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions test/glob.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ t.test('allows negated exclude patterns', t =>
})
);


t.test('allows negated include patterns', t =>
testHelper(t, {
options: {
Expand Down

0 comments on commit f9dca2b

Please sign in to comment.