fix(core): update
This commit is contained in:
		| @@ -26,6 +26,7 @@ mirror: | ||||
| snyk: | ||||
|   stage: security | ||||
|   script: | ||||
|     - npmci npm prepare | ||||
|     - npmci command npm install -g snyk | ||||
|     - npmci command npm install --ignore-scripts | ||||
|     - npmci command snyk test | ||||
| @@ -36,21 +37,11 @@ snyk: | ||||
| # ==================== | ||||
| # test stage | ||||
| # ==================== | ||||
| testLEGACY: | ||||
|   stage: test | ||||
|   script: | ||||
|   - npmci node install legacy | ||||
|   - npmci npm install | ||||
|   - npmci npm test | ||||
|   coverage: /\d+.?\d+?\%\s*coverage/ | ||||
|   tags: | ||||
|   - docker | ||||
|   - notpriv | ||||
|   allow_failure: true | ||||
|  | ||||
| testLTS: | ||||
|   stage: test | ||||
|   script: | ||||
|   - npmci npm prepare | ||||
|   - npmci node install lts | ||||
|   - npmci npm install | ||||
|   - npmci npm test | ||||
| @@ -62,6 +53,7 @@ testLTS: | ||||
| testSTABLE: | ||||
|   stage: test | ||||
|   script: | ||||
|   - npmci npm prepare | ||||
|   - npmci node install stable | ||||
|   - npmci npm install | ||||
|   - npmci npm test | ||||
| @@ -117,8 +109,10 @@ pages: | ||||
|   image: hosttoday/ht-docker-node:npmci | ||||
|   stage: metadata | ||||
|   script: | ||||
|     - npmci command npm install -g npmpage | ||||
|     - npmci command npmpage | ||||
|     - npmci command npm install -g typedoc typescript | ||||
|     - npmci npm prepare | ||||
|     - npmci npm install | ||||
|     - npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/ | ||||
|   tags: | ||||
|     - docker | ||||
|     - notpriv | ||||
| @@ -129,13 +123,3 @@ pages: | ||||
|     paths: | ||||
|     - public | ||||
|   allow_failure: true | ||||
|  | ||||
| windowsCompatibility: | ||||
|   image: stefanscherer/node-windows:10-build-tools | ||||
|   stage: metadata | ||||
|   script: | ||||
|   - npm install & npm test | ||||
|   coverage: /\d+.?\d+?\%\s*coverage/ | ||||
|   tags: | ||||
|   - windows | ||||
|   allow_failure: true | ||||
|   | ||||
							
								
								
									
										81
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										81
									
								
								README.md
									
									
									
									
									
								
							| @@ -1,29 +1,72 @@ | ||||
