mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 14:00:13 +01:00
Remove import of node:util and manually implement promisify (improves browser scenario), improve JSDoc typing.
This commit is contained in:
parent
3599f694ba
commit
789190962c
5 changed files with 62 additions and 25 deletions
|
|
@ -1,5 +1,6 @@
|
|||
// @ts-check
|
||||
|
||||
import fs from "node:fs";
|
||||
import { createRequire } from "node:module";
|
||||
const require = createRequire(import.meta.url);
|
||||
import os from "node:os";
|
||||
|
|
@ -516,7 +517,10 @@ test("extendSinglePromise", (t) => new Promise((resolve) => {
|
|||
t.plan(1);
|
||||
const expected = require("./config/config-child.json");
|
||||
markdownlint.promises.extendConfig(
|
||||
expected, "./test/config/config-child.json"
|
||||
expected,
|
||||
"./test/config/config-child.json",
|
||||
undefined,
|
||||
fs
|
||||
)
|
||||
.then((actual) => {
|
||||
t.deepEqual(actual, expected, "Config object not correct.");
|
||||
|
|
@ -524,6 +528,26 @@ test("extendSinglePromise", (t) => new Promise((resolve) => {
|
|||
});
|
||||
}));
|
||||
|
||||
test("extendBadPromise", (t) => new Promise((resolve) => {
|
||||
t.plan(2);
|
||||
markdownlint.promises.extendConfig(
|
||||
{
|
||||
"extends": "missing.json"
|
||||
},
|
||||
"./test/config/missing.json",
|
||||
undefined,
|
||||
fs
|
||||
)
|
||||
.then(
|
||||
null,
|
||||
(error) => {
|
||||
t.truthy(error, "Did not get an error for bad input.");
|
||||
t.true(error instanceof Error, "Error not instance of Error.");
|
||||
resolve();
|
||||
}
|
||||
);
|
||||
}));
|
||||
|
||||
test("extendCustomFileSystemPromise", (t) => new Promise((resolve) => {
|
||||
t.plan(4);
|
||||
const file = path.resolve("/dir/file.json");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue