diff --git a/.github/workflows/test-repos.yml b/.github/workflows/test-repos.yml index 6004d1c5..c02ba8fb 100644 --- a/.github/workflows/test-repos.yml +++ b/.github/workflows/test-repos.yml @@ -24,7 +24,7 @@ jobs: - name: Install Dependencies run: npm install --no-package-lock - name: Clone Test Repos - run: npm run clone-test-repos-large + run: npm run clone-test-repos - name: Lint Test Repos run: npm run lint-test-repos - name: Run Extra Tests diff --git a/package.json b/package.json index 80c3322b..aadd15aa 100644 --- a/package.json +++ b/package.json @@ -38,8 +38,7 @@ "clone-test-repos-v8-v8-dev": "cd test-repos && git clone https://github.com/v8/v8.dev v8-v8-dev --depth 1 --no-tags --quiet", "clone-test-repos-webhintio-hint": "cd test-repos && git clone https://github.com/webhintio/hint webhintio-hint --depth 1 --no-tags --quiet", "clone-test-repos-webpack-webpack-js-org": "cd test-repos && git clone https://github.com/webpack/webpack.js.org webpack-webpack-js-org --depth 1 --no-tags --quiet", - "clone-test-repos": "mkdir test-repos && cd test-repos && npm run clone-test-repos-eslint-eslint && npm run clone-test-repos-mkdocs-mkdocs && npm run clone-test-repos-mochajs-mocha && npm run clone-test-repos-pi-hole-docs && npm run clone-test-repos-webhintio-hint && npm run clone-test-repos-webpack-webpack-js-org", - "clone-test-repos-large": "npm run clone-test-repos && cd test-repos && npm run clone-test-repos-dotnet-docs && npm run clone-test-repos-v8-v8-dev", + "clone-test-repos": "mkdir test-repos && cd test-repos && npm run clone-test-repos-dotnet-docs && npm run clone-test-repos-eslint-eslint && npm run clone-test-repos-mkdocs-mkdocs && npm run clone-test-repos-mochajs-mocha && npm run clone-test-repos-pi-hole-docs && npm run clone-test-repos-v8-v8-dev && npm run clone-test-repos-webhintio-hint && npm run clone-test-repos-webpack-webpack-js-org", "declaration": "npm run build-declaration && npm run test-declaration", "example": "cd example && node standalone.js && grunt markdownlint --force && gulp markdownlint", "docker-npm-install": "docker run --rm --tty --name npm-install --volume $PWD:/home/workdir --workdir /home/workdir --user node node:16 npm install", diff --git a/test/markdownlint-test-repos.js b/test/markdownlint-test-repos.js index 7d32e9c8..5bc57700 100644 --- a/test/markdownlint-test-repos.js +++ b/test/markdownlint-test-repos.js @@ -2,7 +2,6 @@ "use strict"; -const { existsSync } = require("node:fs"); const { join } = require("node:path").posix; const { promisify } = require("node:util"); const jsYaml = require("js-yaml"); @@ -97,6 +96,7 @@ async function lintTestRepo(t, globPatterns, configPath, ignoreRes) { // }); }).then((results) => { // Fail if any issues were found (that aren't ignored) + // @ts-ignore let resultsString = results.toString(); for (const ignoreRe of (ignoreRes || [])) { const lengthBefore = resultsString.length; @@ -128,6 +128,13 @@ function excludeGlobs(rootDir, ...globs) { // Run markdownlint the same way the corresponding repositories do /* eslint-disable max-len */ +test("https://github.com/dotnet/docs", (t) => { + const rootDir = "./test-repos/dotnet-docs"; + const globPatterns = [ join(rootDir, "**/*.md") ]; + const configPath = join(rootDir, ".markdownlint-cli2.jsonc"); + return lintTestRepo(t, globPatterns, configPath); +}); + test("https://github.com/eslint/eslint", (t) => { const rootDir = "./test-repos/eslint-eslint"; const globPatterns = [ join(rootDir, "docs/**/*.md") ]; @@ -180,6 +187,13 @@ test("https://github.com/pi-hole/docs", (t) => { return lintTestRepo(t, globPatterns, configPath); }); +test("https://github.com/v8/v8.dev", (t) => { + const rootDir = "./test-repos/v8-v8-dev"; + const globPatterns = [ join(rootDir, "src/**/*.md") ]; + const configPath = join(rootDir, ".markdownlint.json"); + return lintTestRepo(t, globPatterns, configPath); +}); + test("https://github.com/webhintio/hint", (t) => { const rootDir = "./test-repos/webhintio-hint"; const globPatterns = [ @@ -219,25 +233,3 @@ test("https://github.com/webpack/webpack.js.org", (t) => { const configPath = join(rootDir, ".markdownlint.json"); return lintTestRepo(t, globPatterns, configPath); }); - -// Optional repositories (very large) - -const dotnetDocsDir = "./test-repos/dotnet-docs"; -if (existsSync(dotnetDocsDir)) { - test("https://github.com/dotnet/docs", (t) => { - const rootDir = dotnetDocsDir; - const globPatterns = [ join(rootDir, "**/*.md") ]; - const configPath = join(rootDir, ".markdownlint-cli2.jsonc"); - return lintTestRepo(t, globPatterns, configPath); - }); -} - -const v8v8DevDir = "./test-repos/v8-v8-dev"; -if (existsSync(v8v8DevDir)) { - test("https://github.com/v8/v8.dev", (t) => { - const rootDir = v8v8DevDir; - const globPatterns = [ join(rootDir, "src/**/*.md") ]; - const configPath = join(rootDir, ".markdownlint.json"); - return lintTestRepo(t, globPatterns, configPath); - }); -}