Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions test/folders.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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,
},
Expand Down
19 changes: 13 additions & 6 deletions test/symbolic-links.js
Original file line number Diff line number Diff line change
@@ -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 () {
Expand Down Expand Up @@ -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);
});

Expand All @@ -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);
});

Expand All @@ -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);
});
});
Expand All @@ -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 () {
Expand Down Expand Up @@ -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);
});
});
Expand Down Expand Up @@ -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)
}
}
Loading