diff --git a/CHANGELOG.md b/CHANGELOG.md index a53e7d239..8610ec659 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,10 @@ ## 0.37.0 -- Convert to ECMAScript module, for guidance see: +- Convert module to ECMAScript (breaking change) - - +- Convert module to named exports (breaking change) ## 0.36.1 diff --git a/test/markdownlint-test.mjs b/test/markdownlint-test.mjs index 96e0d49fd..94dbaa503 100644 --- a/test/markdownlint-test.mjs +++ b/test/markdownlint-test.mjs @@ -1386,17 +1386,19 @@ test("exportMappings", (t) => { ); }); -// const commonJsRe = /\.js$/u; const jsonRe = /\.json$/u; const importOptionsJson = { "with": { "type": "json" } }; +const makeExportMappingTest = (exportName, exportPath) => async(t) => { + const json = jsonRe.test(exportPath); + const importOptions = json ? importOptionsJson : undefined; + const [ importExportName, importExportPath ] = await Promise.all([ + import(exportName.replace(/^\./u, packageJson.name), importOptions), + import(exportPath, importOptions) + ]); + t.is(importExportName, importExportPath); +}; + for (const [ exportName, exportPath ] of exportMappings) { - test(exportName, async(t) => { - // const commonJs = !commonJsRe.test(exportPath); - const json = jsonRe.test(exportPath); - const importOptions = json ? importOptionsJson : undefined; - const importExportName = await import(exportName.replace(/^\./u, packageJson.name), importOptions); - const importExportPath = await import(exportPath, importOptions); - t.is(importExportName, importExportPath); - }); + test(exportName, makeExportMappingTest(exportName, exportPath)); }