Compare commits

...

11 Commits

Author SHA1 Message Date
c8f2a76422 1.0.7 2017-04-23 14:35:20 +02:00
e640059715 implemet errorAfterSuccess 2017-04-23 14:35:16 +02:00
64fc6e636a 1.0.6 2017-04-23 11:10:16 +02:00
753c387325 implement tap myself 2017-04-23 11:10:13 +02:00
4e541b7986 1.0.5 2017-03-26 12:54:21 +02:00
b6cfc24613 remove typings for tap 2017-03-26 12:54:16 +02:00
61fb4ef7bb 1.0.4 2017-03-26 11:56:52 +02:00
9afc1b80b5 add latest gzone standard 2017-03-26 11:56:46 +02:00
1bb67e331b update README 2017-03-26 11:40:00 +02:00
6e5a7529b0 1.0.3 2017-03-04 10:06:46 +01:00
bf2e8fd5c6 fix 2017-03-04 10:06:43 +01:00
17 changed files with 415 additions and 1540 deletions

View File

@ -1,5 +1,10 @@
# gitzone standard
image: hosttoday/ht-docker-node:npmts
image: hosttoday/ht-docker-node:npmci
cache:
paths:
- .yarn/
key: "$CI_BUILD_STAGE"
stages:
- test
@ -51,10 +56,13 @@ trigger:
- docker
pages:
image: hosttoday/ht-docker-node:npmpage
image: hosttoday/ht-docker-node:npmci
stage: pages
script:
- npmci command yarn global add npmpage
- npmci command npmpage --publish gitlab
tags:
- docker
only:
- tags
artifacts:

View File

@ -21,6 +21,19 @@ tap bundled for tapbuffer
## Usage
Use TypeScript for best in class instellisense.
note this package includes
* tap
* chai
* chai-as-promised
* @types/tap
* @types/chai
* @types/chai-as-promised
```javascript
import {tap, expect} from 'tapbundle' // has typings in place
```
For further information read the linked docs at the top of this README.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)

2
dist/index.d.ts vendored
View File

@ -1,4 +1,4 @@
import 'typings-global';
import * as tap from 'tap';
import { expect } from 'smartchai';
import { tap } from './tapbundle.tap';
export { tap, expect };

6
dist/index.js vendored
View File

@ -1,8 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("typings-global");
const tap = require("tap");
exports.tap = tap;
const smartchai_1 = require("smartchai");
exports.expect = smartchai_1.expect;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUN2QiwyQkFBMEI7QUFJeEIsa0JBQUc7QUFITCx5Q0FBa0M7QUFJaEMsb0NBQU0ifQ==
const tapbundle_tap_1 = require("./tapbundle.tap");
exports.tap = tapbundle_tap_1.tap;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUN2Qix5Q0FBa0M7QUFNaEMsaUJBTk8sa0JBQU0sQ0FNUDtBQUxSLG1EQUFxQztBQUluQyxjQUpPLG1CQUFHLENBSVAifQ==

4
dist/tapbundle.plugins.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
import 'typings-global';
import * as smartq from 'smartq';
import * as leakage from 'leakage';
export { smartq, leakage };

8
dist/tapbundle.plugins.js vendored Normal file
View File

@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("typings-global");
const smartq = require("smartq");
exports.smartq = smartq;
const leakage = require("leakage");
exports.leakage = leakage;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwYnVuZGxlLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy90YXBidW5kbGUucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUN2QixpQ0FBZ0M7QUFJOUIsd0JBQU07QUFIUixtQ0FBa0M7QUFJaEMsMEJBQU8ifQ==

53
dist/tapbundle.tap.d.ts vendored Normal file
View File

@ -0,0 +1,53 @@
export declare type TTestStatus = 'success' | 'error' | 'pending' | 'errorAfterSuccess';
export interface ITestFunction {
(): Promise<any>;
}
export declare class TapTest {
description: string;
testFunction: ITestFunction;
status: TTestStatus;
parallel: boolean;
returnValue: any;
/**
* constructor
*/
constructor(optionsArg: {
description: string;
testFunction: ITestFunction;
parallel: boolean;
});
/**
* run the test
*/
run(testKeyArg: number): Promise<void>;
}
export declare class Tap {
private _tests;
/**
* Normal test function, will run one by one
* @param testDescription - A description of what the test does
* @param testFunction - A Function that returns a Promise and resolves or rejects
*/
test(testDescription: string, testFunction: ITestFunction): Promise<void>;
/**
* A parallel test that will not be waited for before the next starts.
* @param testDescription - A description of what the test does
* @param testFunction - A Function that returns a Promise and resolves or rejects
*/
testParallel(testDescription: string, testFunction: ITestFunction): void;
/**
* tests leakage
* @param testDescription - A description of what the test does
* @param testFunction - A Function that returns a Promise and resolves or rejects
*/
testLeakage(testDescription: string, testFunction: ITestFunction): void;
/**
* starts the test evaluation
*/
start(): Promise<void>;
/**
* handle errors
*/
threw(err: any): void;
}
export declare let tap: Tap;

