Compare commits
48 Commits
Author | SHA1 | Date | |
---|---|---|---|
6b6a92b709 | |||
c1589c2309 | |||
271d657f2c | |||
63669ea6ff | |||
4306272f45 | |||
4378b36069 | |||
e8f7013435 | |||
3199943b59 | |||
0028c5492b | |||
e3b05cc43c | |||
f68da622d7 | |||
b7e57e8cdc | |||
93b46a1446 | |||
ca3ea788fd | |||
94a1bd4839 | |||
6c960f9fbd | |||
f2eddb169f | |||
ad2da38289 | |||
301b82a0fb | |||
d28609b513 | |||
d82d4e2eae | |||
d105bab740 | |||
a03bcf4583 | |||
2b21566fe1 | |||
d22fc1b688 | |||
15bbf7f10c | |||
c5e068d5cd | |||
95fa33df58 | |||
42933e6bb0 | |||
5010e882f6 | |||
055d36c74e | |||
e2ac035997 | |||
ec0d6004d5 | |||
3bbca9b0b4 | |||
f16e25b413 | |||
36574d0f34 | |||
12ac28ba44 | |||
1c80c25b14 | |||
03614fe2ef | |||
8be85e1b35 | |||
baf56089d7 | |||
42cd52a2f3 | |||
140f8a2499 | |||
952b6ec2a4 | |||
c8f2a76422 | |||
e640059715 | |||
64fc6e636a | |||
753c387325 |
108
.gitlab-ci.yml
108
.gitlab-ci.yml
@ -3,69 +3,139 @@ image: hosttoday/ht-docker-node:npmci
|
|||||||
|
|
||||||
cache:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
- .yarn/
|
- .npmci_cache/
|
||||||
key: "$CI_BUILD_STAGE"
|
key: "$CI_BUILD_STAGE"
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
|
- security
|
||||||
- test
|
- test
|
||||||
- release
|
- release
|
||||||
- trigger
|
- metadata
|
||||||
- pages
|
|
||||||
|
|
||||||
|
# ====================
|
||||||
|
# security stage
|
||||||
|
# ====================
|
||||||
|
mirror:
|
||||||
|
stage: security
|
||||||
|
script:
|
||||||
|
- npmci git mirror
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
|
snyk:
|
||||||
|
stage: security
|
||||||
|
script:
|
||||||
|
- npmci command npm install -g snyk
|
||||||
|
- npmci command npm install --ignore-scripts
|
||||||
|
- npmci command snyk test
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
|
# ====================
|
||||||
|
# test stage
|
||||||
|
# ====================
|
||||||
testLEGACY:
|
testLEGACY:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci test legacy
|
- npmci node install legacy
|
||||||
|
- npmci npm install
|
||||||
|
- npmci npm test
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
|
||||||
testLTS:
|
testLTS:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci test lts
|
- npmci node install lts
|
||||||
|
- npmci npm install
|
||||||
|
- npmci npm test
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
testSTABLE:
|
testSTABLE:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci test stable
|
- npmci node install stable
|
||||||
|
- npmci npm install
|
||||||
|
- npmci npm test
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
release:
|
release:
|
||||||
stage: release
|
stage: release
|
||||||
script:
|
script:
|
||||||
- npmci publish
|
- npmci node install stable
|
||||||
|
- npmci npm publish
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
|
# ====================
|
||||||
|
# metadata stage
|
||||||
|
# ====================
|
||||||
|
codequality:
|
||||||
|
stage: metadata
|
||||||
|
image: docker:stable
|
||||||
|
allow_failure: true
|
||||||
|
services:
|
||||||
|
- docker:stable-dind
|
||||||
|
script:
|
||||||
|
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
||||||
|
- docker run
|
||||||
|
--env SOURCE_CODE="$PWD"
|
||||||
|
--volume "$PWD":/code
|
||||||
|
--volume /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
|
||||||
|
artifacts:
|
||||||
|
paths: [codeclimate.json]
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
- priv
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
stage: trigger
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci trigger
|
- npmci trigger
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
pages:
|
pages:
|
||||||
image: hosttoday/ht-docker-node:npmci
|
image: hosttoday/ht-docker-node:npmci
|
||||||
stage: pages
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci command yarn global add npmpage
|
- npmci command npm install -g npmpage
|
||||||
- npmci command npmpage --publish gitlab
|
- npmci command npmpage
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
artifacts:
|
artifacts:
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
paths:
|
paths:
|
||||||
- public
|
- 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
|
||||||
|
15
.snyk
Normal file
15
.snyk
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
|
||||||
|
version: v1.12.0
|
||||||
|
# ignores vulnerabilities until expiry date; change duration by modifying expiry date
|
||||||
|
ignore:
|
||||||
|
'npm:shelljs:20140723':
|
||||||
|
- smartdelay > typings-global > smartshell > shelljs:
|
||||||
|
reason: None given
|
||||||
|
expires: '2018-07-28T21:47:33.536Z'
|
||||||
|
- early > typings-global > smartshell > shelljs:
|
||||||
|
reason: None given
|
||||||
|
expires: '2018-07-28T21:47:33.537Z'
|
||||||
|
- early > beautycolor > typings-global > smartshell > shelljs:
|
||||||
|
reason: None given
|
||||||
|
expires: '2018-07-28T21:47:33.537Z'
|
||||||
|
patch: {}
|
23
README.md
23
README.md
@ -1,13 +1,16 @@
|
|||||||
# tapbundle
|
# @pushrocks/tapbundle
|
||||||
|
|
||||||
tap bundled for tapbuffer
|
tap bundled for tapbuffer
|
||||||
|
|
||||||
## Availabililty
|
## Availabililty
|
||||||
|
|
||||||
[](https://www.npmjs.com/package/tapbundle)
|
[](https://www.npmjs.com/package/tapbundle)
|
||||||
[](https://GitLab.com/pushrocks/tapbundle)
|
[](https://GitLab.com/pushrocks/tapbundle)
|
||||||
[](https://github.com/pushrocks/tapbundle)
|
[](https://github.com/pushrocks/tapbundle)
|
||||||
[](https://pushrocks.gitlab.io/tapbundle/)
|
[](https://pushrocks.gitlab.io/tapbundle/)
|
||||||
|
|
||||||
## Status for master
|
## Status for master
|
||||||
|
|
||||||
[](https://GitLab.com/pushrocks/tapbundle/commits/master)
|
[](https://GitLab.com/pushrocks/tapbundle/commits/master)
|
||||||
[](https://GitLab.com/pushrocks/tapbundle/commits/master)
|
[](https://GitLab.com/pushrocks/tapbundle/commits/master)
|
||||||
[](https://www.npmjs.com/package/tapbundle)
|
[](https://www.npmjs.com/package/tapbundle)
|
||||||
@ -18,25 +21,9 @@ tap bundled for tapbuffer
|
|||||||
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||||
[](http://standardjs.com/)
|
[](http://standardjs.com/)
|
||||||
|
|
||||||
## 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.
|
For further information read the linked docs at the top of this README.
|
||||||
|
|
||||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
> 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://push.rocks)
|
||||||
|
4
dist/index.d.ts
vendored
4
dist/index.d.ts
vendored
@ -1,4 +0,0 @@
|
|||||||
import 'typings-global';
|
|
||||||
import * as tap from 'tap';
|
|
||||||
import { expect } from 'smartchai';
|
|
||||||
export { tap, expect };
|
|
8
dist/index.js
vendored
8
dist/index.js
vendored
@ -1,8 +0,0 @@
|
|||||||
"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==
|
|
56
docs/docs/getstarted.md
Normal file
56
docs/docs/getstarted.md
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
# 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)
|
29
docs/docs/index.md
Normal file
29
docs/docs/index.md
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# 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)
|
23
docs/docs/license.md
Normal file
23
docs/docs/license.md
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# License
|
||||||
|
|
||||||
|
**MIT License**
|
||||||
|
|
||||||
|
Copyright © 2016 - 2017 Martin Donath
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to
|
||||||
|
deal in the Software without restriction, including without limitation the
|
||||||
|
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
IN THE SOFTWARE.
|
87
docs/mkdocs.yml
Normal file
87
docs/mkdocs.yml
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
# Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
|
||||||
|
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to
|
||||||
|
# deal in the Software without restriction, including without limitation the
|
||||||
|
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
# sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
# The above copyright notice and this permission notice shall be included in
|
||||||
|
# all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
# IN THE SOFTWARE.
|
||||||
|
|
||||||
|
# Project information
|
||||||
|
site_name: tapbundle | docs
|
||||||
|
site_description: a taprunner
|
||||||
|
site_author: Lossless GmbH
|
||||||
|
site_url: https://push.rocks
|
||||||
|
|
||||||
|
# Repository
|
||||||
|
repo_name: pushrocks/tapbundle
|
||||||
|
repo_url: https://gitlab.com/pushrocks/tapbundle
|
||||||
|
|
||||||
|
# Copyright
|
||||||
|
copyright: 'Copyright © 2014 Lossless GmbH'
|
||||||
|
|
||||||
|
# Theme directory
|
||||||
|
theme: material
|
||||||
|
theme_dir: 'theme'
|
||||||
|
|
||||||
|
# Options
|
||||||
|
extra:
|
||||||
|
feature:
|
||||||
|
tabs: false
|
||||||
|
palette:
|
||||||
|
primary: indigo
|
||||||
|
accent: indigo
|
||||||
|
social:
|
||||||
|
- type: globe
|
||||||
|
link: http://lossless.com
|
||||||
|
- type: github-alt
|
||||||
|
link: https://github.com/philkunz
|
||||||
|
- type: twitter
|
||||||
|
link: https://twitter.com/philkunzcom
|
||||||
|
- type: linkedin
|
||||||
|
link: https://linkedin.com/in/philippkunz
|
||||||
|
|
||||||
|
# Extensions
|
||||||
|
markdown_extensions:
|
||||||
|
- markdown.extensions.admonition
|
||||||
|
- markdown.extensions.codehilite(guess_lang=false, linenums=true)
|
||||||
|
- markdown.extensions.def_list
|
||||||
|
- markdown.extensions.footnotes
|
||||||
|
- markdown.extensions.meta
|
||||||
|
- markdown.extensions.toc(permalink=true)
|
||||||
|
- pymdownx.arithmatex
|
||||||
|
- pymdownx.betterem(smart_enable=all)
|
||||||
|
- pymdownx.caret
|
||||||
|
- pymdownx.critic
|
||||||
|
- pymdownx.details
|
||||||
|
- pymdownx.emoji:
|
||||||
|
emoji_generator: !!python/name:pymdownx.emoji.to_svg
|
||||||
|
- pymdownx.inlinehilite
|
||||||
|
- pymdownx.magiclink
|
||||||
|
- pymdownx.mark
|
||||||
|
- pymdownx.smartsymbols
|
||||||
|
- pymdownx.superfences
|
||||||
|
- pymdownx.tasklist(custom_checkbox=true)
|
||||||
|
- pymdownx.tilde
|
||||||
|
|
||||||
|
# Page tree
|
||||||
|
pages:
|
||||||
|
- Repo Readme: index.md
|
||||||
|
- Get Started: getstarted.md
|
||||||
|
- License: license.md
|
||||||
|
|
||||||
|
# Google Analytics
|
||||||
|
google_analytics:
|
||||||
|
- !!python/object/apply:os.getenv ["GOOGLE_ANALYTICS_KEY"]
|
||||||
|
- auto
|
56
docs/theme/partials/footer.html
vendored
Normal file
56
docs/theme/partials/footer.html
vendored
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
{% import "partials/language.html" as lang %}
|
||||||
|
<footer class="md-footer">
|
||||||
|
{% if page.previous_page or page.next_page %}
|
||||||
|
<div class="md-footer-nav">
|
||||||
|
<nav class="md-footer-nav__inner md-grid">
|
||||||
|
{% if page.previous_page %}
|
||||||
|
<a href="{{ page.previous_page.url }}" title="{{ page.previous_page.title }}" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
||||||
|
<span class="md-flex__ellipsis">
|
||||||
|
<span class="md-footer-nav__direction">
|
||||||
|
{{ lang.t("footer.previous") }}
|
||||||
|
</span>
|
||||||
|
{{ page.previous_page.title }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{% if page.next_page %}
|
||||||
|
<a href="{{ page.next_page.url }}" title="{{ page.next_page.title }}" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
||||||
|
<span class="md-flex__ellipsis">
|
||||||
|
<span class="md-footer-nav__direction">
|
||||||
|
{{ lang.t("footer.next") }}
|
||||||
|
</span>
|
||||||
|
{{ page.next_page.title }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<div class="md-footer-meta md-typeset">
|
||||||
|
<div class="md-footer-meta__inner md-grid">
|
||||||
|
<div class="md-footer-copyright">
|
||||||
|
{% if config.copyright %}
|
||||||
|
<div class="md-footer-copyright__highlight">
|
||||||
|
{{ config.copyright }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<a href="https://lossless.gmbh" title="push.rocks">Impressum</a>
|
||||||
|
|
|
||||||
|
<a href="https://lossless.com" title="Lossless GmbH">Company Website</a>
|
||||||
|
</div>
|
||||||
|
{% block social %}
|
||||||
|
{% include "partials/social.html" %}
|
||||||
|
{% endblock %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
@ -1,7 +1,13 @@
|
|||||||
{
|
{
|
||||||
"npmci": {
|
"npmci": {
|
||||||
"globalNpmTools": [
|
"npmGlobalTools": [
|
||||||
"npmts"
|
"npmts"
|
||||||
]
|
],
|
||||||
|
"npmAccessLevel": "public"
|
||||||
|
},
|
||||||
|
"npmts": {
|
||||||
|
"testConfig": {
|
||||||
|
"parallel": false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
1007
package-lock.json
generated
Normal file
1007
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
21
package.json
21
package.json
@ -1,11 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "tapbundle",
|
"name": "@pushrocks/tapbundle",
|
||||||
"version": "1.0.5",
|
"private": false,
|
||||||
|
"version": "3.0.1",
|
||||||
"description": "tap bundled for tapbuffer",
|
"description": "tap bundled for tapbuffer",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(npmts)"
|
"test": "(tsrun test/test.ts)",
|
||||||
|
"build": "(npmts)"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -18,8 +20,15 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/tapbundle#README",
|
"homepage": "https://gitlab.com/pushrocks/tapbundle#README",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"smartchai": "^1.0.3",
|
"@pushrocks/smartdelay": "^2.0.1",
|
||||||
"tap": "^10.3.0",
|
"@pushrocks/smartpromise": "^2.0.5",
|
||||||
"typings-global": "^1.0.14"
|
"early": "^2.1.1",
|
||||||
|
"leakage": "^0.4.0",
|
||||||
|
"smartchai": "^2.0.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@gitzone/tsrun": "^1.1.2",
|
||||||
|
"@types/node": "^10.5.2",
|
||||||
|
"randomstring": "^1.1.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
21
test/test.iterationleak.ts
Normal file
21
test/test.iterationleak.ts
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
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 => {
|
||||||
|
await tools.checkIterationLeak(async () => {
|
||||||
|
let domain = randomstring.generate(1000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
let outsideArray = [];
|
||||||
|
|
||||||
|
let test2 = tap.test('should throw', async tools => {
|
||||||
|
let err = await tools.returnError(async () => {
|
||||||
|
await tools.checkIterationLeak(async () => {
|
||||||
|
outsideArray.push(randomstring.generate(1000));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
expect(err).to.be.instanceof(Error);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.start();
|
10
test/test.tapwrap.ts
Normal file
10
test/test.tapwrap.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { tap, expect } from '../dist/index';
|
||||||
|
|
||||||
|
let tapwrap = tap.wrap(async () => {
|
||||||
|
tap.test('should do something', async () => {
|
||||||
|
console.log('test1');
|
||||||
|
});
|
||||||
|
tap.start();
|
||||||
|
});
|
||||||
|
|
||||||
|
tapwrap.run();
|
36
test/test.ts
Normal file
36
test/test.ts
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import { tap, expect } from '../ts/index';
|
||||||
|
|
||||||
|
let 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 => {
|
||||||
|
await tools.delayFor(1000);
|
||||||
|
});
|
||||||
|
|
||||||
|
let 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
|
||||||
|
.be.true;
|
||||||
|
expect((await test2).hrtMeasurement.milliSeconds > 1000).to.be.true;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
let 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 => {
|
||||||
|
tools.timeout(1000);
|
||||||
|
await tools.delayFor(500);
|
||||||
|
});
|
||||||
|
|
||||||
|
let test6 = tap.skip.test('my 6th test -> should fail after 1000ms', async tools => {
|
||||||
|
tools.allowFailure();
|
||||||
|
tools.timeout(1000);
|
||||||
|
await tools.delayFor(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.start();
|
10
ts/index.ts
10
ts/index.ts
@ -1,8 +1,2 @@
|
|||||||
import 'typings-global'
|
export { expect } from 'smartchai';
|
||||||
let tap = require('tap')
|
export { tap } from './tapbundle.classes.tap';
|
||||||
import { expect } from 'smartchai'
|
|
||||||
|
|
||||||
export {
|
|
||||||
tap,
|
|
||||||
expect
|
|
||||||
}
|
|
||||||
|
110
ts/tapbundle.classes.tap.ts
Normal file
110
ts/tapbundle.classes.tap.ts
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
import * as plugins from './tapbundle.plugins';
|
||||||
|
|
||||||
|
import { TapTest, ITestFunction } from './tapbundle.classes.taptest';
|
||||||
|
import { TapWrap, ITapWrapFunction } from './tapbundle.classes.tapwrap';
|
||||||
|
export class Tap {
|
||||||
|
/**
|
||||||
|
* skip a test
|
||||||
|
*/
|
||||||
|
skip = {
|
||||||
|
test: (descriptionArg: string, functionArg: ITestFunction) => {
|
||||||
|
console.log(`skipped test: ${descriptionArg}`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private _tapTests: 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) {
|
||||||
|
let localTest = new TapTest({
|
||||||
|
description: testDescription,
|
||||||
|
testFunction: testFunction,
|
||||||
|
parallel: false
|
||||||
|
});
|
||||||
|
this._tapTests.push(localTest);
|
||||||
|
return localTest;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wraps function
|
||||||
|
*/
|
||||||
|
wrap(functionArg: ITapWrapFunction) {
|
||||||
|
return new TapWrap(functionArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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._tapTests.push(
|
||||||
|
new TapTest({
|
||||||
|
description: testDescription,
|
||||||
|
testFunction: testFunction,
|
||||||
|
parallel: true
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* starts the test evaluation
|
||||||
|
*/
|
||||||
|
async start(optionsArg?: { throwOnError: boolean }) {
|
||||||
|
let promiseArray: Promise<any>[] = [];
|
||||||
|
|
||||||
|
// safeguard against empty test array
|
||||||
|
if (this._tapTests.length === 0) {
|
||||||
|
console.log('no tests specified. Ending here!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`1..${this._tapTests.length}`);
|
||||||
|
for (let testKey = 0; testKey < this._tapTests.length; testKey++) {
|
||||||
|
let currentTest = this._tapTests[testKey];
|
||||||
|
let testPromise = currentTest.run(testKey);
|
||||||
|
if (currentTest.parallel) {
|
||||||
|
promiseArray.push(testPromise);
|
||||||
|
} else {
|
||||||
|
await testPromise;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await Promise.all(promiseArray);
|
||||||
|
|
||||||
|
// when tests have been run and all promises are fullfilled
|
||||||
|
let failReasons: string[] = [];
|
||||||
|
let executionNotes: string[] = [];
|
||||||
|
// collect failed tests
|
||||||
|
for (let tapTest of this._tapTests) {
|
||||||
|
if (tapTest.status !== 'success') {
|
||||||
|
failReasons.push(
|
||||||
|
`Test ${tapTest.testKey + 1} failed with status ${tapTest.status}:\n` +
|
||||||
|
`|| ${tapTest.description}\n` +
|
||||||
|
`|| for more information please take a look the logs above`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// render fail Reasons
|
||||||
|
for (let failReason of failReasons) {
|
||||||
|
console.log(failReason);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (optionsArg && optionsArg.throwOnError && failReasons.length > 0) {
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* handle errors
|
||||||
|
*/
|
||||||
|
threw(err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export let tap = new Tap();
|
79
ts/tapbundle.classes.taptest.ts
Normal file
79
ts/tapbundle.classes.taptest.ts
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
import * as plugins from './tapbundle.plugins';
|
||||||
|
import { tapCreator } from './tapbundle.tapcreator';
|
||||||
|
import { TapTools } from './tapbundle.classes.taptools';
|
||||||
|
|
||||||
|
// imported interfaces
|
||||||
|
import { HrtMeasurement } from 'early';
|
||||||
|
import { Deferred } from 'smartq';
|
||||||
|
|
||||||
|
// interfaces
|
||||||
|
export type TTestStatus = 'success' | 'error' | 'pending' | 'errorAfterSuccess' | 'timeout';
|
||||||
|
|
||||||
|
export interface ITestFunction {
|
||||||
|
(tapTools?: TapTools): Promise<any>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class TapTest {
|
||||||
|
description: string;
|
||||||
|
failureAllowed: boolean;
|
||||||
|
hrtMeasurement: HrtMeasurement;
|
||||||
|
parallel: boolean;
|
||||||
|
status: TTestStatus;
|
||||||
|
tapTools: TapTools;
|
||||||
|
testFunction: ITestFunction;
|
||||||
|
testKey: number; // the testKey the position in the test qeue. Set upon calling .run()
|
||||||
|
testDeferred: Deferred<TapTest> = plugins.smartpromise.defer();
|
||||||
|
testPromise: Promise<TapTest> = this.testDeferred.promise;
|
||||||
|
/**
|
||||||
|
* constructor
|
||||||
|
*/
|
||||||
|
constructor(optionsArg: { description: string; testFunction: ITestFunction; parallel: boolean }) {
|
||||||
|
this.description = optionsArg.description;
|
||||||
|
this.hrtMeasurement = new HrtMeasurement();
|
||||||
|
this.parallel = optionsArg.parallel;
|
||||||
|
this.status = 'pending';
|
||||||
|
this.tapTools = new TapTools(this);
|
||||||
|
this.testFunction = optionsArg.testFunction;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* run the test
|
||||||
|
*/
|
||||||
|
async run(testKeyArg: number) {
|
||||||
|
this.hrtMeasurement.start();
|
||||||
|
this.testKey = testKeyArg;
|
||||||
|
let testNumber = testKeyArg + 1;
|
||||||
|
try {
|
||||||
|
await this.testFunction(this.tapTools);
|
||||||
|
if (this.status === 'timeout') {
|
||||||
|
throw new Error('Test succeeded, but timed out...');
|
||||||
|
}
|
||||||
|
this.hrtMeasurement.stop();
|
||||||
|
console.log(
|
||||||
|
`ok ${testNumber} - ${this.description} # time=${this.hrtMeasurement.milliSeconds}ms`
|
||||||
|
);
|
||||||
|
this.status = 'success';
|
||||||
|
this.testDeferred.resolve(this);
|
||||||
|
} catch (err) {
|
||||||
|
this.hrtMeasurement.stop();
|
||||||
|
console.log(
|
||||||
|
`not ok ${testNumber} - ${this.description} # time=${this.hrtMeasurement.milliSeconds}ms`
|
||||||
|
);
|
||||||
|
this.testDeferred.resolve(this);
|
||||||
|
|
||||||
|
// if the test has already succeeded before
|
||||||
|
if (this.status === 'success') {
|
||||||
|
this.status = 'errorAfterSuccess';
|
||||||
|
console.log('!!! ALERT !!!: weird behaviour, since test has been already successfull');
|
||||||
|
} else {
|
||||||
|
this.status = 'error';
|
||||||
|
}
|
||||||
|
|
||||||
|
// if the test is allowed to fail
|
||||||
|
if (this.failureAllowed) {
|
||||||
|
console.log(`please note: failure allowed!`);
|
||||||
|
}
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
58
ts/tapbundle.classes.taptools.ts
Normal file
58
ts/tapbundle.classes.taptools.ts
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
import * as plugins from './tapbundle.plugins';
|
||||||
|
import { TapTest } from './tapbundle.classes.taptest';
|
||||||
|
|
||||||
|
export interface IPromiseFunc {
|
||||||
|
(): Promise<any>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class TapTools {
|
||||||
|
/**
|
||||||
|
* the referenced TapTest
|
||||||
|
*/
|
||||||
|
private _tapTest: TapTest;
|
||||||
|
|
||||||
|
constructor(TapTestArg) {
|
||||||
|
this._tapTest = TapTestArg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* allow failure
|
||||||
|
*/
|
||||||
|
allowFailure() {
|
||||||
|
this._tapTest.failureAllowed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* async/await delay method
|
||||||
|
*/
|
||||||
|
async delayFor(timeMilliArg) {
|
||||||
|
await plugins.smartdelay.delayFor(timeMilliArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
async delayForRandom(timeMilliMinArg, timeMilliMaxArg) {
|
||||||
|
await plugins.smartdelay.delayForRandom(timeMilliMinArg, timeMilliMaxArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
async timeout(timeMilliArg: number) {
|
||||||
|
let timeout = new plugins.smartdelay.Timeout(timeMilliArg);
|
||||||
|
timeout.makeUnrefed();
|
||||||
|
await timeout.promise;
|
||||||
|
if (this._tapTest.status === 'pending') {
|
||||||
|
this._tapTest.status = 'timeout';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async checkIterationLeak(iterationfuncArg: IPromiseFunc) {
|
||||||
|
await plugins.leakage.iterate.async(iterationfuncArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
async returnError(throwingFuncArg: IPromiseFunc) {
|
||||||
|
let funcErr: Error;
|
||||||
|
try {
|
||||||
|
await throwingFuncArg();
|
||||||
|
} catch (err) {
|
||||||
|
funcErr = err;
|
||||||
|
}
|
||||||
|
return funcErr;
|
||||||
|
}
|
||||||
|
}
|
24
ts/tapbundle.classes.tapwrap.ts
Normal file
24
ts/tapbundle.classes.tapwrap.ts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import * as plugins from './tapbundle.plugins';
|
||||||
|
|
||||||
|
export interface ITapWrapFunction {
|
||||||
|
(): Promise<any>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class TapWrap {
|
||||||
|
wrapFunction: ITapWrapFunction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the constructor
|
||||||
|
*/
|
||||||
|
constructor(wrapFunctionArg: ITapWrapFunction) {
|
||||||
|
// nothing here
|
||||||
|
this.wrapFunction = wrapFunctionArg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* run the wrapFunction
|
||||||
|
*/
|
||||||
|
async run() {
|
||||||
|
await this.wrapFunction();
|
||||||
|
}
|
||||||
|
}
|
6
ts/tapbundle.plugins.ts
Normal file
6
ts/tapbundle.plugins.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import * as early from 'early';
|
||||||
|
import * as leakage from 'leakage';
|
||||||
|
import * as smartdelay from '@pushrocks/smartdelay';
|
||||||
|
import * as smartpromise from '@pushrocks/smartpromise';
|
||||||
|
|
||||||
|
export { early, smartdelay, smartpromise, leakage };
|
7
ts/tapbundle.tapcreator.ts
Normal file
7
ts/tapbundle.tapcreator.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import * as plugins from './tapbundle.plugins';
|
||||||
|
|
||||||
|
export class TapCreator {
|
||||||
|
// TODO:
|
||||||
|
}
|
||||||
|
|
||||||
|
export let tapCreator = new TapCreator();
|
Reference in New Issue
Block a user