Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
f53e5bcc83 | |||
d8301314a7 | |||
155b0b9f91 | |||
61c493ce72 | |||
4358e1d64d | |||
1e6296f980 |
@ -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
|
||||
|
22
changelog.md
22
changelog.md
@ -1,5 +1,25 @@
|
||||
# Changelog
|
||||
|
||||
## 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
|
||||
|
||||
@ -119,7 +139,7 @@ Multiple core fixes and updates without specific feature changes
|
||||
- fix(dependencies): update
|
||||
|
||||
## 2018-08-08 - 3.0.3 - Dependency Update
|
||||
- fix(dependencies): use @gitzone/tsbuild instead of npmts
|
||||
- fix(dependencies): use @git.zone/tsbuild instead of npmts
|
||||
|
||||
## 2018-07-18 - 3.0.2 - Dependency Update
|
||||
- fix(dependencies): now typings-global free
|
||||
|
21
package.json
21
package.json
@ -1,14 +1,16 @@
|
||||
{
|
||||
"name": "@push.rocks/tapbundle",
|
||||
"private": false,
|
||||
"version": "5.0.24",
|
||||
"version": "5.1.1",
|
||||
"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": {
|
||||
@ -26,16 +28,17 @@
|
||||
"@push.rocks/consolecolor": "^2.0.2",
|
||||
"@push.rocks/smartdelay": "^3.0.5",
|
||||
"@push.rocks/smartenv": "^5.0.12",
|
||||
"@push.rocks/smartexpect": "^1.1.0",
|
||||
"@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": "^22.4.0",
|
||||
"@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": [
|
||||
|
4679
pnpm-lock.yaml
generated
4679
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 PRIVATE KEY-----');
|
||||
expect(cert).toInclude('-----BEGIN CERTIFICATE-----');
|
||||
});
|
||||
|
||||
tap.start();
|
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/tapbundle',
|
||||
version: '5.0.24',
|
||||
version: '5.1.1',
|
||||
description: 'A test automation library bundling utilities and tools for TAP (Test Anything Protocol) based testing, specifically tailored for tapbuffer.'
|
||||
}
|
||||
|
45
ts_node/classes.tapnodetools.ts
Normal file
45
ts_node/classes.tapnodetools.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import * as plugins from './plugins.js';
|
||||
|
||||
class TapNodeTools {
|
||||
|
||||
private smartshellInstance: plugins.smartshell.Smartshell;
|
||||
constructor() {
|
||||
|
||||
}
|
||||
|
||||
public async runCommand(commandArg) {
|
||||
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): Promise<{ key: string, cert: string }> {
|
||||
const key = plugins.crypto.generateKeyPairSync('rsa', {
|
||||
modulusLength: 2048,
|
||||
publicExponent: 65537,
|
||||
});
|
||||
|
||||
const cert = '-----BEGIN CERTIFICATE-----\n' +
|
||||
key.publicKey.export({
|
||||
type: 'spki',
|
||||
format: 'pem'
|
||||
}) +
|
||||
'\n-----END CERTIFICATE-----\n';
|
||||
|
||||
const keyContent = key.privateKey.export({
|
||||
type: 'pkcs8',
|
||||
format: 'pem',
|
||||
});
|
||||
|
||||
return {
|
||||
key: keyContent as string,
|
||||
cert: cert,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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';
|
10
ts_node/plugins.ts
Normal file
10
ts_node/plugins.ts
Normal file
@ -0,0 +1,10 @@
|
||||
// node native
|
||||
import * as crypto from 'crypto';
|
||||
import * as fs from 'fs';
|
||||
|
||||
export { crypto,fs };
|
||||
|
||||
// @push.rocks scope
|
||||
import * as smartshell from '@push.rocks/smartshell';
|
||||
|
||||
export { smartshell };
|
Reference in New Issue
Block a user