From 3898ed5b95d772f3b759e1c3c9c995aee3d7c757 Mon Sep 17 00:00:00 2001 From: Noah Koontz Date: Tue, 25 Aug 2020 16:12:20 -0700 Subject: [PATCH] fix: fix path seperator in symlink detection --- lib/file_system.js | 4 ++-- tests/lib/file_system_tests.js | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/file_system.js b/lib/file_system.js index 5cffaf46..2824be82 100644 --- a/lib/file_system.js +++ b/lib/file_system.js @@ -87,7 +87,7 @@ class FileSystem { const onlySymlinks = {} for (const fullPath in symlinks) { if (symlinks[fullPath]) { - const relativeToRepoPath = path.relative(this.targetDir, fullPath) + const relativeToRepoPath = path.relative(this.targetDir, fullPath).split(path.sep).join('/') onlySymlinks[relativeToRepoPath] = true } } @@ -131,7 +131,7 @@ class FileSystem { shouldInclude (filePath) { if (this.filterPaths.length === 0) { return true } const resolvedPath = path.relative(this.targetDir, path.resolve(this.targetDir, filePath)) - return this.filterPaths.some(p => resolvedPath.startsWith(path.normalize(p))) + return this.filterPaths.some(p => resolvedPath.startsWith(p)) } /** diff --git a/tests/lib/file_system_tests.js b/tests/lib/file_system_tests.js index 3fd25231..060338f2 100644 --- a/tests/lib/file_system_tests.js +++ b/tests/lib/file_system_tests.js @@ -7,9 +7,11 @@ const expect = chai.expect const realFs = require('fs') describe('lib', () => { - describe('file_system', () => { + describe('file_system', function () { const FileSystem = require('../../lib/file_system') + this.timeout(10000) + describe('fileExists', () => { it('should return pass if the file exists', async () => { const index = 'text_file_for_test.txt'