Skip to content

Commit

Permalink
test(commit): fix commit test for --hook flag
Browse files Browse the repository at this point in the history
post-test cleanup has a permissions error on Windows builds
  • Loading branch information
olgn committed Mar 19, 2019
1 parent 2e15e46 commit 0630aef
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions test/tests/commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,15 +308,10 @@ ${(os.platform === 'win32') ? '' : ' '}
let commitContents = fs.readFileSync(commitFile).toString();
expect(commitContents).to.have.string(dummyCommitMessage);
expect(err).to.be.a('null');

// Force permissions error on write to .git/COMMIT_EDITMSG and ensure we catch it
fs.chmodSync(path.join(repoConfig.path, '.git/COMMIT_EDITMSG'), '555')
commitizenCommit(sh, inquirer, repoConfig.path, prompter, { disableAppendPaths: true, quiet: true, emitData: true, hookMode: true }, function (err) {
expect(err).to.not.be.a('null');
expect(err.code).to.have.string('EACCES');
fs.chmodSync(path.join(repoConfig.path, '.git/COMMIT_EDITMSG'), '777');
done();
});
fs.chmodSync(path.join(repoConfig.path, '.git'), 0o777);
fs.chmodSync(path.join(repoConfig.path, '.git/COMMIT_EDITMSG'), 0o777);
fs.closeSync(commitFile);
done();
});
});
});
Expand Down

0 comments on commit 0630aef

Please sign in to comment.