fix(serve): migrate test HTTP server to @push.rocks/smartserve and update related dependencies
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
# Changelog
|
||||
|
||||
## 2026-03-09 - 3.3.1 - fix(serve)
|
||||
migrate test HTTP server to @push.rocks/smartserve and update related dependencies
|
||||
|
||||
- Replace @api.global/typedserver with @push.rocks/smartserve and FileServer; use SmartServe.setHandler to serve static assets and a custom /test response.
|
||||
- Export smartserve from ts/tstest.plugins.ts and remove typedserver import/export.
|
||||
- Update package.json dependencies: add @push.rocks/smartserve@^2.0.1 and bump @push.rocks/smartbrowser to ^2.0.10.
|
||||
|
||||
## 2026-03-06 - 3.3.0 - feat(testfile-directives)
|
||||
Add per-test file directives to control runtime permissions and flags (Deno, Node, Bun, Chromium)
|
||||
|
||||
|
||||
@@ -29,12 +29,12 @@
|
||||
"@types/node": "^25.3.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@api.global/typedserver": "^8.4.2",
|
||||
"@push.rocks/smartserve": "^2.0.1",
|
||||
"@git.zone/tsbundle": "^2.9.1",
|
||||
"@git.zone/tsrun": "^2.0.1",
|
||||
"@push.rocks/consolecolor": "^2.0.3",
|
||||
"@push.rocks/qenv": "^6.1.3",
|
||||
"@push.rocks/smartbrowser": "^2.0.8",
|
||||
"@push.rocks/smartbrowser": "^2.0.10",
|
||||
"@push.rocks/smartcrypto": "^2.0.4",
|
||||
"@push.rocks/smartdelay": "^3.0.5",
|
||||
"@push.rocks/smartenv": "^6.0.0",
|
||||
|
||||
1263
pnpm-lock.yaml
generated
1263
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@git.zone/tstest',
|
||||
version: '3.3.0',
|
||||
version: '3.3.1',
|
||||
description: 'A powerful, modern test runner for TypeScript with multi-runtime support (Node.js, Deno, Bun, Chromium) and a batteries-included test framework.'
|
||||
}
|
||||
|
||||
@@ -116,24 +116,27 @@ export class ChromiumRuntimeAdapter extends RuntimeAdapter {
|
||||
// Find free ports for HTTP and WebSocket
|
||||
const { httpPort, wsPort } = await this.findFreePorts();
|
||||
|
||||
// lets create a server
|
||||
const server = new plugins.typedserver.TypedServer({
|
||||
cors: true,
|
||||
port: httpPort,
|
||||
serveDir: tsbundleCacheDirPath,
|
||||
});
|
||||
server.addRoute('/test', 'GET', async () => {
|
||||
return new Response(`
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
globalThis.testdom = true;
|
||||
globalThis.wsPort = ${wsPort};
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
`, { headers: { 'Content-Type': 'text/html' } });
|
||||
// Use SmartServe with setHandler() to bypass global ControllerRegistry
|
||||
const fileServer = new plugins.smartserve.FileServer({ root: tsbundleCacheDirPath });
|
||||
const server = new plugins.smartserve.SmartServe({ port: httpPort });
|
||||
server.setHandler(async (request: Request) => {
|
||||
const url = new URL(request.url);
|
||||
if (url.pathname === '/test') {
|
||||
return new Response(`
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
globalThis.testdom = true;
|
||||
globalThis.wsPort = ${wsPort};
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
`, { headers: { 'Content-Type': 'text/html' } });
|
||||
}
|
||||
const staticResponse = await fileServer.serve(request);
|
||||
if (staticResponse) return staticResponse;
|
||||
return new Response('Not Found', { status: 404 });
|
||||
});
|
||||
await server.start();
|
||||
|
||||
|
||||
@@ -476,24 +476,27 @@ import '${absoluteTestFile.replace(/\\/g, '/')}';
|
||||
// Find free ports for HTTP and WebSocket
|
||||
const { httpPort, wsPort } = await this.findFreePorts();
|
||||
|
||||
// lets create a server
|
||||
const server = new plugins.typedserver.TypedServer({
|
||||
cors: true,
|
||||
port: httpPort,
|
||||
serveDir: tsbundleCacheDirPath,
|
||||
});
|
||||
server.addRoute('/test', 'GET', async () => {
|
||||
return new Response(`
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
globalThis.testdom = true;
|
||||
globalThis.wsPort = ${wsPort};
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
`, { headers: { 'Content-Type': 'text/html' } });
|
||||
// Use SmartServe with setHandler() to bypass global ControllerRegistry
|
||||
const fileServer = new plugins.smartserve.FileServer({ root: tsbundleCacheDirPath });
|
||||
const server = new plugins.smartserve.SmartServe({ port: httpPort });
|
||||
server.setHandler(async (request: Request) => {
|
||||
const url = new URL(request.url);
|
||||
if (url.pathname === '/test') {
|
||||
return new Response(`
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
globalThis.testdom = true;
|
||||
globalThis.wsPort = ${wsPort};
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
`, { headers: { 'Content-Type': 'text/html' } });
|
||||
}
|
||||
const staticResponse = await fileServer.serve(request);
|
||||
if (staticResponse) return staticResponse;
|
||||
return new Response('Not Found', { status: 404 });
|
||||
});
|
||||
await server.start();
|
||||
|
||||
|
||||
@@ -4,16 +4,10 @@ import * as path from 'path';
|
||||
|
||||
export { fs, path };
|
||||
|
||||
// @apiglobal scope
|
||||
import * as typedserver from '@api.global/typedserver';
|
||||
|
||||
export {
|
||||
typedserver
|
||||
}
|
||||
|
||||
// @push.rocks scope
|
||||
import * as consolecolor from '@push.rocks/consolecolor';
|
||||
import * as smartbrowser from '@push.rocks/smartbrowser';
|
||||
import * as smartserve from '@push.rocks/smartserve';
|
||||
import * as smartdelay from '@push.rocks/smartdelay';
|
||||
import * as smartfile from '@push.rocks/smartfile';
|
||||
import * as smartfs from '@push.rocks/smartfs';
|
||||
@@ -28,6 +22,7 @@ import * as tapbundle from '../dist_ts_tapbundle/index.js';
|
||||
export {
|
||||
consolecolor,
|
||||
smartbrowser,
|
||||
smartserve,
|
||||
smartdelay,
|
||||
smartfile,
|
||||
smartfs,
|
||||
|
||||
Reference in New Issue
Block a user