Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
7f765c08e4 | |||
4e7b5a693d | |||
20e36fbdf2 | |||
a61d87a9a0 | |||
953957cae3 | |||
c712a9a09c | |||
5a94f116e1 | |||
0e80700481 | |||
22ec504b0f | |||
3d39f65ed0 | |||
7c450876f2 | |||
d7c3752dfa | |||
f53e5bcc83 | |||
d8301314a7 | |||
155b0b9f91 | |||
61c493ce72 | |||
4358e1d64d | |||
1e6296f980 | |||
0be2243ced | |||
b6c0d8013b | |||
54815c49d6 |
@ -119,6 +119,6 @@ jobs:
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
pnpm install -g @gitzone/tsdoc
|
||||
pnpm install -g @git.zone/tsdoc
|
||||
npmci command tsdoc
|
||||
continue-on-error: true
|
||||
|
212
changelog.md
Normal file
212
changelog.md
Normal file
@ -0,0 +1,212 @@
|
||||
# Changelog
|
||||
|
||||
## 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
|
33
package.json
33
package.json
@ -1,41 +1,46 @@
|
||||
{
|
||||
"name": "@push.rocks/tapbundle",
|
||||
"private": false,
|
||||
"version": "5.0.23",
|
||||
"version": "5.2.2",
|
||||
"description": "A test automation library bundling utilities and tools for TAP (Test Anything Protocol) based testing, specifically tailored for tapbuffer.",
|
||||
"main": "dist_ts/index.js",
|
||||
"typings": "dist_ts/index.d.ts",
|
||||
"exports": {
|
||||
".": "./dist_ts/index.js",
|
||||
"./node": "./dist_ts_node/index.js"
|
||||
},
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "(tstest test/)",
|
||||
"build": "(tsbuild --web --allowimplicitany --skiplibcheck)",
|
||||
"build": "(tsbuild tsfolders --web --allowimplicitany --skiplibcheck)",
|
||||
"buildDocs": "tsdoc"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@gitlab.com/pushrocks/tapbundle.git"
|
||||
"url": "https://code.foss.global/push.rocks/tapbundle.git"
|
||||
},
|
||||
"author": "Lossless GmbH",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://gitlab.com/pushrocks/tapbundle/issues"
|
||||
},
|
||||
"homepage": "https://gitlab.com/pushrocks/tapbundle#README",
|
||||
"homepage": "https://code.foss.global/push.rocks/tapbundle",
|
||||
"dependencies": {
|
||||
"@open-wc/testing": "^4.0.0",
|
||||
"@push.rocks/consolecolor": "^2.0.2",
|
||||
"@push.rocks/qenv": "^6.0.5",
|
||||
"@push.rocks/smartcrypto": "^2.0.4",
|
||||
"@push.rocks/smartdelay": "^3.0.5",
|
||||
"@push.rocks/smartenv": "^5.0.12",
|
||||
"@push.rocks/smartexpect": "^1.0.21",
|
||||
"@push.rocks/smartjson": "^5.0.16",
|
||||
"@push.rocks/smartpromise": "^4.0.2",
|
||||
"@push.rocks/smarttime": "^4.0.6"
|
||||
"@push.rocks/smartexpect": "^1.2.1",
|
||||
"@push.rocks/smartjson": "^5.0.20",
|
||||
"@push.rocks/smartpromise": "^4.0.4",
|
||||
"@push.rocks/smartshell": "^3.0.6",
|
||||
"@push.rocks/smarttime": "^4.0.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.66",
|
||||
"@gitzone/tsrun": "^1.2.43",
|
||||
"@gitzone/tstest": "^1.0.77",
|
||||
"@types/node": "^20.11.30",
|
||||
"@git.zone/tsbuild": "^2.1.66",
|
||||
"@git.zone/tsrun": "^1.2.43",
|
||||
"@git.zone/tstest": "^1.0.77",
|
||||
"@types/node": "^22.5.5",
|
||||
"randomstring": "^1.3.0"
|
||||
},
|
||||
"files": [
|
||||
|
8893
pnpm-lock.yaml
generated
8893
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -45,4 +45,4 @@ const test6 = tap.skip.test('my 6th test -> should fail after 1000ms', async (to
|
||||
await tools.delayFor(100);
|
||||
});
|
||||
|
||||
tap.start();
|
||||
await tap.start();
|
||||
|
18
test/test.node.ts
Normal file
18
test/test.node.ts
Normal file
@ -0,0 +1,18 @@
|
||||
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.start();
|
@ -1,8 +1,8 @@
|
||||
/**
|
||||
* autocreated commitinfo by @pushrocks/commitinfo
|
||||
* autocreated commitinfo by @push.rocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/tapbundle',
|
||||
version: '5.0.23',
|
||||
version: '5.2.2',
|
||||
description: 'A test automation library bundling utilities and tools for TAP (Test Anything Protocol) based testing, specifically tailored for tapbuffer.'
|
||||
}
|
||||
|
67
ts_node/classes.tapnodetools.ts
Normal file
67
ts_node/classes.tapnodetools.ts
Normal file
@ -0,0 +1,67 @@
|
||||
import * as plugins from './plugins.js';
|
||||
|
||||
class TapNodeTools {
|
||||
private smartshellInstance: plugins.smartshell.Smartshell;
|
||||
|
||||
constructor() {}
|
||||
|
||||
public async getQenv(): Promise<plugins.qenv.Qenv> {
|
||||
return new plugins.qenv.Qenv('./', '.nogit/');
|
||||
}
|
||||
|
||||
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,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export const tapNodeTools = new TapNodeTools();
|
1
ts_node/index.ts
Normal file
1
ts_node/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './classes.tapnodetools.js';
|
12
ts_node/plugins.ts
Normal file
12
ts_node/plugins.ts
Normal file
@ -0,0 +1,12 @@
|
||||
// node native
|
||||
import * as crypto from 'crypto';
|
||||
import * as fs from 'fs';
|
||||
|
||||
export { crypto,fs };
|
||||
|
||||
// @push.rocks scope
|
||||
import * as qenv from '@push.rocks/qenv';
|
||||
import * as smartcrypto from '@push.rocks/smartcrypto';
|
||||
import * as smartshell from '@push.rocks/smartshell';
|
||||
|
||||
export { qenv, smartcrypto, smartshell };
|
Reference in New Issue
Block a user