Skip to content

Commit

Permalink
fix: add windowsPathsNoEscape to preserve behaviour on Windows
Browse files Browse the repository at this point in the history
Adds windowsPathsNoEscape which seemed to address issues with finding files outside working directory.

Added posix: true for the benefit of test fixtures.
  • Loading branch information
bcoe committed Jun 10, 2024
1 parent a1955c5 commit 15dcfaa
Show file tree
Hide file tree
Showing 4 changed files with 29 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.

0 comments on commit 15dcfaa

Please sign in to comment.