diff --git a/.github/workflows/fresh-deps.yml b/.github/workflows/fresh-deps.yml index 372c688..9ffb927 100644 --- a/.github/workflows/fresh-deps.yml +++ b/.github/workflows/fresh-deps.yml @@ -23,4 +23,6 @@ jobs: node-version: ${{ matrix.node }} - run: rm package-lock.json - run: npm i - - run: npm run check + - run: npm test + - run: npm run coverage + - run: npm run test:pack diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 61ced78..3523da3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,4 +22,6 @@ jobs: node-version: ${{ matrix.node }} cache: npm - run: npm ci - - run: npm run check + - run: npm test + - run: npm run coverage + - run: npm run test:pack diff --git a/biome.json b/biome.json index bca370a..1e3fa08 100644 --- a/biome.json +++ b/biome.json @@ -1,7 +1,7 @@ { "$schema": "https://biomejs.dev/schemas/2.5.0/schema.json", "vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true }, - "files": { "includes": ["src/**", "*.json"] }, + "files": { "includes": ["src/**", "test/**"] }, "formatter": { "enabled": true, "indentStyle": "space", "indentWidth": 2, "lineWidth": 100 }, "javascript": { "formatter": { "quoteStyle": "single", "semicolons": "asNeeded", "trailingCommas": "none" } diff --git a/package.json b/package.json index b228c24..0dad950 100644 --- a/package.json +++ b/package.json @@ -56,18 +56,19 @@ "url": "git+https://github.com/ungoldman/hyperaxe.git" }, "scripts": { - "build": "rm -rf dist && tsc -p tsconfig.build.json", - "check": "npm run lint && npm run typecheck && npm test && npx publint && npm run test:pack", + "build": "tsc", + "coverage": "node --test --experimental-test-coverage --import=tsx --test-coverage-exclude='test/**' --test-coverage-lines=100 --test-coverage-branches=100 --test-coverage-functions=100 test/*.test.ts", "format": "biome check --write .", "lint": "biome check .", "postrelease": "git push --follow-tags && npm publish", + "prebuild": "rm -rf dist", "prepare": "npm run build", - "prerelease": "git fetch --tags && npm run check", + "prerelease": "git fetch --tags && npm test && npm run test:pack", "release": "npm version patch", - "test": "node --test --import=tsx src/**/*.spec.ts", + "test": "npm run lint && npm run typecheck && npm run build && node --test --import=tsx test/*.test.ts", "test:pack": "bash scripts/test-pack.sh", - "test:watch": "node --test --watch --import=tsx src/**/*.spec.ts", - "typecheck": "tsc --noEmit" + "test:watch": "node --test --watch --import=tsx test/*.test.ts", + "typecheck": "tsc -p tsconfig.test.json" }, "type": "module", "types": "dist/index.d.ts" diff --git a/src/index.spec.ts b/test/index.test.ts similarity index 96% rename from src/index.spec.ts rename to test/index.test.ts index e26add4..4303e89 100644 --- a/src/index.spec.ts +++ b/test/index.test.ts @@ -2,9 +2,9 @@ import { strict as assert } from 'node:assert' import { describe, test } from 'node:test' import tags from 'html-tags' import h from 'hyperscript' -import type { CreateElementFunction } from './factory.js' -import * as namedExports from './index.js' -import hyperaxe, { getFactory, varTag } from './index.js' +import type { CreateElementFunction } from '../src/factory.js' +import * as namedExports from '../src/index.js' +import hyperaxe, { getFactory, varTag } from '../src/index.js' describe('Hyperaxe Factory', () => { test('factory function signature', () => { diff --git a/tsconfig.build.json b/tsconfig.build.json deleted file mode 100644 index a7bc7b8..0000000 --- a/tsconfig.build.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "noEmit": false - }, - "exclude": ["src/**/*.spec.ts"] -} diff --git a/tsconfig.json b/tsconfig.json index e3c519e..9f6e466 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,10 +9,8 @@ "outDir": "dist", "rootDir": "src", "declaration": true, - "noEmit": true, "strict": true, "esModuleInterop": true, - "types": ["node"], "skipLibCheck": true, "noUnusedLocals": true, "noUnusedParameters": true, @@ -22,5 +20,5 @@ "forceConsistentCasingInFileNames": true, "resolveJsonModule": true }, - "include": ["src/**/*"] + "include": ["src"] } diff --git a/tsconfig.test.json b/tsconfig.test.json new file mode 100644 index 0000000..badb66a --- /dev/null +++ b/tsconfig.test.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "noEmit": true, + "rootDir": ".", + "types": ["node"] + }, + "include": ["src", "test"] +}