Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp authored and github-actions[bot] committed May 17, 2022
1 parent d102cab commit 42251f3
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/astro/test/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ export async function loadFixture(inlineConfig) {
let fileEdits = new Map();

const resetAllFiles = () => {
for(const [, reset] of fileEdits) {
for (const [, reset] of fileEdits) {
reset();
}
fileEdits.clear();
};

// After each test, reset each of the edits to their original contents.
if(typeof afterEach === 'function') {
if (typeof afterEach === 'function') {
afterEach(resetAllFiles);
}
// Also do it on process exit, just in case.
Expand Down Expand Up @@ -145,15 +145,16 @@ export async function loadFixture(inlineConfig) {
const reset = () => fs.writeFileSync(fileUrl, contents);
// Only save this reset if not already in the map, in case multiple edits happen
// to the same file.
if(!fileEdits.has(fileUrl.toString())) {
if (!fileEdits.has(fileUrl.toString())) {
fileEdits.set(fileUrl.toString(), reset);
}
await fs.promises.writeFile(fileUrl, newContents);
return reset;
},
onNextChange: () => devServer ?
new Promise(resolve => devServer.watcher.once('change', resolve)) :
Promise.reject(new Error('No dev server running')),
onNextChange: () =>
devServer
? new Promise((resolve) => devServer.watcher.once('change', resolve))
: Promise.reject(new Error('No dev server running')),
};
}

Expand Down

0 comments on commit 42251f3

Please sign in to comment.