Skip to content

Commit

Permalink
Tools: Moved runtime for unit-tests to tools.
Browse files Browse the repository at this point in the history
  • Loading branch information
bre1470 committed Sep 17, 2024
1 parent f45d3f5 commit 575d7b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 5 additions & 3 deletions test/unit-tests/runtime.ts → tools/unit-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';


/* *
Expand Down Expand Up @@ -125,19 +126,20 @@ async function runUnitTests () {
const failures: Array<string> = [];
const successes: Array<string> = [];
const stdout = process.stdout;
const testFolder = Path.join('test', 'unit-tests');

let test: unknown;
let unitTests: Record<string, unknown>;

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;
}

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<string, unknown>;

for (let testName of Object.keys(unitTests)) {
Expand Down

0 comments on commit 575d7b9

Please sign in to comment.