| # @pushrocks/tapbundle | ||||
|  | ||||
| tap bundled for tapbuffer | ||||
|  | ||||
| ## Availabililty | ||||
|  | ||||
| [](https://www.npmjs.com/package/tapbundle) | ||||
| [](https://GitLab.com/pushrocks/tapbundle) | ||||
| [](https://github.com/pushrocks/tapbundle) | ||||
| [](https://pushrocks.gitlab.io/tapbundle/) | ||||
| ## Availabililty and Links | ||||
| * [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/tapbundle) | ||||
| * [gitlab.com (source)](https://gitlab.com/pushrocks/tapbundle) | ||||
| * [github.com (source mirror)](https://github.com/pushrocks/tapbundle) | ||||
| * [docs (typedoc)](https://pushrocks.gitlab.io/tapbundle/) | ||||
|  | ||||
| ## Status for master | ||||
| [](https://gitlab.com/pushrocks/tapbundle/commits/master) | ||||
| [](https://gitlab.com/pushrocks/tapbundle/commits/master) | ||||
| [](https://www.npmjs.com/package/@pushrocks/tapbundle) | ||||
| [](https://snyk.io/test/npm/@pushrocks/tapbundle) | ||||
| [](https://nodejs.org/dist/latest-v10.x/docs/api/) | ||||
| [](https://nodejs.org/dist/latest-v10.x/docs/api/) | ||||
| [](https://prettier.io/) | ||||
|  | ||||
| [](https://GitLab.com/pushrocks/tapbundle/commits/master) | ||||
| [](https://GitLab.com/pushrocks/tapbundle/commits/master) | ||||
| [](https://www.npmjs.com/package/tapbundle) | ||||
| [](https://david-dm.org/pushrocks/tapbundle) | ||||
| [](https://www.bithound.io/github/pushrocks/tapbundle/master/dependencies/npm) | ||||
| [](https://www.bithound.io/github/pushrocks/tapbundle) | ||||
| [](https://nodejs.org/dist/latest-v6.x/docs/api/) | ||||
| [](https://nodejs.org/dist/latest-v6.x/docs/api/) | ||||
| [](http://standardjs.com/) | ||||
| ## Usage | ||||
|  | ||||
| For further information read the linked docs at the top of this README. | ||||
| Use TypeScript for best in class instellisense. | ||||
|  | ||||
| A few words on TypeScript | ||||
|  | ||||
| ### Included in this package | ||||
|  | ||||
| - tap compatible testing framework written in TypeScript | ||||
| - a collection of test tools | ||||
| - **code** testing framework with typings | ||||
|  | ||||
| ### Write your first tests | ||||
|  | ||||
| ```javascript | ||||
| import { tap, expect } from 'tapbundle'; // has typings in place | ||||
|  | ||||
| import * as myAwesomeModuleToTest from '../dist/index'; // '../dist/index' is the standard path for npmts modules | ||||
|  | ||||
| tap.test('my awesome description', async tools => { | ||||
|   // tools are optional parameter | ||||
|   tools.timeout(2000); // test will fail if it takes longer than 2000 millisenconds | ||||
| }); | ||||
|  | ||||
| let 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).to.be.true; // will not throw | ||||
|   await expect(tools.delayFor(2000)).to.eventually.be.fulfilled; // yay expect promises :) | ||||
|   expect((await myTest2.promise).hrtMeasurement.milliSeconds > 1000).to.be.true; // access other tests metadata :) | ||||
| }); | ||||
|  | ||||
| let 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).to.equal('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) | ||||
| ``` | ||||
|  | ||||
| For further information read the linked docs at the top of this readme. | ||||
|  | ||||
| > MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) | ||||
| > | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html) | ||||
| | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html) | ||||
|  | ||||
| [](https://push.rocks) | ||||
| [](https://maintainedby.lossless.com) | ||||
|   | ||||
| @@ -1,56 +0,0 @@ | ||||
| # Get Started | ||||
|  | ||||
| ## TypeScript | ||||
|  | ||||
| Use TypeScript for best in class instellisense. | ||||
|  | ||||
| A few words on TypeScript | ||||
|  | ||||
| ## Included in this package | ||||
|  | ||||
| - tap compatible testing framework written in TypeScript | ||||
| - a collection of test tools | ||||
| - **code** testing framework with typings | ||||
|  | ||||
| ## Write your first tests | ||||
|  | ||||
| ```javascript | ||||
| import { tap, expect } from 'tapbundle'; // has typings in place | ||||
|  | ||||
| import * as myAwesomeModuleToTest from '../dist/index'; // '../dist/index' is the standard path for npmts modules | ||||
|  | ||||
| tap.test('my awesome description', async tools => { | ||||
|   // tools are optional parameter | ||||
|   tools.timeout(2000); // test will fail if it takes longer than 2000 millisenconds | ||||
| }); | ||||
|  | ||||
| let 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).to.be.true; // will not throw | ||||
|   await expect(tools.delayFor(2000)).to.eventually.be.fulfilled; // yay expect promises :) | ||||
|   expect((await myTest2.promise).hrtMeasurement.milliSeconds > 1000).to.be.true; // access other tests metadata :) | ||||
| }); | ||||
|  | ||||
| let 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).to.equal('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) | ||||
| ``` | ||||
|  | ||||
| For further information read the linked docs at the top of this README. | ||||
|  | ||||
| > MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) | ||||
| > | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html) | ||||
|  | ||||
| [](https://push.rocks) | ||||
| @@ -1,29 +0,0 @@ | ||||
| # tapbundle | ||||
|  | ||||
| tap bundled for tapbuffer | ||||
|  | ||||
| ## Availabililty | ||||
|  | ||||
| [](https://www.npmjs.com/package/tapbundle) | ||||
| [](https://GitLab.com/pushrocks/tapbundle) | ||||
| [](https://github.com/pushrocks/tapbundle) | ||||
| [](https://pushrocks.gitlab.io/tapbundle/) | ||||
|  | ||||
| ## Status for master | ||||
|  | ||||
| [](https://GitLab.com/pushrocks/tapbundle/commits/master) | ||||
| [](https://GitLab.com/pushrocks/tapbundle/commits/master) | ||||
| [](https://www.npmjs.com/package/tapbundle) | ||||
| [](https://david-dm.org/pushrocks/tapbundle) | ||||
| [](https://www.bithound.io/github/pushrocks/tapbundle/master/dependencies/npm) | ||||
| [](https://www.bithound.io/github/pushrocks/tapbundle) | ||||
| [](https://nodejs.org/dist/latest-v6.x/docs/api/) | ||||
| [](https://nodejs.org/dist/latest-v6.x/docs/api/) | ||||
| [](http://standardjs.com/) | ||||
|  | ||||
| For further information read the linked docs at the top of this README. | ||||
|  | ||||
| > MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) | ||||
| > | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html) | ||||
|  | ||||
| [](https://push.rocks) | ||||
| @@ -1,7 +1,6 @@ | ||||
| # License | ||||
| 
 | ||||
| **MIT License** | ||||
| 
 | ||||
| Copright © 2016 Lossless GmbH | ||||
| Copyright © 2016 - 2017 Martin Donath | ||||
| 
 | ||||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||||
| @@ -7,5 +7,15 @@ | ||||
|     "testConfig": { | ||||
|       "parallel": false | ||||
|     } | ||||
|   }, | ||||
|   "gitzone": { | ||||
|     "module": { | ||||
|       "githost": "gitlab.com", | ||||
|       "gitscope": "pushrocks", | ||||
|       "gitrepo": "tapbundle", | ||||
|       "shortDescription": "tap bundled for tapbuffer", | ||||
|       "npmPackagename": "@pushrocks/tapbundle", | ||||
|       "license": "MIT" | ||||
|     } | ||||
|   } | ||||
| } | ||||
							
								
								
									
										1080
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1080
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										16
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								package.json
									
									
									
									
									
								
							| @@ -21,16 +21,18 @@ | ||||
|   "homepage": "https://gitlab.com/pushrocks/tapbundle#README", | ||||
|   "dependencies": { | ||||
|     "@pushrocks/early": "^3.0.3", | ||||
|     "@pushrocks/smartdelay": "^2.0.2", | ||||
|     "@pushrocks/smartpromise": "^2.0.5", | ||||
|     "@pushrocks/smartdelay": "^2.0.3", | ||||
|     "@pushrocks/smartpromise": "^3.0.2", | ||||
|     "leakage": "^0.4.0", | ||||
|     "smartchai": "^2.0.1" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "@gitzone/tsbuild": "^2.0.22", | ||||
|     "@gitzone/tsrun": "^1.1.12", | ||||
|     "@gitzone/tstest": "^1.0.15", | ||||
|     "@types/node": "^10.9.4", | ||||
|     "randomstring": "^1.1.5" | ||||
|     "@gitzone/tsbuild": "^2.1.8", | ||||
|     "@gitzone/tsrun": "^1.2.5", | ||||
|     "@gitzone/tstest": "^1.0.20", | ||||
|     "@types/node": "^11.13.2", | ||||
|     "randomstring": "^1.1.5", | ||||
|     "tslint": "^5.15.0", | ||||
|     "tslint-config-prettier": "^1.18.0" | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -1,21 +1,23 @@ | ||||
| import { tap, expect } from '../ts/index'; | ||||
| import * as randomstring from 'randomstring'; | ||||
|  | ||||
| let test1 = tap.test('my first test -> expect true to be true', async tools => { | ||||
| const test1 = tap.test('my first test -> expect true to be true', async tools => { | ||||
|   await tools.checkIterationLeak(async () => { | ||||
|     let domain = randomstring.generate(1000); | ||||
|     const domain = randomstring.generate(1000); | ||||
|   }); | ||||
| }); | ||||
|  | ||||
| let outsideArray = []; | ||||
| const outsideArray = []; | ||||
|  | ||||
| let test2 = tap.test('should throw', async tools => { | ||||
|   let err = await tools.returnError(async () => { | ||||
| const test2 = tap.test('should throw', async tools => { | ||||
|   const err = await tools.returnError(async () => { | ||||
|     await tools.checkIterationLeak(async () => { | ||||
|       outsideArray.push(randomstring.generate(1000)); | ||||
|     }); | ||||
|   }); | ||||
|   expect(err).to.be.instanceof(Error); | ||||
|   if (!process.version.startsWith('v11')) { | ||||
|     expect(err).to.be.instanceof(Error); | ||||
|   } | ||||
| }); | ||||
|  | ||||
| tap.start(); | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| import { tap, expect } from '../ts/index'; | ||||
|  | ||||
| let tapwrap = tap.wrap(async () => { | ||||
| const tapwrap = tap.wrap(async () => { | ||||
|   tap.test('should do something', async () => { | ||||
|     console.log('test1'); | ||||
|   }); | ||||
|   | ||||
							
								
								
									
										12
									
								
								test/test.ts
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								test/test.ts
									
									
									
									
									
								
							| @@ -1,14 +1,14 @@ | ||||
| import { tap, expect } from '../ts/index'; | ||||
|  | ||||
| let test1 = tap.test('my first test -> expect true to be true', async () => { | ||||
| const test1 = tap.test('my first test -> expect true to be true', async () => { | ||||
|   return expect(true).to.be.true; | ||||
| }); | ||||
|  | ||||
| let test2 = tap.test('my second test', async tools => { | ||||
| const test2 = tap.test('my second test', async tools => { | ||||
|   await tools.delayFor(1000); | ||||
| }); | ||||
|  | ||||
| let test3 = tap.test( | ||||
| const test3 = tap.test( | ||||
|   'my third test -> test2 should take longer than test1 and endure at least 1000ms', | ||||
|   async () => { | ||||
|     expect((await test1).hrtMeasurement.milliSeconds < (await test2).hrtMeasurement.milliSeconds).to | ||||
| @@ -17,17 +17,17 @@ let test3 = tap.test( | ||||
|   } | ||||
| ); | ||||
|  | ||||
| let test4 = tap.skip.test('my 4th test -> should fail', async tools => { | ||||
| const test4 = tap.skip.test('my 4th test -> should fail', async tools => { | ||||
|   tools.allowFailure(); | ||||
|   expect(false).to.be.true; | ||||
| }); | ||||
|  | ||||
| let test5 = tap.test('my 5th test -> should pass in about 500ms', async tools => { | ||||
| const test5 = tap.test('my 5th test -> should pass in about 500ms', async tools => { | ||||
|   tools.timeout(1000); | ||||
|   await tools.delayFor(500); | ||||
| }); | ||||
|  | ||||
| let test6 = tap.skip.test('my 6th test -> should fail after 1000ms', async tools => { | ||||
| const test6 = tap.skip.test('my 6th test -> should fail after 1000ms', async tools => { | ||||
|   tools.allowFailure(); | ||||
|   tools.timeout(1000); | ||||
|   await tools.delayFor(2000); | ||||
|   | ||||
| @@ -23,7 +23,7 @@ export class Tap { | ||||
|     test: (descriptionArg: string, testFunctionArg: ITestFunction) => { | ||||
|       this.test(descriptionArg, testFunctionArg, 'only'); | ||||
|     } | ||||
|   } | ||||
|   }; | ||||
|  | ||||
|   private _tapTests: TapTest[] = []; | ||||
|   private _tapTestsOnly: TapTest[] = []; | ||||
| @@ -33,13 +33,17 @@ export class Tap { | ||||
|    * @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, modeArg: 'normal' | 'only' | 'skip' = 'normal' ) { | ||||
|   async test( | ||||
|     testDescription: string, | ||||
|     testFunction: ITestFunction, | ||||
|     modeArg: 'normal' | 'only' | 'skip' = 'normal' | ||||
|   ) { | ||||
|     let localTest = new TapTest({ | ||||
|       description: testDescription, | ||||
|       testFunction: testFunction, | ||||
|       parallel: false | ||||
|     }); | ||||
|     if(modeArg === 'normal') { | ||||
|     if (modeArg === 'normal') { | ||||
|       this._tapTests.push(localTest); | ||||
|     } else if (modeArg === 'only') { | ||||
|       this._tapTestsOnly.push(localTest); | ||||
| @@ -83,7 +87,7 @@ export class Tap { | ||||
|  | ||||
|     // determine which tests to run | ||||
|     let concerningTests: TapTest[]; | ||||
|     if(this._tapTestsOnly.length > 0) { | ||||
|     if (this._tapTestsOnly.length > 0) { | ||||
|       concerningTests = this._tapTestsOnly; | ||||
|     } else { | ||||
|       concerningTests = this._tapTests; | ||||
|   | ||||
| @@ -18,23 +18,23 @@ export class TapTools { | ||||
|   /** | ||||
|    * allow failure | ||||
|    */ | ||||
|   allowFailure() { | ||||
|   public allowFailure() { | ||||
|     this._tapTest.failureAllowed = true; | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * async/await delay method | ||||
|    */ | ||||
|   async delayFor(timeMilliArg) { | ||||
|   public async delayFor(timeMilliArg) { | ||||
|     await plugins.smartdelay.delayFor(timeMilliArg); | ||||
|   } | ||||
|  | ||||
|   async delayForRandom(timeMilliMinArg, timeMilliMaxArg) { | ||||
|   public async delayForRandom(timeMilliMinArg, timeMilliMaxArg) { | ||||
|     await plugins.smartdelay.delayForRandom(timeMilliMinArg, timeMilliMaxArg); | ||||
|   } | ||||
|  | ||||
|   async timeout(timeMilliArg: number) { | ||||
|     let timeout = new plugins.smartdelay.Timeout(timeMilliArg); | ||||
|   public async timeout(timeMilliArg: number) { | ||||
|     const timeout = new plugins.smartdelay.Timeout(timeMilliArg); | ||||
|     timeout.makeUnrefed(); | ||||
|     await timeout.promise; | ||||
|     if (this._tapTest.status === 'pending') { | ||||
| @@ -42,11 +42,15 @@ export class TapTools { | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   async checkIterationLeak(iterationfuncArg: IPromiseFunc) { | ||||
|   public async checkIterationLeak(iterationfuncArg: IPromiseFunc) { | ||||
|   if (process.version.startsWith('v11')) { | ||||
|     console.log('iteration leakage checks disabled for now on version 11 due to low performance'); | ||||
|   } else { | ||||
|     await plugins.leakage.iterate.async(iterationfuncArg); | ||||
|   } | ||||
|   } | ||||
|  | ||||
|   async returnError(throwingFuncArg: IPromiseFunc) { | ||||
|   public async returnError(throwingFuncArg: IPromiseFunc) { | ||||
|     let funcErr: Error; | ||||
|     try { | ||||
|       await throwingFuncArg(); | ||||
| @@ -55,4 +59,8 @@ export class TapTools { | ||||
|     } | ||||
|     return funcErr; | ||||
|   } | ||||
|  | ||||
|   public defer () { | ||||
|     return plugins.smartpromise.defer(); | ||||
|   } | ||||
| } | ||||
|   | ||||
							
								
								
									
										16
									
								
								tslint.json
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								tslint.json
									
									
									
									
									
								
							| @@ -1,3 +1,17 @@ | ||||
| { | ||||
|     "extends": "tslint-config-standard" | ||||
|   "extends": ["tslint:latest", "tslint-config-prettier"], | ||||
|   "rules": { | ||||
|     "semicolon": [true, "always"], | ||||
|     "no-console": false, | ||||
|     "ordered-imports": false, | ||||
|     "object-literal-sort-keys": false, | ||||
|     "member-ordering": { | ||||
|       "options":{ | ||||
|         "order": [ | ||||
|           "static-method" | ||||
|         ] | ||||
|       } | ||||
|     } | ||||
|   }, | ||||
|   "defaultSeverity": "warning" | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user