Skip to content

Commit

Permalink
test: use Promise.all instead of for await
Browse files Browse the repository at this point in the history
  • Loading branch information
metonym committed Apr 6, 2024
1 parent abf2c66 commit 49651ab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/test-snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const TS_DEF_FILE = "output.d.ts";
const input_files = await fsp.readdir(SNAPSHOTS_FOLDER);
const parser = new ComponentParser({ verbose: true });

for await (const file of input_files) {
const promises = input_files.map(async (file) => {
const input_path = path.join(SNAPSHOTS_FOLDER, file, INPUT_FILE);
const output_path = path.join(SNAPSHOTS_FOLDER, file, OUTPUT_FILE);
const ts_def_path = path.join(SNAPSHOTS_FOLDER, file, TS_DEF_FILE);
Expand All @@ -31,7 +31,8 @@ const TS_DEF_FILE = "output.d.ts";

await fsp.writeFile(output_path, JSON.stringify(parsed_component, null, 2));
await writer.write(ts_def_path, writeTsDefinition(component_api));
}
});

await Promise.all(promises);
parser.cleanup();
})();

0 comments on commit 49651ab

Please sign in to comment.