From b9e85312738504b266862f59127d525b1054af2d Mon Sep 17 00:00:00 2001 From: David Anson Date: Fri, 3 Jan 2025 23:13:08 -0800 Subject: [PATCH] Add test to execute compiled type-check code for CommonJS, parallelize declaration tests for an overall runtime reduction. --- eslint.config.mjs | 2 +- example/typescript/.gitignore | 2 +- example/typescript/type-check.ts | 1 - package.json | 4 +++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 2bf6cec78..ffe22ea39 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -25,7 +25,7 @@ export default [ "demo/markdown-it.min.js", "demo/markdownlint-browser.js", "demo/markdownlint-browser.min.js", - "example/typescript/type-check.js", + "example/typescript/type-check-*", "test-repos/**" ] }, diff --git a/example/typescript/.gitignore b/example/typescript/.gitignore index 50363b8f6..2918a873c 100644 --- a/example/typescript/.gitignore +++ b/example/typescript/.gitignore @@ -1 +1 @@ -type-check.js +type-check-* diff --git a/example/typescript/type-check.ts b/example/typescript/type-check.ts index 725deade2..8b5016760 100644 --- a/example/typescript/type-check.ts +++ b/example/typescript/type-check.ts @@ -7,7 +7,6 @@ import { lint as lintPromise, readConfig as readConfigPromise } from "../../lib/ import { lint as lintSync, readConfig as readConfigSync } from "../../lib/exports-sync.mjs"; import assert from "assert"; -// @ts-expect-error TS7016: Could not find a declaration file for module 'markdown-it-sub'. import markdownItSub from "markdown-it-sub"; const markdownlintJsonPath = "../../.markdownlint.json"; diff --git a/package.json b/package.json index 28382424c..ac3f071ea 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,9 @@ "serial-declaration": "npm run build-declaration && npm run test-declaration", "test": "ava --timeout=30s test/markdownlint-test.mjs test/markdownlint-test-config.mjs test/markdownlint-test-custom-rules.mjs test/markdownlint-test-fixes.mjs test/markdownlint-test-helpers.mjs test/markdownlint-test-micromark.mjs test/markdownlint-test-result-object.mjs test/markdownlint-test-scenarios.mjs helpers/test.cjs", "test-cover": "c8 --100 npm test", - "test-declaration": "cd example/typescript && tsc --module commonjs && tsc --module nodenext && node type-check.js", + "test-declaration": "npm-run-all --continue-on-error --parallel test-declaration-cts test-declaration-mts", + "test-declaration-cts": "cd example/typescript && node ../../scripts/index.mjs copy type-check.ts type-check-commonjs.cts && tsc --module commonjs --esModuleInterop type-check-commonjs.cts && node --disable-warning=ExperimentalWarning type-check-commonjs.cjs", + "test-declaration-mts": "cd example/typescript && node ../../scripts/index.mjs copy type-check.ts type-check-nodenext.mts && tsc --module nodenext type-check-nodenext.mts && node type-check-nodenext.mjs", "test-extra": "ava --timeout=10m test/markdownlint-test-extra-parse.mjs test/markdownlint-test-extra-type.mjs", "update-snapshots": "ava --update-snapshots test/markdownlint-test-custom-rules.mjs test/markdownlint-test-micromark.mjs test/markdownlint-test-scenarios.mjs", "update-snapshots-test-repos": "ava --timeout=10m --update-snapshots test/markdownlint-test-repos-*.mjs",