diff --git a/lib/internal/modules/esm/loader.js b/lib/internal/modules/esm/loader.js index 5d90b5f4c8c..03317d13916 100644 --- a/lib/internal/modules/esm/loader.js +++ b/lib/internal/modules/esm/loader.js @@ -471,6 +471,10 @@ class ModuleLoader { const resolvedImportAttributes = resolveResult.importAttributes ?? importAttributes; let job = this.loadCache.get(url, resolvedImportAttributes.type); if (job !== undefined) { + // TODO(node:55782): this race may stop happening when the ESM resolution and loading become synchronous. + if (!job.module) { + assert.fail(getRaceMessage(url, parentURL)); + } // This module is being evaluated, which means it's imported in a previous link // in a cycle. if (job.module.getStatus() === kEvaluating) {