Skip to content
This repository has been archived by the owner on Mar 14, 2022. It is now read-only.

Commit

Permalink
ensure the test directory does not exist before we try to create it
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeChampion committed Apr 21, 2021
1 parent b67e6b3 commit 220b192
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/unit/tasks/demo-build.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ const oNoManifestPath = path.resolve(obtPath, 'test/unit/fixtures/o-no-manifest'
const pathSuffix = '-demo';
const demoTestPath = path.resolve(obtPath, oTestPath + pathSuffix);
const demo = require('../../../lib/tasks/demo-build');
const denodeify = require('util').promisify;
const rimraf = denodeify(require('rimraf'));

describe('Demo task', function () {

beforeEach(function () {
beforeEach(async function () {
await rimraf(demoTestPath);
fs.copySync(path.resolve(obtPath, oTestPath), demoTestPath);
process.chdir(demoTestPath);
mockery.enable({
Expand All @@ -26,9 +29,9 @@ describe('Demo task', function () {
});
});

afterEach(function () {
afterEach(async function () {
process.chdir(obtPath);
fs.removeSync(demoTestPath);
await rimraf(demoTestPath);
sinon.restore();
mockery.resetCache();
mockery.deregisterAll();
Expand Down

0 comments on commit 220b192

Please sign in to comment.