114
dist/tapbundle.tap.js vendored Normal file
View File

@ -0,0 +1,114 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
class TapTest {
/**
* constructor
*/
constructor(optionsArg) {
this.description = optionsArg.description;
this.testFunction = optionsArg.testFunction;
this.parallel = optionsArg.parallel;
this.status = 'pending';
}
/**
* run the test
*/
run(testKeyArg) {
return __awaiter(this, void 0, void 0, function* () {
try {
yield this.testFunction();
console.log(`ok ${testKeyArg + 1} - ${this.description} # time=20.040ms`);
this.status = 'success';
}
catch (err) {
console.log(`not ok ${testKeyArg + 1} - ${this.description} # time=20.040ms`);
if (this.status === 'success') {
this.status = 'errorAfterSuccess';
console.log('!!! ALERT !!!: weird behaviour, since test has been already successfull');
}
console.log(err);
}
});
}
}
exports.TapTest = TapTest;
class Tap {
constructor() {
this._tests = [];
}
/**
* Normal test function, will run one by one
* @param testDescription - A description of what the test does
* @param testFunction - A Function that returns a Promise and resolves or rejects
*/
test(testDescription, testFunction) {
return __awaiter(this, void 0, void 0, function* () {
this._tests.push(new TapTest({
description: testDescription,
testFunction: testFunction,
parallel: false
}));
});
}
/**
* A parallel test that will not be waited for before the next starts.
* @param testDescription - A description of what the test does
* @param testFunction - A Function that returns a Promise and resolves or rejects
*/
testParallel(testDescription, testFunction) {
this._tests.push(new TapTest({
description: testDescription,
testFunction: testFunction,
parallel: true
}));
}
/**
* tests leakage
* @param testDescription - A description of what the test does
* @param testFunction - A Function that returns a Promise and resolves or rejects
*/
testLeakage(testDescription, testFunction) {
}
/**
* starts the test evaluation
*/
start() {
return __awaiter(this, void 0, void 0, function* () {
let promiseArray = [];
// safeguard against empty test array
if (this._tests.length === 0) {
console.log('no tests specified. Ending here!');
return;
}
console.log(`1..${this._tests.length}`);
for (let testKey = 0; testKey < this._tests.length; testKey++) {
let currentTest = this._tests[testKey];
let testPromise = currentTest.run(testKey);
if (currentTest.parallel) {
promiseArray.push(testPromise);
}
else {
yield testPromise;
}
}
yield Promise.all(promiseArray);
});
}
/**
* handle errors
*/
threw(err) {
console.log(err);
}
}
exports.Tap = Tap;
exports.tap = new Tap();
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwYnVuZGxlLnRhcC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3RhcGJ1bmRsZS50YXAudHMiXSwibmFtZXMiOltdLC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SxDQUFDLE1BQU0sRUFBRSxDQUFDLENBQUE7WUFDdkMsR0FBRyxDQUFDLENBQUMsSUFBSSxPQUFPLEdBQUcsQ0FBQyxFQUFFLE9BQU8sR0FBRyxJQUFJLENBQUMsTUFBTSxDQUFDLE1BQU0sRUFBRSxPQUFPLEVBQUUsRUFBRSxDQUFDO2dCQUM5RCxJQUFJLFdBQVcsR0FBRyxJQUFJLENBQUMsTUFBTSxDQUFDLE9BQU8sQ0FBQyxDQUFBO2dCQUN0QyxJQUFJLFdBQVcsR0FBRyxXQUFXLENBQUMsR0FBRyxDQUFDLE9BQU8sQ0FBQyxDQUFBO2dCQUMxQyxFQUFFLENBQUMsQ0FBQyxXQUFXLENBQUMsUUFBUSxDQUFDLENBQUMsQ0FBQztvQkFDekIsWUFBWSxDQUFDLElBQUksQ0FBQyxXQUFXLENBQUMsQ0FBQTtnQkFDaEMsQ0FBQztnQkFBQyxJQUFJLENBQUMsQ0FBQztvQkFDTixNQUFNLFdBQVcsQ0FBQTtnQkFDbkIsQ0FBQztZQUNILENBQUM7WUFDRCxNQUFNLE9BQU8sQ0FBQyxHQUFHLENBQUMsWUFBWSxDQUFDLENBQUE7UUFDakMsQ0FBQztLQUFBO0lBRUQ7O09BRUc7SUFDSCxLQUFLLENBQUUsR0FBRztRQUNSLE9BQU8sQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLENBQUE7SUFDbEIsQ0FBQztDQUNGO0FBckVELGtCQXFFQztBQUVVLFFBQUEsR0FBRyxHQUFHLElBQUksR0FBRyxFQUFFLENBQUEifQ==

3
dist/tapbundle.tapcreator.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
export declare class TapCreator {
}
export declare let tapCreator: TapCreator;

