mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 14:00:13 +01:00
Split markdownlint-test-extra-* tests into separate files for (slightly) better concurrency.
This commit is contained in:
parent
442dcfe5b8
commit
0d9dfe7120
4 changed files with 1 additions and 77 deletions
|
|
@ -39,7 +39,7 @@
|
||||||
"test": "ava test/markdownlint-test.js test/markdownlint-test-config.js test/markdownlint-test-custom-rules.js test/markdownlint-test-helpers.js test/markdownlint-test-result-object.js test/markdownlint-test-scenarios.js",
|
"test": "ava test/markdownlint-test.js test/markdownlint-test-config.js test/markdownlint-test-custom-rules.js test/markdownlint-test-helpers.js test/markdownlint-test-result-object.js test/markdownlint-test-scenarios.js",
|
||||||
"test-cover": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 npm test",
|
"test-cover": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 npm test",
|
||||||
"test-declaration": "cd example/typescript && tsc && node type-check.js",
|
"test-declaration": "cd example/typescript && tsc && node type-check.js",
|
||||||
"test-extra": "ava --timeout=5m test/markdownlint-test-extra.js"
|
"test-extra": "ava --timeout=5m test/markdownlint-test-extra-parse.js test/markdownlint-test-extra-type.js"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
|
|
|
||||||
|
|
@ -2,32 +2,10 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const fs = require("fs");
|
|
||||||
const path = require("path");
|
|
||||||
const globby = require("globby");
|
const globby = require("globby");
|
||||||
const test = require("ava").default;
|
const test = require("ava").default;
|
||||||
const markdownlint = require("../lib/markdownlint");
|
const markdownlint = require("../lib/markdownlint");
|
||||||
|
|
||||||
// Simulates typing each test file to validate handling of partial input
|
|
||||||
const files = fs.readdirSync("./test");
|
|
||||||
files.filter((file) => /\.md$/.test(file)).forEach((file) => {
|
|
||||||
const strings = {};
|
|
||||||
let content = fs.readFileSync(path.join("./test", file), "utf8");
|
|
||||||
while (content) {
|
|
||||||
strings[content.length.toString()] = content;
|
|
||||||
content = content.slice(0, -1);
|
|
||||||
}
|
|
||||||
test(`type ${file}`, (t) => {
|
|
||||||
t.plan(1);
|
|
||||||
markdownlint.sync({
|
|
||||||
// @ts-ignore
|
|
||||||
strings,
|
|
||||||
"resultVersion": 0
|
|
||||||
});
|
|
||||||
t.pass();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Parses all Markdown files in all package dependencies
|
// Parses all Markdown files in all package dependencies
|
||||||
test.cb("parseAllFiles", (t) => {
|
test.cb("parseAllFiles", (t) => {
|
||||||
t.plan(1);
|
t.plan(1);
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const globby = require("globby");
|
|
||||||
const test = require("ava").default;
|
const test = require("ava").default;
|
||||||
const markdownlint = require("../lib/markdownlint");
|
const markdownlint = require("../lib/markdownlint");
|
||||||
|
|
||||||
|
|
@ -27,15 +26,3 @@ files.filter((file) => /\.md$/.test(file)).forEach((file) => {
|
||||||
t.pass();
|
t.pass();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Parses all Markdown files in all package dependencies
|
|
||||||
test.cb("parseAllFiles", (t) => {
|
|
||||||
t.plan(1);
|
|
||||||
const options = {
|
|
||||||
"files": globby.sync("**/*.{md,markdown}")
|
|
||||||
};
|
|
||||||
markdownlint(options, (err) => {
|
|
||||||
t.falsy(err);
|
|
||||||
t.end();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
// @ts-check
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
const fs = require("fs");
|
|
||||||
const path = require("path");
|
|
||||||
const globby = require("globby");
|
|
||||||
const test = require("ava").default;
|
|
||||||
const markdownlint = require("../lib/markdownlint");
|
|
||||||
|
|
||||||
// Simulates typing each test file to validate handling of partial input
|
|
||||||
const files = fs.readdirSync("./test");
|
|
||||||
files.filter((file) => /\.md$/.test(file)).forEach((file) => {
|
|
||||||
const strings = {};
|
|
||||||
let content = fs.readFileSync(path.join("./test", file), "utf8");
|
|
||||||
while (content) {
|
|
||||||
strings[content.length.toString()] = content;
|
|
||||||
content = content.slice(0, -1);
|
|
||||||
}
|
|
||||||
test(`type ${file}`, (t) => {
|
|
||||||
t.plan(1);
|
|
||||||
markdownlint.sync({
|
|
||||||
// @ts-ignore
|
|
||||||
strings,
|
|
||||||
"resultVersion": 0
|
|
||||||
});
|
|
||||||
t.pass();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Parses all Markdown files in all package dependencies
|
|
||||||
test.cb("parseAllFiles", (t) => {
|
|
||||||
t.plan(1);
|
|
||||||
const options = {
|
|
||||||
"files": globby.sync("**/*.{md,markdown}")
|
|
||||||
};
|
|
||||||
markdownlint(options, (err) => {
|
|
||||||
t.falsy(err);
|
|
||||||
t.end();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue