Switch from deprecated nodeunit test runner to tape.

This commit is contained in:
David Anson 2020-01-08 22:13:51 -08:00
parent 61e0ac314c
commit 3c100a21ff
3 changed files with 1030 additions and 1078 deletions

View file

@ -13,10 +13,10 @@
},
"bugs": "https://github.com/DavidAnson/markdownlint/issues",
"scripts": {
"test": "nodeunit test/markdownlint-test.js",
"test-cover": "nyc --check-coverage --skip-full node_modules/nodeunit/bin/nodeunit test/markdownlint-test.js",
"test": "node test/markdownlint-test.js",
"test-cover": "nyc --check-coverage --skip-full node test/markdownlint-test.js",
"test-declaration": "cd example/typescript && tsc && node type-check.js",
"test-extra": "nodeunit test/markdownlint-test-extra.js",
"test-extra": "node test/markdownlint-test-extra.js",
"debug": "node debug node_modules/nodeunit/bin/nodeunit",
"lint": "eslint lib helpers test schema && eslint --env browser --global markdownit --global markdownlint --rule \"no-unused-vars: 0, no-extend-native: 0, max-statements: 0, no-console: 0, no-var: 0\" demo && eslint --rule \"no-console: 0, no-invalid-this: 0, no-shadow: 0, object-property-newline: 0\" example",
"ci": "npm run test-cover && npm run lint && npm run test-declaration",
@ -44,9 +44,9 @@
"markdown-it-sub": "~1.0.0",
"markdown-it-sup": "~1.0.0",
"markdownlint-rule-helpers": "~0.5.0",
"nodeunit": "~0.11.3",
"nyc": "~14.1.1",
"rimraf": "~3.0.0",
"tape": "~4.12.1",
"toml": "~3.0.0",
"tv4": "~1.3.0",
"typescript": "~3.7.3",

View file

@ -5,6 +5,7 @@
const fs = require("fs");
const path = require("path");
const glob = require("glob");
const tape = require("tape");
const markdownlint = require("../lib/markdownlint");
const { utf8Encoding } = require("../helpers");
@ -17,18 +18,21 @@ files.filter((file) => /\.md$/.test(file)).forEach((file) => {
strings[content.length.toString()] = content;
content = content.slice(0, -1);
}
module.exports[`type ${file}`] = (test) => {
tape(`type ${file}`, (test) => {
test.plan(1);
markdownlint.sync({
// @ts-ignore
strings,
"resultVersion": 0
});
test.done();
};
test.pass();
test.end();
});
});
// Parses all Markdown files in all package dependencies
module.exports.parseAllFiles = (test) => {
tape("parseAllFiles", (test) => {
test.plan(2);
const globOptions = {
// "cwd": "/",
"realpath": true
@ -40,7 +44,7 @@ module.exports.parseAllFiles = (test) => {
};
markdownlint(markdownlintOptions, (errr) => {
test.ifError(errr);
test.done();
test.end();
});
});
};
});

File diff suppressed because it is too large Load diff