Compare commits
81 Commits
Author | SHA1 | Date | |
---|---|---|---|
80fe602fbd | |||
c076875c2f | |||
7fa43ee785 | |||
e22da55523 | |||
5919f1bec7 | |||
d6959c13e9 | |||
d0c87050c0 | |||
281c203e5c | |||
30ec6c5bc2 | |||
56f4a65a1a | |||
6868a747ed | |||
1f68396aea | |||
84c5b85a3a | |||
a56319dcdb | |||
2f30e59222 | |||
3d1fdd7c79 | |||
f9f808ef5b | |||
d2cf005052 | |||
54f3eaa142 | |||
fd4e60e020 | |||
a21ce29a15 | |||
dc4695bc38 | |||
905139785a | |||
c84a7192fb | |||
8dd8ce1b15 | |||
7022ae1a3c | |||
7ef17f9c41 | |||
aa8dcb734e | |||
c36459dfcc | |||
36903d2d6c | |||
c54493ddbc | |||
e98f109dcc | |||
32704386ee | |||
8ec3d593c1 | |||
f3f05b89d9 | |||
7104c8b1b5 | |||
dcb4ee301b | |||
df12f0ad83 | |||
01823fb683 | |||
649e69e1f2 | |||
05a361046e | |||
a551989f8b | |||
7f765c08e4 | |||
4e7b5a693d | |||
20e36fbdf2 | |||
a61d87a9a0 | |||
953957cae3 | |||
c712a9a09c | |||
5a94f116e1 | |||
0e80700481 | |||
22ec504b0f | |||
3d39f65ed0 | |||
7c450876f2 | |||
d7c3752dfa | |||
f53e5bcc83 | |||
d8301314a7 | |||
155b0b9f91 | |||
61c493ce72 | |||
4358e1d64d | |||
1e6296f980 | |||
0be2243ced | |||
b6c0d8013b | |||
54815c49d6 | |||
104413c37f | |||
68afa0bbdf | |||
90f618eeff | |||
4c6fb95ec9 | |||
38ddb7be1f | |||
4489be479e | |||
7cd2993be0 | |||
36d4462504 | |||
16c7ce2394 | |||
fd1a14524f | |||
c97215ed2d | |||
6dbe5098de | |||
3e9a288333 | |||
07b876ea2c | |||
28fec7a488 | |||
b99ac03942 | |||
ba6519adb5 | |||
2de0e63b3c |
@ -6,8 +6,8 @@ on:
|
|||||||
- '**'
|
- '**'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
IMAGE: code.foss.global/hosttoday/ht-docker-node:npmci
|
||||||
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@/${{gitea.repository}}.git
|
||||||
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||||
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||||
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||||
@ -26,7 +26,7 @@ jobs:
|
|||||||
- name: Install pnpm and npmci
|
- name: Install pnpm and npmci
|
||||||
run: |
|
run: |
|
||||||
pnpm install -g pnpm
|
pnpm install -g pnpm
|
||||||
pnpm install -g @shipzone/npmci
|
pnpm install -g @ship.zone/npmci
|
||||||
|
|
||||||
- name: Run npm prepare
|
- name: Run npm prepare
|
||||||
run: npmci npm prepare
|
run: npmci npm prepare
|
||||||
|
@ -6,8 +6,8 @@ on:
|
|||||||
- '*'
|
- '*'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
IMAGE: code.foss.global/hosttoday/ht-docker-node:npmci
|
||||||
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@/${{gitea.repository}}.git
|
||||||
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||||
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||||
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||||
@ -26,7 +26,7 @@ jobs:
|
|||||||
- name: Prepare
|
- name: Prepare
|
||||||
run: |
|
run: |
|
||||||
pnpm install -g pnpm
|
pnpm install -g pnpm
|
||||||
pnpm install -g @shipzone/npmci
|
pnpm install -g @ship.zone/npmci
|
||||||
npmci npm prepare
|
npmci npm prepare
|
||||||
|
|
||||||
- name: Audit production dependencies
|
- name: Audit production dependencies
|
||||||
@ -54,7 +54,7 @@ jobs:
|
|||||||
- name: Prepare
|
- name: Prepare
|
||||||
run: |
|
run: |
|
||||||
pnpm install -g pnpm
|
pnpm install -g pnpm
|
||||||
pnpm install -g @shipzone/npmci
|
pnpm install -g @ship.zone/npmci
|
||||||
npmci npm prepare
|
npmci npm prepare
|
||||||
|
|
||||||
- name: Test stable
|
- name: Test stable
|
||||||
@ -82,7 +82,7 @@ jobs:
|
|||||||
- name: Prepare
|
- name: Prepare
|
||||||
run: |
|
run: |
|
||||||
pnpm install -g pnpm
|
pnpm install -g pnpm
|
||||||
pnpm install -g @shipzone/npmci
|
pnpm install -g @ship.zone/npmci
|
||||||
npmci npm prepare
|
npmci npm prepare
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
@ -104,7 +104,7 @@ jobs:
|
|||||||
- name: Prepare
|
- name: Prepare
|
||||||
run: |
|
run: |
|
||||||
pnpm install -g pnpm
|
pnpm install -g pnpm
|
||||||
pnpm install -g @shipzone/npmci
|
pnpm install -g @ship.zone/npmci
|
||||||
npmci npm prepare
|
npmci npm prepare
|
||||||
|
|
||||||
- name: Code quality
|
- name: Code quality
|
||||||
@ -119,6 +119,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
npmci node install stable
|
npmci node install stable
|
||||||
npmci npm install
|
npmci npm install
|
||||||
pnpm install -g @gitzone/tsdoc
|
pnpm install -g @git.zone/tsdoc
|
||||||
npmci command tsdoc
|
npmci command tsdoc
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
349
changelog.md
Normal file
349
changelog.md
Normal file
@ -0,0 +1,349 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-04-08 - 5.6.3 - fix(package.json)
|
||||||
|
Update dependency versions for smartmongo, smartrequest, tsbuild, and @types/node
|
||||||
|
|
||||||
|
- Bump @push.rocks/smartmongo from 2.0.10 to 2.0.12
|
||||||
|
- Bump @push.rocks/smartrequest from 2.0.23 to 2.1.0
|
||||||
|
- Bump @git.zone/tsbuild from 2.2.6 to 2.3.2
|
||||||
|
- Bump @types/node from 22.13.10 to 22.14.0
|
||||||
|
|
||||||
|
## 2025-04-02 - 5.6.2 - fix(package.json)
|
||||||
|
Fix formatting in package.json to correctly include the packageManager field
|
||||||
|
|
||||||
|
- Added missing comma after the keywords array
|
||||||
|
- Ensured proper inclusion of the packageManager field for consistency
|
||||||
|
|
||||||
|
## 2025-04-02 - 5.6.1 - fix(readme)
|
||||||
|
Update README: Revamp structure for features, installation, and examples
|
||||||
|
|
||||||
|
- Reorganized sections to highlight features, installation, core API, and getting started
|
||||||
|
- Updated code examples for clarity, including Node integration and web testing sections
|
||||||
|
- Standardized headings and removed extraneous documentation details
|
||||||
|
|
||||||
|
## 2025-03-17 - 5.6.0 - feat(tap)
|
||||||
|
Add explicit fail method to the Tap class for better test failure handling
|
||||||
|
|
||||||
|
- Introduced fail() method that throws a custom error message to explicitly mark test failures
|
||||||
|
- Improves clarity in test flow by giving developers a direct way to trigger error states
|
||||||
|
|
||||||
|
## 2025-03-08 - 5.5.10 - fix(node)
|
||||||
|
Removed unused jest dependency from project.
|
||||||
|
|
||||||
|
- Removed '@jest/globals' from dependencies in package.json.
|
||||||
|
- Removed unused jest import from ts_node/index.ts.
|
||||||
|
- Kept 'expect' dependency from jest library.
|
||||||
|
|
||||||
|
## 2025-03-08 - 5.5.9 - fix(dependencies)
|
||||||
|
Fix missing jest dependency in package.json and update exports in ts_node/index.ts
|
||||||
|
|
||||||
|
- Added missing '@jest/globals' dependency to package.json.
|
||||||
|
- Updated ts_node/index.ts to properly export jest along with jestExpect.
|
||||||
|
|
||||||
|
## 2025-03-08 - 5.5.8 - fix(test)
|
||||||
|
Ensure compatibility with async/await in test cases.
|
||||||
|
|
||||||
|
|
||||||
|
## 2025-03-08 - 5.5.7 - fix(dependencies)
|
||||||
|
Updated project dependencies to the latest versions for improved stability and performance.
|
||||||
|
|
||||||
|
- Updated `@push.rocks/smartexpect` to version 1.6.1.
|
||||||
|
- Updated `@push.rocks/smartfile` to version 11.2.0.
|
||||||
|
- Updated `@push.rocks/smartpromise` to version 4.2.3.
|
||||||
|
- Updated `@push.rocks/smartshell` to version 3.2.3.
|
||||||
|
- Updated `@git.zone/tsbuild` to version 2.2.6.
|
||||||
|
- Updated `@git.zone/tstest` to version 1.0.96.
|
||||||
|
- Updated `@types/node` to version 22.13.10.
|
||||||
|
|
||||||
|
## 2025-01-19 - 5.5.6 - fix(dependencies)
|
||||||
|
Update smartpromise dependency to version 4.2.0.
|
||||||
|
|
||||||
|
- Updated @push.rocks/smartpromise dependency from version 4.1.0 to 4.2.0 in package.json.
|
||||||
|
|
||||||
|
## 2025-01-19 - 5.5.5 - fix(dependencies)
|
||||||
|
Update dependencies to the latest versions to address multiple fixes.
|
||||||
|
|
||||||
|
- Updated @push.rocks/smartexpect to version ^1.4.0.
|
||||||
|
- Updated @push.rocks/smartfile to version ^11.1.5.
|
||||||
|
- Updated @push.rocks/smartpromise to version ^4.1.0.
|
||||||
|
- Updated @types/node to version ^22.10.7.
|
||||||
|
- Updated randomstring to version ^1.3.1.
|
||||||
|
|
||||||
|
## 2024-12-30 - 5.5.4 - fix(dependencies)
|
||||||
|
Update package dependencies to their latest versions.
|
||||||
|
|
||||||
|
- Updated @push.rocks/smartexpect from ^1.2.1 to ^1.3.0.
|
||||||
|
- Updated @push.rocks/smartfile from ^11.0.21 to ^11.0.23.
|
||||||
|
- Updated @push.rocks/smartshell from ^3.0.6 to ^3.2.2.
|
||||||
|
- Updated @push.rocks/smarttime from ^4.0.8 to ^4.1.1.
|
||||||
|
- Updated @types/node from ^22.9.3 to ^22.10.2.
|
||||||
|
|
||||||
|
## 2024-11-23 - 5.5.3 - fix(docs)
|
||||||
|
Update description and keywords in package files for clarity
|
||||||
|
|
||||||
|
- Updated project description in package.json and npmextra.json for better clarity.
|
||||||
|
- Enhanced keywords list in package.json and npmextra.json to cover more relevant topics.
|
||||||
|
- Revised README.md content to provide a more comprehensive usage guide and correct mismatched sections.
|
||||||
|
|
||||||
|
## 2024-11-23 - 5.5.2 - fix(core)
|
||||||
|
Apply code cleanup and refactoring.
|
||||||
|
|
||||||
|
|
||||||
|
## 2024-11-23 - 5.5.1 - fix(core)
|
||||||
|
Update dependencies and add jestExpect export
|
||||||
|
|
||||||
|
- Updated '@push.rocks/qenv' to '^6.1.0' in dependencies.
|
||||||
|
- Updated 'expect' package version to '^29.7.0' in dependencies.
|
||||||
|
- Updated '@types/node' to '^22.9.3' in devDependencies.
|
||||||
|
- Added jestExpect export in ts_node/index.ts.
|
||||||
|
|
||||||
|
## 2024-11-06 - 5.5.0 - feat(tapnodetools)
|
||||||
|
Add TestFileProvider for handling Docker Alpine image
|
||||||
|
|
||||||
|
- Introduced TestFileProvider in TapNodeTools.
|
||||||
|
- Added method to retrieve Docker Alpine image as a local tarball.
|
||||||
|
|
||||||
|
## 2024-11-06 - 5.4.4 - fix(dependencies)
|
||||||
|
Update smarts3 dependency to version 2.2.5
|
||||||
|
|
||||||
|
|
||||||
|
## 2024-11-06 - 5.4.3 - fix(TapNodeTools)
|
||||||
|
Fix server port default value in createSmarts3 method
|
||||||
|
|
||||||
|
- The `createSmarts3` method in `TapNodeTools` now explicitly sets the port to 3003.
|
||||||
|
|
||||||
|
## 2024-11-06 - 5.4.2 - fix(dependencies)
|
||||||
|
Update smarts3 dependency version to fix issues.
|
||||||
|
|
||||||
|
- Changed the version of @push.rocks/smarts3 from ^2.2.1 to ^2.2.2.
|
||||||
|
|
||||||
|
## 2024-11-06 - 5.4.1 - fix(ci)
|
||||||
|
Fix CI configuration URL and package installation paths.
|
||||||
|
|
||||||
|
- Updated Docker image URL in CI config.
|
||||||
|
- Fixed repository URL format in package.json.
|
||||||
|
- Corrected npmci package installation path.
|
||||||
|
|
||||||
|
## 2024-11-06 - 5.4.0 - feat(node)
|
||||||
|
Add smartmongo and smarts3 integration in node tools
|
||||||
|
|
||||||
|
- Added createSmartmongo method to TapNodeTools for creating SmartMongo instances.
|
||||||
|
- Added createSmarts3 method to TapNodeTools for creating Smarts3 instances.
|
||||||
|
- Updated dependencies with smartmongo and smarts3 in package.json.
|
||||||
|
|
||||||
|
## 2024-09-19 - 5.3.0 - feat(TapNodeTools)
|
||||||
|
Add getEnvVarOnDemand method to TapNodeTools
|
||||||
|
|
||||||
|
- Introduced a new method getEnvVarOnDemand to the TapNodeTools class to fetch environment variables on demand.
|
||||||
|
- Enhanced getQenv function in TapNodeTools class to cache the Qenv instance for better performance.
|
||||||
|
|
||||||
|
## 2024-09-19 - 5.2.2 - fix(core)
|
||||||
|
Ensure reliability in test setup and execution
|
||||||
|
|
||||||
|
- Added new pre-task functionality to log starting of tasks.
|
||||||
|
- Enhanced `runCommand` method to better handle shell command execution.
|
||||||
|
- Fixed issue in `createHttpsCert` to correctly generate self-signed certificates.
|
||||||
|
|
||||||
|
## 2024-09-19 - 5.2.1 - fix(tapbundle)
|
||||||
|
Add qenv package to dependencies for environment management
|
||||||
|
|
||||||
|
- Added @push.rocks/qenv to dependencies in package.json.
|
||||||
|
- Updated TapNodeTools class in ts_node/classes.tapnodetools.ts to include getQenv method.
|
||||||
|
- Imported qenv in ts_node/plugins.ts.
|
||||||
|
|
||||||
|
## 2024-09-18 - 5.2.0 - feat(TapNodeTools)
|
||||||
|
Add ability to create HTTPS certificates with self-signed option
|
||||||
|
|
||||||
|
- Introduced a new parameter `allowSelfSigned` to the `createHttpsCert` function.
|
||||||
|
|
||||||
|
## 2024-09-18 - 5.1.4 - fix(ts_node)
|
||||||
|
Fixed issues in HTTPS certificate generation for TapNodeTools
|
||||||
|
|
||||||
|
- Updated 'createHttpsCert' method in 'TapNodeTools' to use 'smartcrypto' for generating RSA key pair and self-signed certificate.
|
||||||
|
- Corrected certificate and private key PEM encoding.
|
||||||
|
|
||||||
|
## 2024-09-18 - 5.1.3 - fix(ts_node/classes.tapnodetools.ts)
|
||||||
|
Refactored methods and improved type annotations in TapNodeTools class.
|
||||||
|
|
||||||
|
- Refactored `runCommand` method to include proper type annotations.
|
||||||
|
- Enhanced `createHttpsCert` method with proper type annotations and key generation logic.
|
||||||
|
- Introduced `generateSelfSignedCert` method for better code organization and readability.
|
||||||
|
|
||||||
|
## 2024-09-18 - 5.1.2 - fix(TapNodeTools)
|
||||||
|
Default parameter added to createHttpsCert method
|
||||||
|
|
||||||
|
- Updated createHttpsCert method to provide a default value for the parameter commonName.
|
||||||
|
|
||||||
|
## 2024-09-18 - 5.1.1 - fix(ts_node)
|
||||||
|
Fixed createHttpsCert interface
|
||||||
|
|
||||||
|
- Removed unnecessary keyFile and certFile parameters from createHttpsCert method.
|
||||||
|
|
||||||
|
## 2024-09-18 - 5.1.0 - feat(ts_node)
|
||||||
|
Add support for HTTPS certificate creation
|
||||||
|
|
||||||
|
- Added TapNodeTools class with methods to run commands and create HTTPS certificates
|
||||||
|
- Exported necessary plugins including crypto and fs for node
|
||||||
|
- Updated test cases to include tests for HTTPS certificate creation
|
||||||
|
|
||||||
|
## 2024-09-17 - 5.0.25 - fix(core)
|
||||||
|
Fix typos in package.json, update dependencies and update workflow.
|
||||||
|
|
||||||
|
- Fixed references to deprecated package names in workflows and package.json.
|
||||||
|
- Updated versions of @push.rocks dependencies to latest stable.
|
||||||
|
- Corrected scripts in package.json to reflect new build and documentation commands.
|
||||||
|
- Fixed async startup in browser tests.
|
||||||
|
|
||||||
|
## 2024-08-17 - 5.0.24 - fix(dependencies)
|
||||||
|
Update dependencies
|
||||||
|
|
||||||
|
- Updated @push.rocks/smartexpect from ^1.0.21 to ^1.1.0
|
||||||
|
- Updated @push.rocks/smartjson from ^5.0.16 to ^5.0.20
|
||||||
|
- Updated @push.rocks/smartpromise from ^4.0.2 to ^4.0.4
|
||||||
|
- Updated @push.rocks/smarttime from ^4.0.6 to ^4.0.8
|
||||||
|
- Updated @types/node from ^20.11.30 to ^22.4.0
|
||||||
|
|
||||||
|
## 2024-05-29 - 5.0.23 - General Update
|
||||||
|
update description
|
||||||
|
|
||||||
|
## 2024-04-14 to 2024-04-15 - 5.0.22 - Configuration Updates and Bug Fixes
|
||||||
|
Multiple updates in tsconfig and npmextra.json
|
||||||
|
|
||||||
|
- fix(core): update
|
||||||
|
- update tsconfig
|
||||||
|
- update npmextra.json: githost
|
||||||
|
|
||||||
|
## 2024-03-19 - 5.0.21 to 5.0.17 - Bug Fix Release
|
||||||
|
Multiple core fixes and updates without specific feature changes
|
||||||
|
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2024-03-13 - 5.0.16 - Bug Fix Release
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2023-08-12 - 5.0.15 to 5.0.13 - Bug Fix Release
|
||||||
|
Multiple core fixes and updates without specific feature changes
|
||||||
|
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2023-07-13 - 5.0.12 to 5.0.10 - Bug Fix Release
|
||||||
|
Multiple core fixes and updates without specific feature changes
|
||||||
|
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2023-06-22 - 5.0.9 to 5.0.7 - Bug Fix Release
|
||||||
|
Multiple core fixes and updates without specific feature changes
|
||||||
|
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2022-07-24 - 5.0.6 to 5.0.3 - Bug Fix Release
|
||||||
|
Multiple core fixes and updates without specific feature changes
|
||||||
|
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2022-03-14 - 5.0.2 to 5.0.0 - Initial Release of Version 5.x.x
|
||||||
|
Multiple bug fixes and updates.
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2022-03-14 - 4.0.9 to 4.0.8 - Bug Fix Release
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2022-02-28 - 4.0.7 to 4.0.4 - Bug Fix Release
|
||||||
|
Multiple core fixes and updates without specific feature changes
|
||||||
|
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2022-02-02 - 4.0.3 to 4.0.1 - Bug Fix Release
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2022-01-21 - 4.0.0 - Major Release
|
||||||
|
Version 4.x.x Major improvements and core fixes
|
||||||
|
|
||||||
|
## 2021-12-10 - 3.2.15 - Breaking Change
|
||||||
|
BREAKING CHANGE(core): switch to @pushrocks/smartexpect
|
||||||
|
|
||||||
|
## 2021-12-10 - 3.2.14 - Bug Fix Release
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2021-02-13 - 3.2.13 - Bug Fix Release
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2021-01-26 - 3.2.12 to 3.2.11 - Bug Fix Release
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2020-07-11 - 3.2.10 to 3.2.8 - Bug Fix Release
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2020-07-08 - 3.2.7 to 3.2.4 - Bug Fix Release
|
||||||
|
Multiple core fixes and updates without specific feature changes
|
||||||
|
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2020-07-08 - 3.2.5 - Documentation Update
|
||||||
|
- update readme
|
||||||
|
|
||||||
|
## 2019-11-16 - 3.1.0 - New Feature
|
||||||
|
- feat(pretask): introduce new pretask functionality for setting up testing environment
|
||||||
|
|
||||||
|
## 2019-11-16 - 3.0.14 - New Feature
|
||||||
|
- feat(tools): can now ensure certain directories
|
||||||
|
|
||||||
|
## 2019-08-23 - 3.0.13 - Bug Fix Release
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2019-08-22 - 3.0.12 - Bug Fix Release
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2019-06-19 - 3.0.11 - Bug Fix Release
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2019-04-10 - 3.0.9 to 3.0.8 - Bug Fix Release
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2018-09-03 - 3.0.7 - Bug Fix Release
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2018-09-02 - 3.0.6 - Dependency Update
|
||||||
|
- fix(dependencies): update to latest versions
|
||||||
|
|
||||||
|
## 2018-08-08 - 3.0.5 - New Feature
|
||||||
|
- fix(core): add tap.only option
|
||||||
|
|
||||||
|
## 2018-08-08 - 3.0.4 - Dependency Update
|
||||||
|
- fix(dependencies): update
|
||||||
|
|
||||||
|
## 2018-08-08 - 3.0.3 - Dependency Update
|
||||||
|
- fix(dependencies): use @git.zone/tsbuild instead of npmts
|
||||||
|
|
||||||
|
## 2018-07-18 - 3.0.2 - Dependency Update
|
||||||
|
- fix(dependencies): now typings-global free
|
||||||
|
|
||||||
|
## 2018-07-13 - 3.0.1 - Dependency Update
|
||||||
|
- fix(dependencies): update
|
||||||
|
|
||||||
|
## 2018-07-13 - 3.0.0 - Package Update
|
||||||
|
- fix(package): npm access level
|
||||||
|
|
||||||
|
## 2018-06-28 - 2.0.2 - Breaking Change
|
||||||
|
BREAKING CHANGE(package): change scope
|
||||||
|
|
||||||
|
## 2018-06-28 - 2.0.1 - Security Update
|
||||||
|
- fix(security): add snyk file
|
||||||
|
|
||||||
|
## 2018-02-27 - 2.0.0 - Compatibility Update
|
||||||
|
- fix(core): fix node 10.x.x compatibility
|
||||||
|
|
||||||
|
## 2017-10-11 - 1.1.8 - Update
|
||||||
|
- update to use latest smartchai
|
||||||
|
|
||||||
|
## 2017-10-11 - 1.1.7 - Update
|
||||||
|
- update ci
|
||||||
|
|
||||||
|
## 2017-10-10 - 1.1.6 - Documentation Update
|
||||||
|
- add new docs
|
||||||
|
|
||||||
|
## 2017-10-09 - 1.1.5 - Feature Update
|
||||||
|
- now has working leak detection
|
||||||
|
|
||||||
|
## 2017-03-26 - 1.0.9 - Standards Update
|
||||||
|
- update to latest standards
|
@ -11,12 +11,39 @@
|
|||||||
"gitzone": {
|
"gitzone": {
|
||||||
"projectType": "npm",
|
"projectType": "npm",
|
||||||
"module": {
|
"module": {
|
||||||
"githost": "gitlab.com",
|
"githost": "code.foss.global",
|
||||||
"gitscope": "push.rocks",
|
"gitscope": "push.rocks",
|
||||||
"gitrepo": "tapbundle",
|
"gitrepo": "tapbundle",
|
||||||
"description": "tap bundled for tapbuffer",
|
"description": "A comprehensive testing automation library that provides a wide range of utilities and tools for TAP (Test Anything Protocol) based testing, especially suitable for projects using tapbuffer.",
|
||||||
"npmPackagename": "@push.rocks/tapbundle",
|
"npmPackagename": "@push.rocks/tapbundle",
|
||||||
"license": "MIT"
|
"license": "MIT",
|
||||||
}
|
"keywords": [
|
||||||
|
"testing",
|
||||||
|
"automation",
|
||||||
|
"TAP",
|
||||||
|
"Test Anything Protocol",
|
||||||
|
"unit testing",
|
||||||
|
"integration testing",
|
||||||
|
"TypeScript",
|
||||||
|
"JavaScript",
|
||||||
|
"test runner",
|
||||||
|
"test framework",
|
||||||
|
"web helpers",
|
||||||
|
"test utilities",
|
||||||
|
"asynchronous testing",
|
||||||
|
"environment variables",
|
||||||
|
"crypto",
|
||||||
|
"shell commands",
|
||||||
|
"Node.js",
|
||||||
|
"cloud storage",
|
||||||
|
"browser testing",
|
||||||
|
"UI components",
|
||||||
|
"parallel testing",
|
||||||
|
"test lifecycle management"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tsdoc": {
|
||||||
|
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
73
package.json
73
package.json
@ -1,41 +1,53 @@
|
|||||||
{
|
{
|
||||||
"name": "@push.rocks/tapbundle",
|
"name": "@push.rocks/tapbundle",
|
||||||
"private": false,
|
"private": false,
|
||||||
"version": "5.0.16",
|
"version": "5.6.3",
|
||||||
"description": "tap bundled for tapbuffer",
|
"description": "A comprehensive testing automation library that provides a wide range of utilities and tools for TAP (Test Anything Protocol) based testing, especially suitable for projects using tapbuffer.",
|
||||||
"main": "dist_ts/index.js",
|
"exports": {
|
||||||
"typings": "dist_ts/index.d.ts",
|
".": "./dist_ts/index.js",
|
||||||
|
"./node": "./dist_ts_node/index.js"
|
||||||
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/)",
|
"test": "(tstest test/)",
|
||||||
"build": "(tsbuild --web --allowimplicitany --skiplibcheck)",
|
"build": "(tsbuild tsfolders --web --allowimplicitany --skiplibcheck)",
|
||||||
"buildDocs": "tsdoc"
|
"buildDocs": "tsdoc"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+ssh://git@gitlab.com/pushrocks/tapbundle.git"
|
"url": "git+https://code.foss.global/push.rocks/tapbundle.git"
|
||||||
},
|
},
|
||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://gitlab.com/pushrocks/tapbundle/issues"
|
"url": "https://code.foss.global/push.rocks/tapbundle/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/tapbundle#README",
|
"homepage": "https://code.foss.global/push.rocks/tapbundle#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@open-wc/testing": "^2.5.33",
|
"@open-wc/testing": "^4.0.0",
|
||||||
"@push.rocks/consolecolor": "^2.0.2",
|
"@push.rocks/consolecolor": "^2.0.2",
|
||||||
|
"@push.rocks/qenv": "^6.1.0",
|
||||||
|
"@push.rocks/smartcrypto": "^2.0.4",
|
||||||
"@push.rocks/smartdelay": "^3.0.5",
|
"@push.rocks/smartdelay": "^3.0.5",
|
||||||
"@push.rocks/smartenv": "^5.0.12",
|
"@push.rocks/smartenv": "^5.0.12",
|
||||||
"@push.rocks/smartexpect": "^1.0.21",
|
"@push.rocks/smartexpect": "^1.6.1",
|
||||||
"@push.rocks/smartpromise": "^4.0.2",
|
"@push.rocks/smartfile": "^11.2.0",
|
||||||
"@push.rocks/smarttime": "^4.0.6"
|
"@push.rocks/smartjson": "^5.0.20",
|
||||||
|
"@push.rocks/smartmongo": "^2.0.12",
|
||||||
|
"@push.rocks/smartpath": "^5.0.18",
|
||||||
|
"@push.rocks/smartpromise": "^4.2.3",
|
||||||
|
"@push.rocks/smartrequest": "^2.1.0",
|
||||||
|
"@push.rocks/smarts3": "^2.2.5",
|
||||||
|
"@push.rocks/smartshell": "^3.2.3",
|
||||||
|
"@push.rocks/smarttime": "^4.1.1",
|
||||||
|
"expect": "^29.7.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.66",
|
"@git.zone/tsbuild": "^2.3.2",
|
||||||
"@gitzone/tsrun": "^1.2.43",
|
"@git.zone/tsrun": "^1.2.43",
|
||||||
"@gitzone/tstest": "^1.0.77",
|
"@git.zone/tstest": "^1.0.96",
|
||||||
"@types/node": "^20.11.27",
|
"@types/node": "^22.14.0",
|
||||||
"randomstring": "^1.3.0"
|
"randomstring": "^1.3.1"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
@ -51,5 +63,30 @@
|
|||||||
],
|
],
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 1 chrome versions"
|
"last 1 chrome versions"
|
||||||
]
|
],
|
||||||
|
"keywords": [
|
||||||
|
"testing",
|
||||||
|
"automation",
|
||||||
|
"TAP",
|
||||||
|
"Test Anything Protocol",
|
||||||
|
"unit testing",
|
||||||
|
"integration testing",
|
||||||
|
"TypeScript",
|
||||||
|
"JavaScript",
|
||||||
|
"test runner",
|
||||||
|
"test framework",
|
||||||
|
"web helpers",
|
||||||
|
"test utilities",
|
||||||
|
"asynchronous testing",
|
||||||
|
"environment variables",
|
||||||
|
"crypto",
|
||||||
|
"shell commands",
|
||||||
|
"Node.js",
|
||||||
|
"cloud storage",
|
||||||
|
"browser testing",
|
||||||
|
"UI components",
|
||||||
|
"parallel testing",
|
||||||
|
"test lifecycle management"
|
||||||
|
],
|
||||||
|
"packageManager": "pnpm@10.7.0+sha512.6b865ad4b62a1d9842b61d674a393903b871d9244954f652b8842c2b553c72176b278f64c463e52d40fff8aba385c235c8c9ecf5cc7de4fd78b8bb6d49633ab6"
|
||||||
}
|
}
|
||||||
|
13986
pnpm-lock.yaml
generated
13986
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
1
readme.hints.md
Normal file
1
readme.hints.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
250
readme.md
250
readme.md
@ -1,87 +1,195 @@
|
|||||||
# @push.rocks/tapbundle
|
# @push.rocks/tapbundle
|
||||||
tap bundled for tapbuffer
|
|
||||||
|
|
||||||
## Availabililty and Links
|
A test automation library bundling utilities and tools for TAP (Test Anything Protocol) based testing, specifically tailored for tapbuffer.
|
||||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/tapbundle)
|
|
||||||
* [gitlab.com (source)](https://gitlab.com/push.rocks/tapbundle)
|
|
||||||
* [github.com (source mirror)](https://github.com/push.rocks/tapbundle)
|
|
||||||
* [docs (typedoc)](https://push.rocks.gitlab.io/tapbundle/)
|
|
||||||
|
|
||||||
## Status for master
|
## Features
|
||||||
|
|
||||||
Status Category | Status Badge
|
- TAP (Test Anything Protocol) compliant output
|
||||||
-- | --
|
- Support for both browser and Node.js environments
|
||||||
GitLab Pipelines | [](https://lossless.cloud)
|
- Built-in test coordination and timing measurements
|
||||||
GitLab Pipline Test Coverage | [](https://lossless.cloud)
|
- Parallel and sequential test execution
|
||||||
npm | [](https://lossless.cloud)
|
- Pre-task support for setup operations
|
||||||
Snyk | [](https://lossless.cloud)
|
- Rich assertion library via `expect`
|
||||||
TypeScript Support | [](https://lossless.cloud)
|
- Comprehensive Node.js tooling (shell, crypto, MongoDB, S3)
|
||||||
node Support | [](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
|
||||||
Code Style | [](https://lossless.cloud)
|
## Installation
|
||||||
PackagePhobia (total standalone install weight) | [](https://lossless.cloud)
|
|
||||||
PackagePhobia (package size on registry) | [](https://lossless.cloud)
|
```bash
|
||||||
BundlePhobia (total size when bundled) | [](https://lossless.cloud)
|
npm install @push.rocks/tapbundle --save-dev
|
||||||
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Use TypeScript for best in class instellisense.
|
The `@push.rocks/tapbundle` is a versatile testing framework compatible with TAP, designed using TypeScript to facilitate robust and scalable testing of applications, whether you are dealing with unit tests, integration tests, or simply need a streamlined way to automate assertions across your application's lifecycle. The framework is especially useful if you are already using or planning to use tapbuffer.
|
||||||
|
|
||||||
A few words on TypeScript
|
### Core API
|
||||||
|
|
||||||
### Included in this package
|
The main test runner is accessed through the `tap` object:
|
||||||
|
|
||||||
- tap compatible testing framework written in TypeScript
|
|
||||||
- `expect` and `expectAsync` from the package `@pushrocks/smartexpect`
|
|
||||||
|
|
||||||
### A few words on tap
|
|
||||||
|
|
||||||
**"tap"** stands for **"test anything protocol"**. Its programming language agnostic as long as the test interpreter can read the tap console output. This package is optimized to work with @gitzone/tstest as interpreter, which offers different V8 based runtime environments like nodejs, chrome, and deno.
|
|
||||||
|
|
||||||
### Write your first tests
|
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { tap, expect, expectAsync } from 'tapbundle'; // has typings in place
|
tap.test(
|
||||||
|
description: string, // Test description
|
||||||
import * as myAwesomeModuleToTest from '../dist/index'; // '../dist/index' is the standard path for npmts modules
|
testFunction: async (tools?: TapTools) => Promise<any>, // Test implementation
|
||||||
|
modeArg: 'normal' | 'only' | 'skip' = 'normal' // Execution mode
|
||||||
tap.test('my awesome description', async (tools) => {
|
): TapTest
|
||||||
// tools are optional parameter
|
|
||||||
tools.timeout(2000); // test will fail if it takes longer than 2000 millisenconds
|
|
||||||
});
|
|
||||||
|
|
||||||
const myTest2 = tap.test('my awesome test 2', async (tools) => {
|
|
||||||
myAwsomeModuleToTest.doSomethingAsync(); // we don't wait here
|
|
||||||
await tools.delayFor(3000); // yay! :) promise based timeouts :)
|
|
||||||
console.log('This gets logged 3000 ms into the test');
|
|
||||||
});
|
|
||||||
|
|
||||||
tap.test('my awesome test 3', async (tools) => {
|
|
||||||
expect(true).toBeTrue(); // will not throw
|
|
||||||
await expectAsync(tools.delayFor(2000)).toBeUndefined(); // yay expect promises :)
|
|
||||||
expectAsync(myTest2.promise) // access other tests metadata :)
|
|
||||||
.property('hrtMeasurement') // and drill down into properties
|
|
||||||
.property('milliSeconds')
|
|
||||||
.toBeGreaterThan(1000);
|
|
||||||
});
|
|
||||||
|
|
||||||
const myTest4 = tap.testParallel('my awesome test 4', async (tools) => {
|
|
||||||
await tools.delayFor(4000);
|
|
||||||
console.log('logs to console after 4 seconds into this test');
|
|
||||||
});
|
|
||||||
|
|
||||||
tap.test('my awesome test 5', async () => {
|
|
||||||
expect(myTest4.status).toEqual('pending'); // since this test will likely finish before myTest4.
|
|
||||||
});
|
|
||||||
|
|
||||||
tap.start(); // start the test, will automtically plan tests for you (so the tap parser knows when tests exit bofore they are finished)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Contribution
|
### Getting Started
|
||||||
|
|
||||||
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
|
1. **Basic Setup**
|
||||||
|
|
||||||
For further information read the linked docs at the top of this readme.
|
First, import the necessary modules:
|
||||||
|
|
||||||
## Legal
|
```typescript
|
||||||
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
|
import { tap, expect, expectAsync } from '@push.rocks/tapbundle';
|
||||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
```
|
||||||
|
|
||||||
|
Start with a simple test:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
tap.test('Initial test succeeds', async () => {
|
||||||
|
return expect(true).toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.start();
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Defining and Organizing Tests**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
tap.test('basic arithmetic test', async () => {
|
||||||
|
expect(1 + 1).toEqual(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Async Tests
|
||||||
|
tap.test('async operation test', async () => {
|
||||||
|
const fetchData = async () => Promise.resolve('data');
|
||||||
|
await expectAsync(fetchData()).toBeResolved();
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Tools for Advanced Testing**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Delay and Timing
|
||||||
|
tap.test('test with delay', async (tools) => {
|
||||||
|
await tools.delayFor(500); // waits for 500ms
|
||||||
|
expect(true).toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Custom Pre Tasks
|
||||||
|
tap.preTask('initialize environment', async () => {
|
||||||
|
console.log('Setting up preconditions');
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Execution Control**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Skip tests
|
||||||
|
tap.skip.test('skip this test', async () => {
|
||||||
|
// This test will be ignored
|
||||||
|
});
|
||||||
|
|
||||||
|
// Exclusive tests
|
||||||
|
tap.only.test('run this test exclusively', async () => {
|
||||||
|
// Only this test will run
|
||||||
|
});
|
||||||
|
|
||||||
|
// Colored output
|
||||||
|
tap.test('test with colored output', async (tools) => {
|
||||||
|
const message = await tools.coloredString('Test Passed!', 'green');
|
||||||
|
console.log(message);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
5. **Node.js Integration**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { tapNodeTools } from '@push.rocks/tapbundle/node';
|
||||||
|
|
||||||
|
tap.test('execute shell command', async () => {
|
||||||
|
const result = await tapNodeTools.runCommand('ls -la');
|
||||||
|
expect(result.exitCode).toEqual(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('create HTTPS certificate', async () => {
|
||||||
|
const { key, cert } = await tapNodeTools.createHttpsCert('localhost');
|
||||||
|
expect(key).toInclude('-----BEGIN RSA PRIVATE KEY-----');
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
6. **Environment Variables**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
tap.test('use environment variable', async (tools) => {
|
||||||
|
const dbUrl = await tools.getEnvVarOnDemand('DB_URL');
|
||||||
|
expect(dbUrl).toBeDefined();
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
7. **Asynchronous Control**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
tap.test('controlled async scenario', async (tools) => {
|
||||||
|
const asyncOp = async () => Promise.resolve('complete');
|
||||||
|
tools.timeout(1000); // if operation exceeds 1000ms, test fails
|
||||||
|
const result = await asyncOp();
|
||||||
|
expect(result).toBe('complete');
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
8. **Web Testing**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { webhelpers } from '@push.rocks/tapbundle';
|
||||||
|
|
||||||
|
tap.test('web component test', async () => {
|
||||||
|
const element = await webhelpers.fixture(
|
||||||
|
webhelpers.html`<my-element></my-element>`
|
||||||
|
);
|
||||||
|
expect(element.shadowRoot.querySelector('div')).toBeDefined();
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
9. **Database and Storage Testing**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
tap.test('Smartmongo setup test', async () => {
|
||||||
|
const smartmongo = await tapNodeTools.createSmartmongo();
|
||||||
|
await smartmongo.stop();
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('Smarts3 setup', async () => {
|
||||||
|
const smarts3 = await tapNodeTools.createSmarts3();
|
||||||
|
console.log('Smarts3 running');
|
||||||
|
await smarts3.stop();
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## Best Practices
|
||||||
|
|
||||||
|
1. Use descriptive test names that explain the expected behavior
|
||||||
|
2. Leverage pre-tasks for common setup operations
|
||||||
|
3. Use `testParallel` for independent tests that can run concurrently
|
||||||
|
4. Utilize test coordination for dependent tests
|
||||||
|
5. Set appropriate timeouts for async operations
|
||||||
|
|
||||||
|
## License and Legal Information
|
||||||
|
|
||||||
|
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
||||||
|
|
||||||
|
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
### Trademarks
|
||||||
|
|
||||||
|
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
|
||||||
|
|
||||||
|
### Company Information
|
||||||
|
|
||||||
|
Task Venture Capital GmbH
|
||||||
|
Registered at District court Bremen HRB 35230 HB, Germany
|
||||||
|
|
||||||
|
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
||||||
|
|
||||||
|
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
||||||
|
@ -23,10 +23,10 @@ const test3 = tap.test(
|
|||||||
async () => {
|
async () => {
|
||||||
expect(
|
expect(
|
||||||
(await test1.testPromise).hrtMeasurement.milliSeconds <
|
(await test1.testPromise).hrtMeasurement.milliSeconds <
|
||||||
(await test2).hrtMeasurement.milliSeconds
|
(await test2).hrtMeasurement.milliSeconds,
|
||||||
).toBeTrue();
|
).toBeTrue();
|
||||||
expect((await test2.testPromise).hrtMeasurement.milliSeconds > 10).toBeTrue();
|
expect((await test2.testPromise).hrtMeasurement.milliSeconds > 10).toBeTrue();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const test4 = tap.skip.test('my 4th test -> should fail', async (tools) => {
|
const test4 = tap.skip.test('my 4th test -> should fail', async (tools) => {
|
||||||
@ -45,4 +45,4 @@ const test6 = tap.skip.test('my 6th test -> should fail after 1000ms', async (to
|
|||||||
await tools.delayFor(100);
|
await tools.delayFor(100);
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.start();
|
await tap.start();
|
||||||
|
28
test/test.node.ts
Normal file
28
test/test.node.ts
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import { tap, expect } from '../ts/index.js';
|
||||||
|
|
||||||
|
import { tapNodeTools } from '../ts_node/index.js';
|
||||||
|
|
||||||
|
tap.test('should execure a command', async () => {
|
||||||
|
const result = await tapNodeTools.runCommand('ls -la');
|
||||||
|
expect(result.exitCode).toEqual(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('should create a https cert', async () => {
|
||||||
|
const { key, cert } = await tapNodeTools.createHttpsCert('localhost');
|
||||||
|
console.log(key);
|
||||||
|
console.log(cert);
|
||||||
|
expect(key).toInclude('-----BEGIN RSA PRIVATE KEY-----');
|
||||||
|
expect(cert).toInclude('-----BEGIN CERTIFICATE-----');
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('should create a smartmongo instance', async () => {
|
||||||
|
const smartmongo = await tapNodeTools.createSmartmongo();
|
||||||
|
await smartmongo.stop();
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('should create a smarts3 instance', async () => {
|
||||||
|
const smarts3 = await tapNodeTools.createSmarts3();
|
||||||
|
await smarts3.stop();
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.start();
|
@ -17,10 +17,10 @@ const test3 = tap.test(
|
|||||||
async () => {
|
async () => {
|
||||||
expect(
|
expect(
|
||||||
(await test1.testPromise).hrtMeasurement.milliSeconds <
|
(await test1.testPromise).hrtMeasurement.milliSeconds <
|
||||||
(await test2).hrtMeasurement.milliSeconds
|
(await test2).hrtMeasurement.milliSeconds,
|
||||||
).toBeTrue();
|
).toBeTrue();
|
||||||
expect((await test2.testPromise).hrtMeasurement.milliSeconds > 1000).toBeTrue();
|
expect((await test2.testPromise).hrtMeasurement.milliSeconds > 1000).toBeTrue();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const test4 = tap.test('my 4th test -> should fail', async (tools) => {
|
const test4 = tap.test('my 4th test -> should fail', async (tools) => {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/**
|
/**
|
||||||
* autocreated commitinfo by @pushrocks/commitinfo
|
* autocreated commitinfo by @push.rocks/commitinfo
|
||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/tapbundle',
|
name: '@push.rocks/tapbundle',
|
||||||
version: '5.0.16',
|
version: '5.6.3',
|
||||||
description: 'tap bundled for tapbuffer'
|
description: 'A comprehensive testing automation library that provides a wide range of utilities and tools for TAP (Test Anything Protocol) based testing, especially suitable for projects using tapbuffer.'
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ export class Tap<T> {
|
|||||||
public test(
|
public test(
|
||||||
testDescription: string,
|
testDescription: string,
|
||||||
testFunction: ITestFunction<T>,
|
testFunction: ITestFunction<T>,
|
||||||
modeArg: 'normal' | 'only' | 'skip' = 'normal'
|
modeArg: 'normal' | 'only' | 'skip' = 'normal',
|
||||||
): TapTest<T> {
|
): TapTest<T> {
|
||||||
const localTest = new TapTest<T>({
|
const localTest = new TapTest<T>({
|
||||||
description: testDescription,
|
description: testDescription,
|
||||||
@ -67,7 +67,7 @@ export class Tap<T> {
|
|||||||
description: testDescription,
|
description: testDescription,
|
||||||
testFunction,
|
testFunction,
|
||||||
parallel: true,
|
parallel: true,
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ export class Tap<T> {
|
|||||||
failReasons.push(
|
failReasons.push(
|
||||||
`Test ${tapTest.testKey + 1} failed with status ${tapTest.status}:\n` +
|
`Test ${tapTest.testKey + 1} failed with status ${tapTest.status}:\n` +
|
||||||
`|| ${tapTest.description}\n` +
|
`|| ${tapTest.description}\n` +
|
||||||
`|| for more information please take a look the logs above`
|
`|| for more information please take a look the logs above`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,12 +143,31 @@ export class Tap<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async stopForcefully(codeArg = 0, directArg = false) {
|
||||||
|
console.log(`tap stopping forcefully! Code: ${codeArg} / Direct: ${directArg}`);
|
||||||
|
if (directArg) {
|
||||||
|
process.exit(codeArg);
|
||||||
|
} else {
|
||||||
|
setTimeout(() => {
|
||||||
|
process.exit(codeArg);
|
||||||
|
}, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* handle errors
|
* handle errors
|
||||||
*/
|
*/
|
||||||
public threw(err: Error) {
|
public threw(err: Error) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Explicitly fail the current test with a custom message
|
||||||
|
* @param message - The failure message to display
|
||||||
|
*/
|
||||||
|
public fail(message: string = 'Test failed'): never {
|
||||||
|
throw new Error(message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export let tap = new Tap();
|
export let tap = new Tap();
|
||||||
|
@ -56,7 +56,7 @@ export class TapTest<T = unknown> {
|
|||||||
}
|
}
|
||||||
this.hrtMeasurement.stop();
|
this.hrtMeasurement.stop();
|
||||||
console.log(
|
console.log(
|
||||||
`ok ${testNumber} - ${this.description} # time=${this.hrtMeasurement.milliSeconds}ms`
|
`ok ${testNumber} - ${this.description} # time=${this.hrtMeasurement.milliSeconds}ms`,
|
||||||
);
|
);
|
||||||
this.status = 'success';
|
this.status = 'success';
|
||||||
this.testDeferred.resolve(this);
|
this.testDeferred.resolve(this);
|
||||||
@ -64,7 +64,7 @@ export class TapTest<T = unknown> {
|
|||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
this.hrtMeasurement.stop();
|
this.hrtMeasurement.stop();
|
||||||
console.log(
|
console.log(
|
||||||
`not ok ${testNumber} - ${this.description} # time=${this.hrtMeasurement.milliSeconds}ms`
|
`not ok ${testNumber} - ${this.description} # time=${this.hrtMeasurement.milliSeconds}ms`,
|
||||||
);
|
);
|
||||||
this.testDeferred.resolve(this);
|
this.testDeferred.resolve(this);
|
||||||
this.testResultDeferred.resolve(err);
|
this.testResultDeferred.resolve(err);
|
||||||
|
@ -59,4 +59,10 @@ export class TapTools {
|
|||||||
public defer() {
|
public defer() {
|
||||||
return plugins.smartpromise.defer();
|
return plugins.smartpromise.defer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public cumulativeDefer() {
|
||||||
|
return plugins.smartpromise.cumulativeDefer();
|
||||||
|
}
|
||||||
|
|
||||||
|
public smartjson = plugins.smartjson;
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import * as consolecolor from '@push.rocks/consolecolor';
|
|||||||
import * as smartdelay from '@push.rocks/smartdelay';
|
import * as smartdelay from '@push.rocks/smartdelay';
|
||||||
import * as smartenv from '@push.rocks/smartenv';
|
import * as smartenv from '@push.rocks/smartenv';
|
||||||
import * as smartexpect from '@push.rocks/smartexpect';
|
import * as smartexpect from '@push.rocks/smartexpect';
|
||||||
|
import * as smartjson from '@push.rocks/smartjson';
|
||||||
import * as smartpromise from '@push.rocks/smartpromise';
|
import * as smartpromise from '@push.rocks/smartpromise';
|
||||||
|
|
||||||
export { consolecolor, smartdelay, smartenv, smartexpect, smartpromise };
|
export { consolecolor, smartdelay, smartenv, smartexpect, smartjson, smartpromise };
|
||||||
|
98
ts_node/classes.tapnodetools.ts
Normal file
98
ts_node/classes.tapnodetools.ts
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
import { TestFileProvider } from './classes.testfileprovider.js';
|
||||||
|
import * as plugins from './plugins.js';
|
||||||
|
|
||||||
|
class TapNodeTools {
|
||||||
|
private smartshellInstance: plugins.smartshell.Smartshell;
|
||||||
|
public testFileProvider = new TestFileProvider();
|
||||||
|
|
||||||
|
constructor() {}
|
||||||
|
|
||||||
|
private qenv: plugins.qenv.Qenv;
|
||||||
|
public async getQenv(): Promise<plugins.qenv.Qenv> {
|
||||||
|
this.qenv = this.qenv || new plugins.qenv.Qenv('./', '.nogit/');
|
||||||
|
return this.qenv;
|
||||||
|
}
|
||||||
|
public async getEnvVarOnDemand(envVarNameArg: string): Promise<string> {
|
||||||
|
const qenv = await this.getQenv();
|
||||||
|
return qenv.getEnvVarOnDemand(envVarNameArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async runCommand(commandArg: string): Promise<any> {
|
||||||
|
if (!this.smartshellInstance) {
|
||||||
|
this.smartshellInstance = new plugins.smartshell.Smartshell({
|
||||||
|
executor: 'bash',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const result = await this.smartshellInstance.exec(commandArg);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async createHttpsCert(
|
||||||
|
commonName: string = 'localhost',
|
||||||
|
allowSelfSigned: boolean = true
|
||||||
|
): Promise<{ key: string; cert: string }> {
|
||||||
|
if (allowSelfSigned) {
|
||||||
|
// set node to allow self-signed certificates
|
||||||
|
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate a key pair
|
||||||
|
const keys = plugins.smartcrypto.nodeForge.pki.rsa.generateKeyPair(2048);
|
||||||
|
|
||||||
|
// Create a self-signed certificate
|
||||||
|
const cert = plugins.smartcrypto.nodeForge.pki.createCertificate();
|
||||||
|
cert.publicKey = keys.publicKey;
|
||||||
|
cert.serialNumber = '01';
|
||||||
|
cert.validity.notBefore = new Date();
|
||||||
|
cert.validity.notAfter = new Date();
|
||||||
|
cert.validity.notAfter.setFullYear(cert.validity.notBefore.getFullYear() + 1);
|
||||||
|
|
||||||
|
const attrs = [
|
||||||
|
{ name: 'commonName', value: commonName },
|
||||||
|
{ name: 'countryName', value: 'US' },
|
||||||
|
{ shortName: 'ST', value: 'California' },
|
||||||
|
{ name: 'localityName', value: 'San Francisco' },
|
||||||
|
{ name: 'organizationName', value: 'My Company' },
|
||||||
|
{ shortName: 'OU', value: 'Dev' },
|
||||||
|
];
|
||||||
|
cert.setSubject(attrs);
|
||||||
|
cert.setIssuer(attrs);
|
||||||
|
|
||||||
|
// Sign the certificate with its own private key (self-signed)
|
||||||
|
cert.sign(keys.privateKey, plugins.smartcrypto.nodeForge.md.sha256.create());
|
||||||
|
|
||||||
|
// PEM encode the private key and certificate
|
||||||
|
const pemKey = plugins.smartcrypto.nodeForge.pki.privateKeyToPem(keys.privateKey);
|
||||||
|
const pemCert = plugins.smartcrypto.nodeForge.pki.certificateToPem(cert);
|
||||||
|
|
||||||
|
return {
|
||||||
|
key: pemKey,
|
||||||
|
cert: pemCert,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create and return a smartmongo instance
|
||||||
|
*/
|
||||||
|
public async createSmartmongo() {
|
||||||
|
const smartmongoMod = await import('@push.rocks/smartmongo');
|
||||||
|
const smartmongoInstance = new smartmongoMod.SmartMongo();
|
||||||
|
await smartmongoInstance.start();
|
||||||
|
return smartmongoInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create and return a smarts3 instance
|
||||||
|
*/
|
||||||
|
public async createSmarts3() {
|
||||||
|
const smarts3Mod = await import('@push.rocks/smarts3');
|
||||||
|
const smarts3Instance = new smarts3Mod.Smarts3({
|
||||||
|
port: 3003,
|
||||||
|
cleanSlate: true,
|
||||||
|
});
|
||||||
|
await smarts3Instance.start();
|
||||||
|
return smarts3Instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const tapNodeTools = new TapNodeTools();
|
17
ts_node/classes.testfileprovider.ts
Normal file
17
ts_node/classes.testfileprovider.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import * as plugins from './plugins.js';
|
||||||
|
import * as paths from './paths.js';
|
||||||
|
|
||||||
|
export const fileUrls = {
|
||||||
|
dockerAlpineImage: 'https://code.foss.global/testassets/docker/raw/branch/main/alpine.tar',
|
||||||
|
}
|
||||||
|
|
||||||
|
export class TestFileProvider {
|
||||||
|
public async getDockerAlpineImageAsLocalTarball(): Promise<string> {
|
||||||
|
const filePath = plugins.path.join(paths.testFilesDir, 'alpine.tar')
|
||||||
|
// fetch the docker alpine image
|
||||||
|
const response = await plugins.smartrequest.getBinary(fileUrls.dockerAlpineImage);
|
||||||
|
await plugins.smartfile.fs.ensureDir(paths.testFilesDir);
|
||||||
|
await plugins.smartfile.memory.toFs(response.body, filePath);
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
}
|
4
ts_node/index.ts
Normal file
4
ts_node/index.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export * from './classes.tapnodetools.js';
|
||||||
|
import { expect as jestExpect } from 'expect';
|
||||||
|
|
||||||
|
export { jestExpect };
|
4
ts_node/paths.ts
Normal file
4
ts_node/paths.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import * as plugins from './plugins.js';
|
||||||
|
|
||||||
|
export const cwd = process.cwd();
|
||||||
|
export const testFilesDir = plugins.path.join(cwd, './.nogit/testfiles/');
|
16
ts_node/plugins.ts
Normal file
16
ts_node/plugins.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// node native
|
||||||
|
import * as crypto from 'crypto';
|
||||||
|
import * as fs from 'fs';
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
|
export { crypto,fs, path, };
|
||||||
|
|
||||||
|
// @push.rocks scope
|
||||||
|
import * as qenv from '@push.rocks/qenv';
|
||||||
|
import * as smartcrypto from '@push.rocks/smartcrypto';
|
||||||
|
import * as smartfile from '@push.rocks/smartfile';
|
||||||
|
import * as smartpath from '@push.rocks/smartpath';
|
||||||
|
import * as smartrequest from '@push.rocks/smartrequest';
|
||||||
|
import * as smartshell from '@push.rocks/smartshell';
|
||||||
|
|
||||||
|
export { qenv, smartcrypto, smartfile, smartpath, smartrequest, smartshell, };
|
@ -6,7 +6,9 @@
|
|||||||
"module": "NodeNext",
|
"module": "NodeNext",
|
||||||
"moduleResolution": "NodeNext",
|
"moduleResolution": "NodeNext",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"verbatimModuleSyntax": true
|
"verbatimModuleSyntax": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {}
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"dist_*/**/*.d.ts"
|
"dist_*/**/*.d.ts"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user