Compare commits

..

4 Commits

8 changed files with 1035 additions and 1835 deletions

View File

@@ -1,5 +1,19 @@
# Changelog
## 2026-03-09 - 3.3.2 - fix(deps)
bump dependency versions and reorder smartserve in package.json
- bump @push.rocks/smartbrowser from ^2.0.10 to ^2.0.11
- bump @push.rocks/smartfs from ^1.4.0 to ^1.5.0
- move @push.rocks/smartserve to later position in dependencies (version unchanged: ^2.0.1)
## 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)

View File

@@ -9,5 +9,5 @@
"target": "ES2022"
},
"nodeModulesDir": true,
"version": "3.3.0"
"version": "3.3.2"
}

View File

@@ -1,6 +1,6 @@
{
"name": "@git.zone/tstest",
"version": "3.3.0",
"version": "3.3.2",
"private": false,
"description": "A powerful, modern test runner for TypeScript with multi-runtime support (Node.js, Deno, Bun, Chromium) and a batteries-included test framework.",
"exports": {
@@ -29,18 +29,17 @@
"@types/node": "^25.3.5"
},
"dependencies": {
"@api.global/typedserver": "^8.4.2",
"@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.11",
"@push.rocks/smartcrypto": "^2.0.4",
"@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/smartenv": "^6.0.0",
"@push.rocks/smartexpect": "^2.5.0",
"@push.rocks/smartfile": "^13.1.2",
"@push.rocks/smartfs": "^1.4.0",
"@push.rocks/smartfs": "^1.5.0",
"@push.rocks/smartjson": "^6.0.0",
"@push.rocks/smartlog": "^3.2.1",
"@push.rocks/smartmongo": "^5.1.0",
@@ -49,6 +48,7 @@
"@push.rocks/smartpromise": "^4.2.3",
"@push.rocks/smartrequest": "^5.0.1",
"@push.rocks/smarts3": "^5.3.0",
"@push.rocks/smartserve": "^2.0.1",
"@push.rocks/smartshell": "^3.3.7",
"@push.rocks/smarttime": "^4.2.3",
"@push.rocks/smartwatch": "^6.3.0",

2757
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@git.zone/tstest',
version: '3.3.0',
version: '3.3.2',
description: 'A powerful, modern test runner for TypeScript with multi-runtime support (Node.js, Deno, Bun, Chromium) and a batteries-included test framework.'
}

View File

@@ -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();

View File

@@ -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();

View File

@@ -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,