diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7bf61f78..d34bf36f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -92,9 +92,7 @@ jobs: # Custom script, because progress looks not good in CI - name: Run tests - env: - CFLAGS: -O0 - run: npx mocha --timeout 30000 -r ts-node/register/type-check test/*-test.ts + run: npm run test lint: name: Run ESLint diff --git a/docs/releasing.md b/docs/releasing.md index f83e0f7c..02e26c7a 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -15,11 +15,12 @@ These are the required steps to release a new version of llhttp: First of all, make sure you have [GitHub CLI](https://cli.github.com) installed and configured. While this is not strictly necessary, it will make your life way easier. -As a preliminary check, run the build command and execute the test suite locally: +As a preliminary check, lint the code, run the build command and execute the test suite locally: ``` +npm run lint npm run build -npm test +npm run test ``` If all goes good, you are ready to go! diff --git a/package-lock.json b/package-lock.json index 7ba168c6..b9734570 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,6 @@ }, "devDependencies": { "@stylistic/eslint-plugin": "^1.5.4", - "@types/mocha": "^10.0.6", "@types/node": "^20.11.10", "@typescript-eslint/eslint-plugin": "^6.20.0", "@typescript-eslint/parser": "^6.20.0", @@ -21,7 +20,6 @@ "llparse-dot": "^1.0.1", "llparse-test-fixture": "^5.0.1", "mdgator": "^1.1.2", - "mocha": "^10.2.0", "ts-node": "^10.9.2", "typescript": "^5.3.3" } diff --git a/package.json b/package.json index 5a49d4ee..a8bf8e0c 100644 --- a/package.json +++ b/package.json @@ -17,10 +17,10 @@ "wasm": "ts-node bin/build_wasm.ts", "clean": "rm -rf lib && rm -rf test/tmp", "prepare": "npm run clean && npm run build-ts", + "test": "node -r ts-node/register/type-check --test ./test/*-test.ts", "lint": "eslint -c eslint.json bin/*.ts src/*.ts src/**/*.ts test/*.ts test/**/*.ts", "lint-fix": "eslint --fix -c eslint.json bin/*.ts src/*.ts src/**/*.ts test/*.ts test/**/*.ts", "mocha": "mocha --timeout=10000 -r ts-node/register/type-check --reporter progress test/*-test.ts", - "test": "npm run mocha && npm run lint", "postversion": "RELEASE=`node -e \"process.stdout.write(require('./package').version)\"` make -B postversion", "github-release": "RELEASE_V=`node -e \"process.stdout.write('v' + require('./package').version)\"` make github-release" }, @@ -42,7 +42,6 @@ "homepage": "https://github.com/nodejs/llhttp#readme", "devDependencies": { "@stylistic/eslint-plugin": "^1.5.4", - "@types/mocha": "^10.0.6", "@types/node": "^20.11.10", "@typescript-eslint/eslint-plugin": "^6.20.0", "@typescript-eslint/parser": "^6.20.0", @@ -50,7 +49,6 @@ "llparse-dot": "^1.0.1", "llparse-test-fixture": "^5.0.1", "mdgator": "^1.1.2", - "mocha": "^10.2.0", "ts-node": "^10.9.2", "typescript": "^5.3.3" }, diff --git a/test/md-test.ts b/test/md-test.ts index ef0e6335..77305b23 100644 --- a/test/md-test.ts +++ b/test/md-test.ts @@ -1,4 +1,5 @@ -import * as assert from 'assert'; +import * as assert from 'node:assert'; +import { describe, test } from 'node:test'; import * as fs from 'fs'; import { LLParse } from 'llparse'; import { Group, MDGator, Metadata, Test } from 'mdgator'; @@ -92,7 +93,7 @@ function run(name: string): void { function runSingleTest(ty: TestType, meta: Metadata, input: string, expected: ReadonlyArray): void { - it(`should pass for type="${ty}"`, async () => { + test(`should pass for type="${ty}"`, { timeout: 60000 }, async () => { const binary = await buildMode(ty, meta); await binary.check(input, expected, { noScan: meta.noScan === true, @@ -208,8 +209,6 @@ function run(name: string): void { function runGroup(group: Group) { describe(group.name + ` at ${name}.md:${group.line + 1}`, function () { - this.timeout(60000); - for (const child of group.children) { runGroup(child); }