7
dist/tapbundle.tapcreator.js vendored Normal file
View File

@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class TapCreator {
}
exports.TapCreator = TapCreator;
exports.tapCreator = new TapCreator();
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwYnVuZGxlLnRhcGNyZWF0b3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy90YXBidW5kbGUudGFwY3JlYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUVBO0NBRUM7QUFGRCxnQ0FFQztBQUVVLFFBQUEsVUFBVSxHQUFHLElBQUksVUFBVSxFQUFFLENBQUEifQ==

View File

@ -1,9 +1,9 @@
{
"name": "tapbundle",
"version": "1.0.2",
"version": "1.0.7",
"description": "tap bundled for tapbuffer",
"main": "dist/index.js",
"typings": "dsit/index.d.ts",
"typings": "dist/index.d.ts",
"scripts": {
"test": "(npmts)"
},
@ -18,8 +18,9 @@
},
"homepage": "https://gitlab.com/pushrocks/tapbundle#README",
"dependencies": {
"leakage": "^0.2.0",
"smartchai": "^1.0.3",
"tap": "^10.3.0",
"typings-global": "^1.0.14"
"smartq": "^1.1.1",
"typings-global": "^1.0.16"
}
}

7
test/test.ts Normal file
View File

@ -0,0 +1,7 @@
import { tap, expect } from '../dist/index'
tap.test('my first test', async () => {
return expect(true).to.be.true
})
tap.start()

View File

@ -1,8 +1,9 @@
import 'typings-global'
import * as tap from 'tap'
import { expect } from 'smartchai'
import { tap } from './tapbundle.tap'
export {
tap,
expect
}
}

8
ts/tapbundle.plugins.ts Normal file
View File

@ -0,0 +1,8 @@
import 'typings-global'
import * as smartq from 'smartq'
import * as leakage from 'leakage'
export {
smartq,
leakage
}

125
ts/tapbundle.tap.ts Normal file
View File

@ -0,0 +1,125 @@
import * as plugins from './tapbundle.plugins'
import { tapCreator } from './tapbundle.tapcreator'
// interfaces
export type TTestStatus = 'success' | 'error' | 'pending' | 'errorAfterSuccess'
export interface ITestFunction {
(): Promise<any>
}
export class TapTest {
description: string
testFunction: ITestFunction
status: TTestStatus
parallel: boolean
returnValue
/**
* constructor
*/
constructor (optionsArg: {
description: string,
testFunction: ITestFunction,
parallel: boolean
}) {
this.description = optionsArg.description
this.testFunction = optionsArg.testFunction
this.parallel = optionsArg.parallel
this.status = 'pending'
}
/**
* run the test
*/
async run (testKeyArg: number) {
try {
await this.testFunction()
console.log(`ok ${testKeyArg + 1} - ${this.description} # time=20.040ms`)
this.status = 'success'
} catch (err) {
console.log(`not ok ${testKeyArg + 1} - ${this.description} # time=20.040ms`)
if (this.status === 'success') {
this.status = 'errorAfterSuccess'
console.log('!!! ALERT !!!: weird behaviour, since test has been already successfull')
}
console.log(err)
}
}
}
export class Tap {
private _tests: TapTest[] = []
/**
* Normal test function, will run one by one
* @param testDescription - A description of what the test does
* @param testFunction - A Function that returns a Promise and resolves or rejects
*/
async test (testDescription: string, testFunction: ITestFunction) {
this._tests.push(new TapTest({
description: testDescription,
testFunction: testFunction,
parallel: false
}))
}
/**
* A parallel test that will not be waited for before the next starts.
* @param testDescription - A description of what the test does
* @param testFunction - A Function that returns a Promise and resolves or rejects
*/
testParallel (testDescription: string, testFunction: ITestFunction) {
this._tests.push(new TapTest({
description: testDescription,
testFunction: testFunction,
parallel: true
}))
}
/**
* tests leakage
* @param testDescription - A description of what the test does
* @param testFunction - A Function that returns a Promise and resolves or rejects
*/
testLeakage (testDescription: string, testFunction: ITestFunction) {
}
/**
* starts the test evaluation
*/
async start () {
let promiseArray: Promise<any>[] = []
// safeguard against empty test array
if (this._tests.length === 0) {
console.log('no tests specified. Ending here!')
return
}
console.log(`1..${this._tests.length}`)
for (let testKey = 0; testKey < this._tests.length; testKey++) {
let currentTest = this._tests[testKey]
let testPromise = currentTest.run(testKey)
if (currentTest.parallel) {
promiseArray.push(testPromise)
} else {
await testPromise
}
}
await Promise.all(promiseArray)
}
/**
* handle errors
*/
threw (err) {
console.log(err)
}
}
export let tap = new Tap()

View File

@ -0,0 +1,7 @@
import * as plugins from './tapbundle.plugins'
export class TapCreator {
}
export let tapCreator = new TapCreator()

1572
yarn.lock

File diff suppressed because it is too large Load Diff