From 799a60188fdecccc17ebad37cb31109f31457ffa Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Fri, 12 Sep 2025 14:06:03 +0000 Subject: [PATCH] feat(tstest): Implement dynamic port allocation for HTTP and WebSocket connections, add tests for port validation --- package.json | 1 + pnpm-lock.yaml | 134 +++------------------------- test/tapbundle/test.dynamicports.ts | 29 ++++++ ts/tstest.classes.tstest.ts | 38 +++++++- ts/tstest.plugins.ts | 2 + 5 files changed, 77 insertions(+), 127 deletions(-) create mode 100644 test/tapbundle/test.dynamicports.ts diff --git a/package.json b/package.json index 388494b..9e74b93 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "@push.rocks/smartjson": "^5.0.20", "@push.rocks/smartlog": "^3.1.9", "@push.rocks/smartmongo": "^2.0.12", + "@push.rocks/smartnetwork": "^4.2.0", "@push.rocks/smartpath": "^6.0.0", "@push.rocks/smartpromise": "^4.2.3", "@push.rocks/smartrequest": "^4.3.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 19c2c03..c66a83a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -53,6 +53,9 @@ importers: '@push.rocks/smartmongo': specifier: ^2.0.12 version: 2.0.12(socks@2.8.7) + '@push.rocks/smartnetwork': + specifier: ^4.2.0 + version: 4.2.0 '@push.rocks/smartpath': specifier: ^6.0.0 version: 6.0.0 @@ -614,9 +617,6 @@ packages: resolution: {integrity: sha512-dOOXgzqaDoHu5qqMEPLKEgLz5CeIA7q8+1W62mCvFVCOqeC71UoTGJ4u1xUSOpIl2J1x2pqrNULkFteUeZW3/A==} engines: {node: '>= 8.0.0'} - '@leichtgewicht/ip-codec@2.0.5': - resolution: {integrity: sha512-Vo+PSpZG2/fmgmiNzYK9qWRh8h/CHrwD0mo1h1DzL4yzHNSfWYujGTYsWGreD000gcgmZ7K4Ys6Tx9TxtsKdDw==} - '@lit-labs/ssr-dom-shim@1.4.0': resolution: {integrity: sha512-ficsEARKnmmW5njugNYKipTm4SFnbik7CXtoencDZzmzo/dQ+2Q0bgkzJuoJP20Aj0F+izzJjOqsnkd6F/o1bw==} @@ -816,8 +816,8 @@ packages: '@push.rocks/smartmongo@2.0.12': resolution: {integrity: sha512-NglYiO14BikxnlvW6JF18FtopBtaWQEGAtPxHmmSCbyhU8Mi0aEFO7VgCasE9Kguba/wcR597qhcDEdcpBg1eQ==} - '@push.rocks/smartnetwork@4.1.2': - resolution: {integrity: sha512-TjucG72ooHgzAUpNu2LAv4iFoettmZq2aEWhhzIa7AKcOvt4yxsk3Vl73guhKRohTfhdRauPcH5OHISLUHJbYA==} + '@push.rocks/smartnetwork@4.2.0': + resolution: {integrity: sha512-XkRE2hQFCxUKzeD54MhbWlZAEVGyOhjU68A0zP9r3wsVjsVRqz38PwoM2GrhMrW4gtPa1j1t6cEUv1WNTwfo/Q==} '@push.rocks/smartnpm@2.0.6': resolution: {integrity: sha512-7anKDOjX6gXWs1IAc+YWz9ZZ8gDsTwaLh+CxRnGHjAawOmK788NrrgVCg2Fb3qojrPnoxecc46F8Ivp1BT7Izw==} @@ -1408,9 +1408,6 @@ packages: '@types/debug@4.1.12': resolution: {integrity: sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==} - '@types/default-gateway@7.2.2': - resolution: {integrity: sha512-35C93fYQlnLKLASkMPoxRvok4fENwB3By9clRLd2I/08n/XRl0pCdf7EB17K5oMMwZu8NBYA8i66jH5r/LYBKA==} - '@types/express-serve-static-core@5.0.7': resolution: {integrity: sha512-R+33OsgWw7rOhD1emjU7dzCDHucJrgJXMA5PYCzJxVil0dsyx5iBEPHqpPfiKNJQb7lZ1vxwoLR4Z87bBUpeGQ==} @@ -1759,10 +1756,6 @@ packages: resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} engines: {node: '>=12'} - clone-regexp@3.0.0: - resolution: {integrity: sha512-ujdnoq2Kxb8s3ItNBtnYeXdm07FcU0u8ARAT1lQ2YdMwQC+cdiXX8KoqMVuglztILivceTtp4ivqGSmEmhBUJw==} - engines: {node: '>=12'} - co@4.6.0: resolution: {integrity: sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=} engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'} @@ -1824,10 +1817,6 @@ packages: resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==} engines: {node: '>= 0.6'} - convert-hrtime@5.0.0: - resolution: {integrity: sha512-lOETlkIeYSJWcbbcvjRKGxVMXJR+8+OQb/mTPbA4ObPMytYIsUbuOE0Jzy60hjARYszq1id0j8KgVhC+WGZVTg==} - engines: {node: '>=12'} - cookie-signature@1.2.2: resolution: {integrity: sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==} engines: {node: '>=6.6.0'} @@ -1964,14 +1953,6 @@ packages: resolution: {integrity: sha512-MdceRRWqltEG2dZqO769g27N/3PXfcKl04VhYnBlo2YhH7zPi88VebsjTKclaOyiuMaGU72hTfw3VkUitGcVCA==} engines: {node: '>=4.5.0'} - dns-packet@5.6.1: - resolution: {integrity: sha512-l4gcSouhcgIKRvyy99RNVOgxXiicE+2jZoNmaNmZ6JXiGajBOJAesk1OBlJuM5k2c+eudGdLxDqXuPCKIj6kpw==} - engines: {node: '>=6'} - - dns-socket@4.2.2: - resolution: {integrity: sha512-BDeBd8najI4/lS00HSKpdFia+OvUMytaVjfzR9n5Lq8MlZRSvtbI+uLtx1+XmQFls5wFU9dssccTmQQ6nfpjdg==} - engines: {node: '>=6'} - dunder-proto@1.0.1: resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} engines: {node: '>= 0.4'} @@ -2240,10 +2221,6 @@ packages: function-bind@1.1.2: resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} - function-timeout@0.1.1: - resolution: {integrity: sha512-0NVVC0TaP7dSTvn1yMiy6d6Q8gifzbvQafO46RtLG/kHJUBNd+pVRGOBoK44wNBvtSPUJRfdVvkFdD3p0xvyZg==} - engines: {node: '>=14.16'} - get-caller-file@2.0.5: resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} engines: {node: 6.* || 8.* || >= 10.*} @@ -2291,10 +2268,6 @@ packages: resolution: {integrity: sha512-mThBblvlAF1d4O5oqyvN+ZxLAYwIJK7bpMxgYqPD9okW0C3qm5FFn7k811QrcuEBwaogR3ngOFoCfs6mRv7teQ==} engines: {node: '>=14.16'} - got@13.0.0: - resolution: {integrity: sha512-XfBk1CxOOScDcMr9O1yKkNaQyy865NbYs+F7dr4H0LZMVgCj2Le59k6PqbNHoL5ToeaEQUYh6c6yMfVcc6SJxA==} - engines: {node: '>=16'} - graceful-fs@4.2.10: resolution: {integrity: sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==} @@ -2402,10 +2375,6 @@ packages: resolution: {integrity: sha512-NWv9YLW4PoW2B7xtzaS3NCot75m6nK7Icdv0o3lfMceJVRfSoQwqD4wEH5rLwoKJwUiZ/rfpiVBhnaF0FK4HoA==} engines: {node: '>= 12'} - ip-regex@5.0.0: - resolution: {integrity: sha512-fOCG6lhoKKakwv+C6KdsOnGvgXnmgfmp0myi3bcNwj3qfwPAxRKWEuFhvEFF7ceYIz6+1jRZ+yguLFAmUNPEfw==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - ipaddr.js@1.9.1: resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==} engines: {node: '>= 0.10'} @@ -2429,10 +2398,6 @@ packages: resolution: {integrity: sha512-nPUB5km40q9e8UfN/Zc24eLlzdSf9OfKByBw9CIdw4H1giPMeA0OIJvbchsCu4npfI2QcMVBsGEBHKZ7wLTWmQ==} engines: {node: '>= 0.4'} - is-ip@5.0.1: - resolution: {integrity: sha512-FCsGHdlrOnZQcp0+XT5a+pYowf33itBalCl+7ovNXC/7o5BhIpG14M3OrpPPdBSIQJCm+0M5+9mO7S9VVTTCFw==} - engines: {node: '>=14.16'} - is-nan@1.3.2: resolution: {integrity: sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==} engines: {node: '>= 0.4'} @@ -2456,10 +2421,6 @@ packages: resolution: {integrity: sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==} engines: {node: '>= 0.4'} - is-regexp@3.1.0: - resolution: {integrity: sha512-rbku49cWloU5bSMI+zaRaXdQHXnthP6DZ/vLnfdSKyL4zUzuWnomtOEiZZOd+ioQ+avFo/qau3KPTc7Fjy1uPA==} - engines: {node: '>=12'} - is-stream@2.0.1: resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} engines: {node: '>=8'} @@ -3131,10 +3092,6 @@ packages: proxy-from-env@1.1.0: resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} - public-ip@7.0.1: - resolution: {integrity: sha512-DdNcqcIbI0wEeCBcqX+bmZpUCvrDMJHXE553zgyG1MZ8S1a/iCCxmK9iTjjql+SpHSv4cZkmRv5/zGYW93AlCw==} - engines: {node: '>=18'} - pump@3.0.3: resolution: {integrity: sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==} @@ -3446,10 +3403,6 @@ packages: resolution: {integrity: sha512-FhwotcEqjr241ZbjFzjlIYg6c5/L/s4yBGWSMvJ9UoExiSqL+FnFA/CaeZx17WGaZMS/4SOZp8wH18jSS4R4lw==} engines: {node: '>=16'} - super-regex@0.2.0: - resolution: {integrity: sha512-WZzIx3rC1CvbMDloLsVw0lkZVKJWbrkJ0k1ghKFmcnPrW1+jWbgTkTEWVtD9lMdmI4jZEz40+naBxl1dCUhXXw==} - engines: {node: '>=14.16'} - supports-color@5.5.0: resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} engines: {node: '>=4'} @@ -3460,8 +3413,8 @@ packages: symbol-tree@3.2.4: resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} - systeminformation@5.27.7: - resolution: {integrity: sha512-saaqOoVEEFaux4v0K8Q7caiauRwjXC4XbD2eH60dxHXbpKxQ8kH9Rf7Jh+nryKpOUSEFxtCdBlSUx0/lO6rwRg==} + systeminformation@5.27.8: + resolution: {integrity: sha512-d3Z0gaQO1MlUxzDUKsmXz5y4TOBCMZ8IyijzaYOykV3AcNOTQ7mT+tpndUOXYNSxzLK3la8G32xiUFvZ0/s6PA==} engines: {node: '>=8.0.0'} os: [darwin, linux, win32, freebsd, openbsd, netbsd, sunos, android] hasBin: true @@ -3487,10 +3440,6 @@ packages: through@2.3.8: resolution: {integrity: sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=} - time-span@5.1.0: - resolution: {integrity: sha512-75voc/9G4rDIJleOo4jPvN4/YC4GRZrY8yy1uU4lwrB3XEQbWve8zXoO5No4eFrGcTAMYyoY67p8jRQdtA1HbA==} - engines: {node: '>=12'} - tiny-worker@2.3.0: resolution: {integrity: sha512-pJ70wq5EAqTAEl9IkGzA+fN0836rycEuz2Cn6yeZ6FRzlVS5IDOkFHpIoEsksPRQV34GDqXm65+OlnZqUSyK2g==} @@ -4969,8 +4918,6 @@ snapshots: transitivePeerDependencies: - supports-color - '@leichtgewicht/ip-codec@2.0.5': {} - '@lit-labs/ssr-dom-shim@1.4.0': {} '@lit/reactive-element@2.1.1': @@ -5420,15 +5367,13 @@ snapshots: - socks - supports-color - '@push.rocks/smartnetwork@4.1.2': + '@push.rocks/smartnetwork@4.2.0': dependencies: '@push.rocks/smartping': 1.0.8 '@push.rocks/smartpromise': 4.2.3 '@push.rocks/smartstring': 4.0.15 - '@types/default-gateway': 7.2.2 isopen: 1.3.0 - public-ip: 7.0.1 - systeminformation: 5.27.7 + systeminformation: 5.27.8 '@push.rocks/smartnpm@2.0.6': dependencies: @@ -5476,7 +5421,7 @@ snapshots: '@push.rocks/smartbuffer': 3.0.5 '@push.rocks/smartdelay': 3.0.5 '@push.rocks/smartfile': 11.2.7 - '@push.rocks/smartnetwork': 4.1.2 + '@push.rocks/smartnetwork': 4.2.0 '@push.rocks/smartpath': 6.0.0 '@push.rocks/smartpromise': 4.2.3 '@push.rocks/smartpuppeteer': 2.0.5(typescript@5.9.2) @@ -6361,8 +6306,6 @@ snapshots: dependencies: '@types/ms': 2.1.0 - '@types/default-gateway@7.2.2': {} - '@types/express-serve-static-core@5.0.7': dependencies: '@types/node': 22.17.2 @@ -6712,10 +6655,6 @@ snapshots: strip-ansi: 6.0.1 wrap-ansi: 7.0.0 - clone-regexp@3.0.0: - dependencies: - is-regexp: 3.1.0 - co@4.6.0: {} color-convert@1.9.3: @@ -6774,8 +6713,6 @@ snapshots: content-type@1.0.5: {} - convert-hrtime@5.0.0: {} - cookie-signature@1.2.2: {} cookie@0.7.2: {} @@ -6883,14 +6820,6 @@ snapshots: dependencies: streamsearch: 0.1.2 - dns-packet@5.6.1: - dependencies: - '@leichtgewicht/ip-codec': 2.0.5 - - dns-socket@4.2.2: - dependencies: - dns-packet: 5.6.1 - dunder-proto@1.0.1: dependencies: call-bind-apply-helpers: 1.0.2 @@ -7208,8 +7137,6 @@ snapshots: function-bind@1.1.2: {} - function-timeout@0.1.1: {} - get-caller-file@2.0.5: {} get-intrinsic@1.3.0: @@ -7287,20 +7214,6 @@ snapshots: p-cancelable: 3.0.0 responselike: 3.0.0 - got@13.0.0: - dependencies: - '@sindresorhus/is': 5.6.0 - '@szmarczak/http-timer': 5.0.1 - cacheable-lookup: 7.0.0 - cacheable-request: 10.2.14 - decompress-response: 6.0.0 - form-data-encoder: 2.1.4 - get-stream: 6.0.1 - http2-wrapper: 2.2.1 - lowercase-keys: 3.0.0 - p-cancelable: 3.0.0 - responselike: 3.0.0 - graceful-fs@4.2.10: {} graceful-fs@4.2.11: {} @@ -7435,8 +7348,6 @@ snapshots: ip-address@10.0.1: {} - ip-regex@5.0.0: {} - ipaddr.js@1.9.1: {} is-arrayish@0.2.1: {} @@ -7454,11 +7365,6 @@ snapshots: has-tostringtag: 1.0.2 safe-regex-test: 1.1.0 - is-ip@5.0.1: - dependencies: - ip-regex: 5.0.0 - super-regex: 0.2.0 - is-nan@1.3.2: dependencies: call-bind: 1.0.8 @@ -7479,8 +7385,6 @@ snapshots: has-tostringtag: 1.0.2 hasown: 2.0.2 - is-regexp@3.1.0: {} - is-stream@2.0.1: {} is-stream@4.0.1: {} @@ -8315,12 +8219,6 @@ snapshots: proxy-from-env@1.1.0: {} - public-ip@7.0.1: - dependencies: - dns-socket: 4.2.2 - got: 13.0.0 - is-ip: 5.0.1 - pump@3.0.3: dependencies: end-of-stream: 1.4.5 @@ -8761,12 +8659,6 @@ snapshots: '@tokenizer/token': 0.3.0 peek-readable: 5.4.2 - super-regex@0.2.0: - dependencies: - clone-regexp: 3.0.0 - function-timeout: 0.1.1 - time-span: 5.1.0 - supports-color@5.5.0: dependencies: has-flag: 3.0.0 @@ -8775,7 +8667,7 @@ snapshots: symbol-tree@3.2.4: {} - systeminformation@5.27.7: {} + systeminformation@5.27.8: {} tar-fs@3.1.0: dependencies: @@ -8816,10 +8708,6 @@ snapshots: through@2.3.8: {} - time-span@5.1.0: - dependencies: - convert-hrtime: 5.0.0 - tiny-worker@2.3.0: dependencies: esm: 3.2.25 diff --git a/test/tapbundle/test.dynamicports.ts b/test/tapbundle/test.dynamicports.ts new file mode 100644 index 0000000..52a26da --- /dev/null +++ b/test/tapbundle/test.dynamicports.ts @@ -0,0 +1,29 @@ +import { tap, expect } from '../../ts_tapbundle/index.js'; + +tap.test('should be running in browser with dynamic ports', async () => { + // Check that we're in a browser environment + expect(typeof window).toEqual('object'); + expect(typeof globalThis.testdom).toEqual('boolean'); + expect(globalThis.testdom).toBeTrue(); + + // Check that the WebSocket port was injected + expect(typeof globalThis.wsPort).toEqual('number'); + expect(globalThis.wsPort).toBeGreaterThan(29999); + expect(globalThis.wsPort).toBeLessThan(40001); + + console.log(`Browser test running with dynamic WebSocket port: ${globalThis.wsPort}`); +}); + +tap.test('should have different port than default 8080', async () => { + // The old hardcoded port was 8080, verify we're not using it + expect(globalThis.wsPort).not.toEqual(8080); +}); + +const testPromise = tap.start(); + +// Export promise for browser compatibility +if (typeof globalThis !== 'undefined') { + (globalThis as any).tapPromise = testPromise; +} + +export default testPromise; \ No newline at end of file diff --git a/ts/tstest.classes.tstest.ts b/ts/tstest.classes.tstest.ts index b9f6e30..fb30698 100644 --- a/ts/tstest.classes.tstest.ts +++ b/ts/tstest.classes.tstest.ts @@ -316,6 +316,32 @@ import '${absoluteTestFile.replace(/\\/g, '/')}'; return tapParser; } + private async findFreePorts(): Promise<{ httpPort: number; wsPort: number }> { + const smartnetwork = new plugins.smartnetwork.SmartNetwork(); + + // Find HTTP port in range 30000-40000 + const httpPort = await smartnetwork.findFreePort(30000, 40000); + if (!httpPort) { + throw new Error('Could not find a free HTTP port in range 30000-40000'); + } + + // Find WebSocket port in range 30000-40000 (different from HTTP port) + let wsPort = await smartnetwork.findFreePort(httpPort + 1, 40000); + if (!wsPort) { + // Try again from the beginning of the range if we couldn't find one after httpPort + wsPort = await smartnetwork.findFreePort(30000, httpPort - 1); + if (!wsPort) { + throw new Error('Could not find a free WebSocket port in range 30000-40000'); + } + } + + // Log selected ports for debugging + if (!this.logger.options.quiet) { + console.log(`Selected ports - HTTP: ${httpPort}, WebSocket: ${wsPort}`); + } + return { httpPort, wsPort }; + } + public async runInChrome(fileNameArg: string, index: number, total: number): Promise { this.logger.testFileStart(fileNameArg, 'chromium', index, total); @@ -330,10 +356,13 @@ import '${absoluteTestFile.replace(/\\/g, '/')}'; bundler: 'esbuild', }); + // Find free ports for HTTP and WebSocket + const { httpPort, wsPort } = await this.findFreePorts(); + // lets create a server const server = new plugins.typedserver.servertools.Server({ cors: true, - port: 3007, + port: httpPort, }); server.addRoute( '/test', @@ -344,6 +373,7 @@ import '${absoluteTestFile.replace(/\\/g, '/')}'; @@ -357,7 +387,7 @@ import '${absoluteTestFile.replace(/\\/g, '/')}'; // lets handle realtime comms const tapParser = new TapParser(fileNameArg + ':chrome', this.logger); - const wss = new plugins.ws.WebSocketServer({ port: 8080 }); + const wss = new plugins.ws.WebSocketServer({ port: wsPort }); wss.on('connection', (ws) => { ws.on('message', (message) => { const messageStr = message.toString(); @@ -374,10 +404,10 @@ import '${absoluteTestFile.replace(/\\/g, '/')}'; await this.smartbrowserInstance.start(); const evaluatePromise = this.smartbrowserInstance.evaluateOnPage( - `http://localhost:3007/test?bundleName=${bundleFileName}`, + `http://localhost:${httpPort}/test?bundleName=${bundleFileName}`, async () => { // lets enable real time comms - const ws = new WebSocket('ws://localhost:8080'); + const ws = new WebSocket(`ws://localhost:${globalThis.wsPort}`); await new Promise((resolve) => (ws.onopen = resolve)); // Ensure this function is declared with 'async' diff --git a/ts/tstest.plugins.ts b/ts/tstest.plugins.ts index 5e8a34d..765df88 100644 --- a/ts/tstest.plugins.ts +++ b/ts/tstest.plugins.ts @@ -17,6 +17,7 @@ import * as smartchok from '@push.rocks/smartchok'; import * as smartdelay from '@push.rocks/smartdelay'; import * as smartfile from '@push.rocks/smartfile'; import * as smartlog from '@push.rocks/smartlog'; +import * as smartnetwork from '@push.rocks/smartnetwork'; import * as smartpromise from '@push.rocks/smartpromise'; import * as smartshell from '@push.rocks/smartshell'; import * as tapbundle from '../dist_ts_tapbundle/index.js'; @@ -28,6 +29,7 @@ export { smartdelay, smartfile, smartlog, + smartnetwork, smartpromise, smartshell, tapbundle,