diff --git a/test/folders.js b/test/folders.js index d4b9aab..f88a2a8 100644 --- a/test/folders.js +++ b/test/folders.js @@ -217,7 +217,7 @@ describe('Generating a hash over a folder, it', function () { }); }); - it('ignores a folder it is both included and excluded', async function () { + it('ignores a folder if it is both included and excluded', async function () { const hashElement = prep( Volume.fromJSON({ 'base/file1': 'content', @@ -235,10 +235,12 @@ describe('Generating a hash over a folder, it', function () { result.children[1].name.should.equal('folder2'); } + const include1 = (process.platform === 'win32') ? '*' : '**/*'; + await verify({ folders: { - exclude: ['**/folder'], - include: ['**/*'], + exclude: [path.join('**','folder')], + include: [include1], matchBasename: false, matchPath: true, }, diff --git a/test/symbolic-links.js b/test/symbolic-links.js index 0968819..1807e4e 100644 --- a/test/symbolic-links.js +++ b/test/symbolic-links.js @@ -1,6 +1,5 @@ const { defaultOptions, prep, Volume } = require('./_common'); const crypto = require('crypto'), - clone = require('clone'), path = require('path'); describe('When hashing a symbolic link', async function () { @@ -113,7 +112,7 @@ describe('When symbolicLinks.ignoreTargetContent is true', function () { }, }; let result = await hash('l2', options); - const expected = toHash(['l2', path.resolve('folder/file')]); + const expected = toHash(['l2', resolvePath('folder/file')]); return result.hash.should.equal(expected); }); @@ -127,7 +126,7 @@ describe('When symbolicLinks.ignoreTargetContent is true', function () { }, }; let result = await hash('l2', options); - const expected = toHash([path.resolve('folder/file')]); + const expected = toHash([resolvePath('folder/file')]); return result.hash.should.equal(expected); }); @@ -140,7 +139,7 @@ describe('When symbolicLinks.ignoreTargetContent is true', function () { }, }; let result = await hash('l1', options); - const expected = toHash(['l1', path.resolve('non-existing')]); + const expected = toHash(['l1', resolvePath('non-existing')]); return result.hash.should.equal(expected); }); }); @@ -154,7 +153,7 @@ describe('When symbolicLinks.include equals "resolve"', function () { function hashWithResolvedTargetPath(first, targetPath) { const withoutTargetPath = toHash(first); - return toHash([withoutTargetPath, path.resolve(targetPath)]); + return toHash([withoutTargetPath, resolvePath(targetPath)]); } it('can create a hash over basename file content and target path', async function () { @@ -239,7 +238,7 @@ function linkType(type) { }; return hash('soft-link', options).then(result => { - const expected = toHash(['soft-link', path.resolve('non-existing-file')]); + const expected = toHash(['soft-link', resolvePath('non-existing-file')]); result.hash.should.equal(expected); }); }); @@ -267,3 +266,11 @@ function toHash(strings) { } return hash.digest(defaultOptions().encoding); } + +function resolvePath(string) { + if (process.platform === 'win32') { + return path.posix.resolve(string) + } else { + return path.resolve(string) + } +}