mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Deprecate options.resultVersion via typing, continue to support at run-time, provide format converters in markdownlint/helpers for migration.
Some checks failed
Checkers / linkcheck (push) Has been cancelled
Checkers / spellcheck (push) Has been cancelled
CI / build (20, macos-latest) (push) Has been cancelled
CI / build (20, ubuntu-latest) (push) Has been cancelled
CI / build (20, windows-latest) (push) Has been cancelled
CI / build (22, macos-latest) (push) Has been cancelled
CI / build (22, ubuntu-latest) (push) Has been cancelled
CI / build (22, windows-latest) (push) Has been cancelled
CI / build (24, macos-latest) (push) Has been cancelled
CI / build (24, ubuntu-latest) (push) Has been cancelled
CI / build (24, windows-latest) (push) Has been cancelled
CI / pnpm (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
TestRepos / build (latest, ubuntu-latest) (push) Has been cancelled
UpdateTestRepos / update (push) Has been cancelled
Some checks failed
Checkers / linkcheck (push) Has been cancelled
Checkers / spellcheck (push) Has been cancelled
CI / build (20, macos-latest) (push) Has been cancelled
CI / build (20, ubuntu-latest) (push) Has been cancelled
CI / build (20, windows-latest) (push) Has been cancelled
CI / build (22, macos-latest) (push) Has been cancelled
CI / build (22, ubuntu-latest) (push) Has been cancelled
CI / build (22, windows-latest) (push) Has been cancelled
CI / build (24, macos-latest) (push) Has been cancelled
CI / build (24, ubuntu-latest) (push) Has been cancelled
CI / build (24, windows-latest) (push) Has been cancelled
CI / pnpm (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
TestRepos / build (latest, ubuntu-latest) (push) Has been cancelled
UpdateTestRepos / update (push) Has been cancelled
This commit is contained in:
parent
5729b279c2
commit
bfd89b77de
9 changed files with 191 additions and 74 deletions
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
import test from "ava";
|
||||
import { lint as lintAsync } from "markdownlint/async";
|
||||
import { lint as lintPromise } from "markdownlint/promise";
|
||||
import { lint as lintSync } from "markdownlint/sync";
|
||||
import { convertToResultVersion0, convertToResultVersion1, convertToResultVersion2 } from "markdownlint/helpers";
|
||||
import { importWithTypeJson } from "./esm-helpers.mjs";
|
||||
const packageJson = await importWithTypeJson(import.meta, "../package.json");
|
||||
const { homepage, version } = packageJson;
|
||||
|
|
@ -623,3 +625,40 @@ test("frontMatterResultVersion3", (t) => new Promise((resolve) => {
|
|||
resolve();
|
||||
});
|
||||
}));
|
||||
|
||||
test("convertToResultVersionN", async(t) => {
|
||||
t.plan(8);
|
||||
const options = {
|
||||
"files": [
|
||||
"./test/break-all-the-rules.md",
|
||||
"./test/inline-disable-enable.md"
|
||||
],
|
||||
"strings": {
|
||||
"first": "# Heading",
|
||||
"second": "## Heading"
|
||||
}
|
||||
};
|
||||
const [ base, version3, version2, version1, version0 ] = await Promise.all([
|
||||
lintPromise(options),
|
||||
// @ts-ignore
|
||||
lintPromise({ ...options, "resultVersion": 3 }),
|
||||
// @ts-ignore
|
||||
lintPromise({ ...options, "resultVersion": 2 }),
|
||||
// @ts-ignore
|
||||
lintPromise({ ...options, "resultVersion": 1 }),
|
||||
// @ts-ignore
|
||||
lintPromise({ ...options, "resultVersion": 0 })
|
||||
]);
|
||||
const v3 = version3;
|
||||
t.deepEqual(v3, base);
|
||||
t.is(v3.toString(), base.toString());
|
||||
const v2 = convertToResultVersion2(base);
|
||||
t.deepEqual(v2, version2);
|
||||
t.is(v2.toString(), version2.toString());
|
||||
const v1 = convertToResultVersion1(base);
|
||||
t.deepEqual(v1, version1);
|
||||
t.is(v1.toString(), version1.toString());
|
||||
const v0 = convertToResultVersion0(base);
|
||||
t.deepEqual(v0, version0);
|
||||
t.is(v0.toString(), version0.toString());
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue