fix(TsTest): Fixed improper type-check for promise-like testModule defaults
This commit is contained in:
		| @@ -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 | ||||
|  | ||||
|   | ||||
| @@ -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' | ||||
| } | ||||
|   | ||||
| @@ -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('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user