Skip to content

Commit

Permalink
Fix deletion of cache file during tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pioug committed Jan 22, 2022
1 parent faee6c1 commit f081435
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ describe('gulp-awspublish', function () {
// remove files
before(function (done) {
try {
fs.unlinkSync(path.join(__dirname, publisher.getCacheFilename()));
fs.unlinkSync(path.join(__dirname, '..', publisher.getCacheFilename()));
} catch (err) {}
try {
fs.unlinkSync(path.join(__dirname, '../testCacheFile'));
fs.unlinkSync(path.join(__dirname, '..', 'testCacheFile'));
} catch (err) {}
publisher._cache = {};

Expand All @@ -50,10 +50,10 @@ describe('gulp-awspublish', function () {

after(function () {
try {
fs.unlinkSync(path.join(__dirname, publisher.getCacheFilename()));
fs.unlinkSync(path.join(__dirname, '..', publisher.getCacheFilename()));
} catch (err) {}
try {
fs.unlinkSync(path.join(__dirname, '../testCacheFile'));
fs.unlinkSync(path.join(__dirname, '..', 'testCacheFile'));
} catch (err) {}
});

Expand Down Expand Up @@ -358,7 +358,11 @@ describe('gulp-awspublish', function () {
);
expect(
fs.accessSync(
path.join(__dirname, '../.awspublish-' + credentials.params.Bucket),
path.join(
__dirname,
'..',
'.awspublish-' + credentials.params.Bucket
),
fs.F_OK
)
).to.be.undefined;
Expand All @@ -378,7 +382,7 @@ describe('gulp-awspublish', function () {
cache.on('finish', function () {
expect(publisherWithCustomCache._cacheFile).to.equal('testCacheFile');
expect(
fs.accessSync(path.join(__dirname, '../testCacheFile'), fs.F_OK)
fs.accessSync(path.join(__dirname, '..', 'testCacheFile'), fs.F_OK)
).to.be.undefined;
done();
});
Expand Down

0 comments on commit f081435

Please sign in to comment.