Skip to content

Commit

Permalink
Fix CI error on Windows (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
jopemachine committed Apr 7, 2022
1 parent 589c637 commit 778ecdb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
18 changes: 10 additions & 8 deletions test/async.js
Expand Up @@ -80,14 +80,16 @@ test('do not overwrite when disabled', async t => {
t.is(error.code, 'EEXIST', error.message);
});

test('create directories with specified mode', async t => {
const directory = t.context.destination;
const destination = `${directory}/${uuidv4()}`;
const directoryMode = 0o700;
await cpFile('license', destination, {directoryMode});
const stat = fs.statSync(directory);
t.is(stat.mode & directoryMode, directoryMode);
});
if (process.platform !== 'win32') {
test('create directories with specified mode', async t => {
const directory = t.context.destination;
const destination = `${directory}/${uuidv4()}`;
const directoryMode = 0o700;
await cpFile('license', destination, {directoryMode});
const stat = fs.statSync(directory);
t.is(stat.mode & directoryMode, directoryMode);
});
}

test('do not create `destination` on unreadable `source`', async t => {
const error = await t.throwsAsync(cpFile('node_modules', t.context.destination));
Expand Down
18 changes: 10 additions & 8 deletions test/sync.js
Expand Up @@ -81,14 +81,16 @@ test('do not overwrite when disabled', t => {
t.is(fs.readFileSync(t.context.destination, 'utf8'), '');
});

test('create directories with specified mode', t => {
const directory = t.context.destination;
const destination = `${directory}/${uuidv4()}`;
const directoryMode = 0o700;
cpFile.sync('license', destination, {directoryMode});
const stat = fs.statSync(directory);
t.is(stat.mode & directoryMode, directoryMode);
});
if (process.platform !== 'win32') {
test('create directories with specified mode', t => {
const directory = t.context.destination;
const destination = `${directory}/${uuidv4()}`;
const directoryMode = 0o700;
cpFile.sync('license', destination, {directoryMode});
const stat = fs.statSync(directory);
t.is(stat.mode & directoryMode, directoryMode);
});
}

test('do not create `destination` on unreadable `source`', t => {
t.throws(
Expand Down

0 comments on commit 778ecdb

Please sign in to comment.