mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-18 23:10:12 +01:00
Update export test to avoid "ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time".
This commit is contained in:
parent
8e5f699bb2
commit
df33933fe5
1 changed files with 10 additions and 5 deletions
|
|
@ -1388,15 +1388,20 @@ test("exportMappings", (t) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const jsonRe = /\.json$/u;
|
const jsonRe = /\.json$/u;
|
||||||
const importOptionsJson = { "with": { "type": "json" } };
|
// ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
|
||||||
|
// const importOptionsJson = { "with": { "type": "json" } };
|
||||||
|
|
||||||
for (const [ exportName, exportPath ] of exportMappings) {
|
for (const [ exportName, exportPath ] of exportMappings) {
|
||||||
test(exportName, async(t) => {
|
test(exportName, async(t) => {
|
||||||
const json = jsonRe.test(exportPath);
|
const json = jsonRe.test(exportPath);
|
||||||
const importOptions = json ? importOptionsJson : undefined;
|
const exportByName = exportName.replace(/^\./u, packageJson.name);
|
||||||
const importExportName = await import(exportName.replace(/^\./u, packageJson.name), importOptions);
|
const importExportByName = json ?
|
||||||
const importExportPath = await import(exportPath, importOptions);
|
require(exportByName) :
|
||||||
t.is(importExportName, importExportPath);
|
await import(exportByName);
|
||||||
|
const importExportByPath = json ?
|
||||||
|
require(exportPath) :
|
||||||
|
await import(exportPath);
|
||||||
|
t.is(importExportByName, importExportByPath);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue