diff --git a/changelog.md b/changelog.md index 9a95ca2..8b9f6c2 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2025-01-23 - 1.0.96 - fix(TsTest) +Fixed improper type-check for promise-like testModule defaults + +- Corrected the type-check for promise-like default exports in test modules +- Removed unnecessary setTimeout used for async execution + ## 2025-01-23 - 1.0.95 - fix(core) Fix delay handling in Chrome test execution diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 32f8ed4..29725d3 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@git.zone/tstest', - version: '1.0.95', + version: '1.0.96', description: 'a test utility to run tests that match test/**/*.ts' } diff --git a/ts/tstest.classes.tstest.ts b/ts/tstest.classes.tstest.ts index 20b43be..2d8047d 100644 --- a/ts/tstest.classes.tstest.ts +++ b/ts/tstest.classes.tstest.ts @@ -170,16 +170,15 @@ export class TsTest { try { // Dynamically import the test module const testModule = await import(`/${bundleName}`); - await new Promise(resolve => setTimeout(resolve, 0)); if (testModule && testModule.default && testModule.default instanceof Promise) { // Execute the exported test function await testModule.default; - } else if (testModule && testModule.default && testModule.default.then === 'function') { + } else if (testModule && testModule.default && typeof testModule.default.then === 'function') { console.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'); console.log('Test module default export is just promiselike: Something might be messing with your Promise implementation.'); console.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'); await testModule.default; - } else if (globalThis.tapPromise && globalThis.tapPromise.then === 'function') { + } else if (globalThis.tapPromise && typeof globalThis.tapPromise.then === 'function') { console.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'); console.log('Using globalThis.tapPromise'); console.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');