diff --git a/package.json b/package.json index 99eda00..1c11741 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "test": "npm run webpack && npm run test:eslint && npm run test:unit-tests", "test:eslint": "eslint .", "test:morningstar": "npx -y newman run --bail tmp/Collection.json -e tmp/Environment.json", - "test:unit-tests": "ts-node test/unit-tests/runtime", + "test:unit-tests": "ts-node tools/unit-tests", "watch": "tsc -p src/ -w", "webpack": "npm run scripts && webpack && npm run webpack:dts", "webpack:dts": "npm run webpack:dts:cm && npm run webpack:dts:dbm && npm run webpack:dts:dgm && npm run webpack:dts:hcm", diff --git a/test/unit-tests/runtime.ts b/tools/unit-tests.ts similarity index 93% rename from test/unit-tests/runtime.ts rename to tools/unit-tests.ts index 1e42820..88c3eb4 100644 --- a/test/unit-tests/runtime.ts +++ b/tools/unit-tests.ts @@ -25,11 +25,12 @@ * */ -import type { Shared } from '../../code/connectors-morningstar.src'; +import type { Shared } from '../code/connectors-morningstar.src'; import * as FS from 'node:fs/promises'; import * as FSSync from 'node:fs'; import * as JSDOM from 'jsdom'; +import * as Path from 'node:path'; /* * @@ -125,11 +126,12 @@ async function runUnitTests () { const failures: Array = []; const successes: Array = []; const stdout = process.stdout; + const testFolder = Path.join('test', 'unit-tests'); let test: unknown; let unitTests: Record; - for (let path of (await FS.readdir(__dirname, { recursive: true })).sort()) { + for (let path of (await FS.readdir(testFolder, { recursive: true })).sort()) { if (!path.endsWith('.test.ts')) { continue; @@ -137,7 +139,7 @@ async function runUnitTests () { stdWrite('Start', path.substring(0, path.length - 8), 'tests ...\n'); - path = './' + path.substring(0, path.length - 3); + path = Path.join(__dirname, '..', testFolder, path.substring(0, path.length - 3)); unitTests = await import(path) as Record; for (let testName of Object.keys(unitTests)) {