From 11f6db78092c675d165184b926b729c66e74e3d9 Mon Sep 17 00:00:00 2001 From: Michael Morris Date: Mon, 20 Mar 2023 15:30:54 -0400 Subject: [PATCH 1/3] Optimization in place, weird test fail - checking master --- src/api/support.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/api/support.ts b/src/api/support.ts index 87358260a..ab753ca87 100644 --- a/src/api/support.ts +++ b/src/api/support.ts @@ -24,10 +24,13 @@ export async function getSupportCodeLibrary({ requirePaths, importPaths, }) + const importPromises:Array> = [] + requireModules.map((module) => require(module)) requirePaths.map((path) => require(path)) - for (const path of importPaths) { - await importer(pathToFileURL(path)) - } + importPaths.map((path) => importPromises.push(importer(pathToFileURL(path)))) + + await Promise.all(importPromises) + return supportCodeLibraryBuilder.finalize() } From b025155ac1eec5b4fc29da85ccea1ee34ce0c2f3 Mon Sep 17 00:00:00 2001 From: Michael Morris Date: Mon, 20 Mar 2023 15:41:32 -0400 Subject: [PATCH 2/3] Tests clean, ready for PR --- src/api/support.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/api/support.ts b/src/api/support.ts index ab753ca87..0c8fb4f84 100644 --- a/src/api/support.ts +++ b/src/api/support.ts @@ -19,12 +19,13 @@ export async function getSupportCodeLibrary({ requirePaths: string[] importPaths: string[] }): Promise { + const importPromises: Array> = [] + supportCodeLibraryBuilder.reset(cwd, newId, { requireModules, requirePaths, importPaths, }) - const importPromises:Array> = [] requireModules.map((module) => require(module)) requirePaths.map((path) => require(path)) From 5a9d473b50ded1fcbdc4c8e019fab7cb2ba7bc2b Mon Sep 17 00:00:00 2001 From: Michael Morris Date: Mon, 20 Mar 2023 15:50:49 -0400 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1901bfbd2..432f7f0b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). Please see [CONTRIBUTING.md](./CONTRIBUTING.md) on how to contribute to Cucumber. ## [Unreleased] +- Perform dynamic imports in parallel using Promise.all instead of sequentially by awaiting in a loop ([#2263](https://github.com/cucumber/cucumber-js/pull/2263)) ## [9.0.1] - 2023-03-15 ### Fixed