From cfa5b3ca0cb7b0d8dd3ec46b4a3f1f34d0836758 Mon Sep 17 00:00:00 2001 From: tolauwae Date: Fri, 6 Dec 2024 11:50:45 +0100 Subject: [PATCH] Fix prebuilding of test files --- .gitignore | 4 +++- package.json | 5 ++-- tests/{unit.ts => unit/interface.ts} | 2 +- tsconfig.json | 35 ++++++++++++++-------------- 4 files changed, 24 insertions(+), 22 deletions(-) rename tests/{unit.ts => unit/interface.ts} (93%) diff --git a/.gitignore b/.gitignore index 319de85..c48ba94 100644 --- a/.gitignore +++ b/.gitignore @@ -48,6 +48,8 @@ dist/ # IDE folders .idea +# built ava test files +out + # c8 Coverage coverage -out diff --git a/package.json b/package.json index 0f3da25..223300b 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,8 @@ "build:cjs": "tsc --project tsconfig.build.json --module commonjs --outDir dist/cjs && npx convert-extension cjs dist/cjs/ && rm -f dist/cjs/*.map", "watch": "tsc -watch -p ./", "lint": "eslint src/**/* --config .eslint.config.mjs", - "test:all": "npx ts-node tests/test.ts && npm run test:ava", + "test:prebuild": "npm run build && npx tsc tests/unit/* --outDir out", + "test:all": "npm run test:prebuild && npm run test:ava", "test:ava": "ava", "test:coverage": "c8 --src src/ --all ava" }, @@ -52,7 +53,7 @@ }, "ava": { "files": [ - "out/tests/unit.js" + "out/tests/unit/interface.js" ], "typescript": { "compile": "tsc", diff --git a/tests/unit.ts b/tests/unit/interface.ts similarity index 93% rename from tests/unit.ts rename to tests/unit/interface.ts index b539798..1e35a09 100644 --- a/tests/unit.ts +++ b/tests/unit/interface.ts @@ -1,5 +1,5 @@ import test from 'ava'; -import {getFileExtension} from '../src/util/util'; +import {getFileExtension} from '../../src/util/util'; test('[internal] test util/getFileExtension', t => { t.is(getFileExtension('test.wast'), 'wast'); diff --git a/tsconfig.json b/tsconfig.json index bfebe49..7346343 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,20 +1,19 @@ { - "compilerOptions": { - "module": "commonjs", - "moduleResolution": "node", - "target": "ES2020", - "outDir": "out", - "lib": [ - "ES2020" - ], - "rootDir": ".", - "sourceMap": true, - "strict": true, - "allowSyntheticDefaultImports": true, - "resolveJsonModule": true - }, - "exclude": [ - "example", - "WABT" - ] + "compilerOptions": { + "module": "commonjs", + "moduleResolution": "node", + "target": "ES2020", + "outDir": "out", + "lib": [ + "ES2020" + ], + "rootDir": ".", + "sourceMap": true, + "strict": true, + "allowSyntheticDefaultImports": true, + "resolveJsonModule": true + }, + "exclude": [ + "WABT" + ] }