diff --git a/changelog.md b/changelog.md index 5e5c30d..3165e0d 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,14 @@ # Changelog +## 2025-11-19 - 3.0.0 - BREAKING CHANGE(tapbundle_serverside) +Rename Node-specific tapbundle module to tapbundle_serverside and migrate server-side utilities + +- Change public export in package.json from ./tapbundle_node to ./tapbundle_serverside — consumers must update imports to @git.zone/tstest/tapbundle_serverside +- Move and re-create Node-only implementation files under ts_tapbundle_serverside (plugins, paths, classes.tapnodetools, classes.testfileprovider, index, tspublish.json) and remove legacy ts_tapbundle_node sources +- Update internal imports and tests to reference the new tapbundle_serverside path (e.g. test/tapbundle/test.node.ts updated) +- Update documentation (readme.md and readme.hints.md) to describe the new tapbundle_serverside export and its server-side utilities +- Ensure build outputs and publish metadata reflect the new module directory (tspublish.json order preserved) + ## 2025-11-19 - 2.8.3 - fix(dependencies) Update dependency versions diff --git a/package.json b/package.json index 3d9f2e2..dcd1017 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "exports": { ".": "./dist_ts/index.js", "./tapbundle": "./dist_ts_tapbundle/index.js", - "./tapbundle_node": "./dist_ts_tapbundle_node/index.js", + "./tapbundle_serverside": "./dist_ts_tapbundle_serverside/index.js", "./tapbundle_protocol": "./dist_ts_tapbundle_protocol/index.js" }, "type": "module", diff --git a/readme.hints.md b/readme.hints.md index 2feeb8e..2f05519 100644 --- a/readme.hints.md +++ b/readme.hints.md @@ -6,7 +6,7 @@ This project integrates tstest with tapbundle through a modular architecture: 1. **tstest** (`/ts/`) - The test runner that discovers and executes test files 2. **tapbundle** (`/ts_tapbundle/`) - The TAP testing framework for writing tests -3. **tapbundle_node** (`/ts_tapbundle_node/`) - Node.js-specific testing utilities +3. **tapbundle_serverside** (`/ts_tapbundle_serverside/`) - Server-side testing utilities (runCommand, env vars, HTTPS certs, MongoDB, S3, test assets) ## How Components Work Together @@ -31,7 +31,7 @@ This project integrates tstest with tapbundle through a modular architecture: 1. **Import Structure** - Test files import from local tapbundle: `import { tap, expect } from '../../ts_tapbundle/index.js'` - - Node-specific tests also import from tapbundle_node: `import { tapNodeTools } from '../../ts_tapbundle_node/index.js'` + - Server-side tests also import from tapbundle_serverside for Node.js-only utilities: `import { tapNodeTools } from '../../ts_tapbundle_serverside/index.js'` 2. **WebHelpers** - Browser tests can use webhelpers for DOM manipulation @@ -41,7 +41,7 @@ This project integrates tstest with tapbundle through a modular architecture: 3. **Build System** - Uses `tsbuild tsfolders` to compile TypeScript (invoked by `pnpm build`) - - Maintains separate output directories: `/dist_ts/`, `/dist_ts_tapbundle/`, `/dist_ts_tapbundle_node/`, `/dist_ts_tapbundle_protocol/` + - Maintains separate output directories: `/dist_ts/`, `/dist_ts_tapbundle/`, `/dist_ts_tapbundle_serverside/`, `/dist_ts_tapbundle_protocol/` - Compilation order is resolved automatically based on dependencies in tspublish.json files - Protocol imports use compiled dist directories: ```typescript diff --git a/readme.md b/readme.md index 8c2cfd0..c3cef8e 100644 --- a/readme.md +++ b/readme.md @@ -318,9 +318,34 @@ tstest provides multiple exports for different use cases: - `@git.zone/tstest` - Main CLI and test runner functionality - `@git.zone/tstest/tapbundle` - Browser-compatible test framework -- `@git.zone/tstest/tapbundle_node` - Node.js-specific test utilities +- `@git.zone/tstest/tapbundle_serverside` - Server-side testing utilities for Node.js-only tests (*.node.ts files) + - Execute shell commands during tests + - Manage environment variables on-demand with secure storage + - Generate self-signed HTTPS certificates for testing secure connections + - Create ephemeral MongoDB instances for database testing + - Create local S3-compatible storage for object storage testing + - Download and manage test assets (e.g., Docker images) - `@git.zone/tstest/tapbundle_protocol` - Protocol V2 emitter and parser for TAP extensions +### When to Use tapbundle_serverside + +Use `@git.zone/tstest/tapbundle_serverside` when your tests: + +- Run exclusively on Node.js server-side (*.node.ts test files) +- Need to execute shell commands or interact with the file system +- Require environment variable management with secure on-demand prompts +- Test HTTPS servers and need self-signed certificates +- Interact with databases (MongoDB) and need ephemeral test instances +- Work with object storage (S3-compatible) and need local testing +- Require test assets like Docker images or other downloadable files + +**Important:** tapbundle_serverside utilities are NOT available in: +- Browser environments +- Deno runtime +- Bun runtime + +For cross-runtime tests, only import tapbundle_serverside in `.node.ts` files where you need server-side specific functionality. + ## tapbundle Protocol V2 tstest includes an enhanced TAP protocol (Protocol V2) that extends standard TAP 13 with additional metadata while maintaining backwards compatibility. diff --git a/test/tapbundle/test.node.ts b/test/tapbundle/test.node.ts index a767368..6679391 100644 --- a/test/tapbundle/test.node.ts +++ b/test/tapbundle/test.node.ts @@ -1,6 +1,6 @@ import { tap, expect } from '../../ts_tapbundle/index.js'; -import { tapNodeTools } from '../../ts_tapbundle_node/index.js'; +import { tapNodeTools } from '../../ts_tapbundle_serverside/index.js'; tap.test('should execure a command', async () => { const result = await tapNodeTools.runCommand('ls -la'); diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 3808358..a604265 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: '2.8.3', + version: '3.0.0', description: 'a test utility to run tests that match test/**/*.ts' } diff --git a/ts_tapbundle_node/classes.tapnodetools.ts b/ts_tapbundle_serverside/classes.tapnodetools.ts similarity index 100% rename from ts_tapbundle_node/classes.tapnodetools.ts rename to ts_tapbundle_serverside/classes.tapnodetools.ts diff --git a/ts_tapbundle_node/classes.testfileprovider.ts b/ts_tapbundle_serverside/classes.testfileprovider.ts similarity index 100% rename from ts_tapbundle_node/classes.testfileprovider.ts rename to ts_tapbundle_serverside/classes.testfileprovider.ts diff --git a/ts_tapbundle_node/index.ts b/ts_tapbundle_serverside/index.ts similarity index 100% rename from ts_tapbundle_node/index.ts rename to ts_tapbundle_serverside/index.ts diff --git a/ts_tapbundle_node/paths.ts b/ts_tapbundle_serverside/paths.ts similarity index 100% rename from ts_tapbundle_node/paths.ts rename to ts_tapbundle_serverside/paths.ts diff --git a/ts_tapbundle_node/plugins.ts b/ts_tapbundle_serverside/plugins.ts similarity index 100% rename from ts_tapbundle_node/plugins.ts rename to ts_tapbundle_serverside/plugins.ts diff --git a/ts_tapbundle_node/readme.md b/ts_tapbundle_serverside/readme.md similarity index 84% rename from ts_tapbundle_node/readme.md rename to ts_tapbundle_serverside/readme.md index 74f97d8..11719f1 100644 --- a/ts_tapbundle_node/readme.md +++ b/ts_tapbundle_serverside/readme.md @@ -1,17 +1,17 @@ -# @git.zone/tstest/tapbundle_node +# @git.zone/tstest/tapbundle_serverside -> 🔧 Node.js-specific testing utilities for enhanced test capabilities +> 🔧 Server-side testing utilities for Node.js runtime tests ## Installation ```bash -# tapbundle_node is included as part of @git.zone/tstest +# tapbundle_serverside is included as part of @git.zone/tstest pnpm install --save-dev @git.zone/tstest ``` ## Overview -`@git.zone/tstest/tapbundle_node` provides Node.js-specific utilities for testing. These tools are only available when running tests in Node.js runtime and provide functionality for working with environment variables, shell commands, test databases, storage systems, and HTTPS certificates. +`@git.zone/tstest/tapbundle_serverside` provides server-side testing utilities exclusively for Node.js runtime. These tools enable shell command execution, environment variable management, HTTPS certificate generation, database testing, object storage testing, and test asset management - all functionality that only makes sense on the server-side. ## Key Features @@ -25,11 +25,11 @@ pnpm install --save-dev @git.zone/tstest ## Basic Usage ```typescript -import { tapNodeTools } from '@git.zone/tstest/tapbundle_node'; +import { tapNodeTools } from '@git.zone/tstest/tapbundle_serverside'; import { tap } from '@git.zone/tstest/tapbundle'; -tap.test('should use node-specific tools', async () => { - // Use Node.js-specific utilities +tap.test('should use server-side tools', async () => { + // Execute shell commands on the server-side const result = await tapNodeTools.runCommand('echo "hello"'); console.log(result); }); @@ -131,7 +131,7 @@ tap.test('should create HTTPS server', async () => { Create an ephemeral MongoDB instance for testing. Automatically started and ready to use. ```typescript -import { tapNodeTools } from '@git.zone/tstest/tapbundle_node'; +import { tapNodeTools } from '@git.zone/tstest/tapbundle_serverside'; tap.test('should use MongoDB', async () => { const mongoInstance = await tapNodeTools.createSmartmongo(); @@ -170,7 +170,7 @@ export default tap.start(); Create a local S3-compatible storage instance for testing object storage operations. ```typescript -import { tapNodeTools } from '@git.zone/tstest/tapbundle_node'; +import { tapNodeTools } from '@git.zone/tstest/tapbundle_serverside'; tap.test('should use S3 storage', async () => { const s3Instance = await tapNodeTools.createSmarts3(); @@ -209,7 +209,7 @@ Utility for downloading and managing test assets. Download the Alpine Linux Docker image as a tarball for testing. ```typescript -import { tapNodeTools } from '@git.zone/tstest/tapbundle_node'; +import { tapNodeTools } from '@git.zone/tstest/tapbundle_serverside'; tap.test('should provide docker image', async () => { const tarballPath = await tapNodeTools.testFileProvider.getDockerAlpineImageAsLocalTarball(); @@ -238,7 +238,7 @@ export default tap.start(); The module exports useful path constants: ```typescript -import * as paths from '@git.zone/tstest/tapbundle_node/paths'; +import * as paths from '@git.zone/tstest/tapbundle_serverside/paths'; console.log(paths.cwd); // Current working directory console.log(paths.testFilesDir); // ./.nogit/testfiles/ @@ -249,7 +249,7 @@ console.log(paths.testFilesDir); // ./.nogit/testfiles/ ### Testing with External Services ```typescript -import { tapNodeTools } from '@git.zone/tstest/tapbundle_node'; +import { tapNodeTools } from '@git.zone/tstest/tapbundle_serverside'; import { tap, expect } from '@git.zone/tstest/tapbundle'; tap.describe('User Service Integration', () => { @@ -280,7 +280,7 @@ export default tap.start(); ### Testing HTTPS Servers ```typescript -import { tapNodeTools } from '@git.zone/tstest/tapbundle_node'; +import { tapNodeTools } from '@git.zone/tstest/tapbundle_serverside'; import { tap, expect } from '@git.zone/tstest/tapbundle'; import * as https from 'https'; @@ -311,7 +311,7 @@ export default tap.start(); ### Environment-Dependent Tests ```typescript -import { tapNodeTools } from '@git.zone/tstest/tapbundle_node'; +import { tapNodeTools } from '@git.zone/tstest/tapbundle_serverside'; import { tap, expect } from '@git.zone/tstest/tapbundle'; tap.test('should authenticate with GitHub', async () => { @@ -332,12 +332,14 @@ export default tap.start(); ## Runtime Requirements -⚠️ **Node.js Only**: All utilities in this module require Node.js runtime. They will not work in: +⚠️ **Server-Side Only (Node.js)**: All utilities in this module are designed exclusively for server-side testing in Node.js runtime. They provide functionality like shell command execution, file system operations, and process management that only make sense on the server. + +**NOT available in:** - Browser environments - Deno runtime - Bun runtime -For multi-runtime tests, use these utilities only in `.node.ts` test files. +**Important:** Import tapbundle_serverside only in tests that run exclusively on the server-side (`.node.ts` test files). For cross-runtime tests, these utilities will fail in non-Node environments. ## File Naming diff --git a/ts_tapbundle_node/tspublish.json b/ts_tapbundle_serverside/tspublish.json similarity index 100% rename from ts_tapbundle_node/tspublish.json rename to ts_tapbundle_serverside/tspublish.json