Skip to content

Commit

Permalink
remove stuff after each test to fix ci, maybe??
Browse files Browse the repository at this point in the history
  • Loading branch information
ETLaurent committed Apr 29, 2024
1 parent e6007cc commit 08f0481
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 @@ -44,12 +44,12 @@ describe('@apostrophecms/import-export', function () {
});

beforeEach(async function() {
await deletePiecesAndPages(apos);
await deleteAttachments(apos, attachmentPath);
await insertPiecesAndPages(apos);
});

afterEach(async function() {
await deletePiecesAndPages(apos);
await deleteAttachments(apos, attachmentPath);
await cleanData([ tempPath, exportsPath, attachmentPath ]);
});

Expand Down Expand Up @@ -1479,11 +1479,15 @@ async function getExtractedFiles(extractPath) {
}

async function cleanData(paths) {
for (const filePath of paths) {
const files = await fs.readdir(filePath);
for (const name of files) {
await fs.rm(path.join(filePath, name), { recursive: true });
try {
for (const filePath of paths) {
const files = await fs.readdir(filePath);
for (const name of files) {
await fs.rm(path.join(filePath, name), { recursive: true });
}
}
} catch (err) {
assert(!err);
}
}

Expand Down

0 comments on commit 08f0481

Please sign in to comment.