diff --git a/docs/docs/getstarted.md b/docs/docs/getstarted.md new file mode 100644 index 0000000..d41d02b --- /dev/null +++ b/docs/docs/getstarted.md @@ -0,0 +1,55 @@ +# 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) + +[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks) diff --git a/docs/index.md b/docs/docs/index.md similarity index 50% rename from docs/index.md rename to docs/docs/index.md index dafd1cd..347b468 100644 --- a/docs/index.md +++ b/docs/docs/index.md @@ -18,59 +18,6 @@ tap bundled for tapbuffer [![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/) [![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) -## Usage -Use TypeScript for best in class instellisense. - -This package includes - -* tap compatible testing framework written in TypeScript -* npm package chai (through smartchai) -* npm package chai-as-promised (through smartchai) -* npm package chai-string (through smartchai) -* npm package @types/chai (through smartchai) -* npm package @types/chai-as-promised (through smartchai) -* npm package @types/chai-string (through smartchai) - -It also implements its own tap testing engine, that is fully typed. - -In other words: This package is fully typed :) - - -### Get started with writing your first test file. -```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) diff --git a/docs/docs/license.md b/docs/docs/license.md new file mode 100644 index 0000000..b531ea3 --- /dev/null +++ b/docs/docs/license.md @@ -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. diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml new file mode 100644 index 0000000..5efc6fc --- /dev/null +++ b/docs/mkdocs.yml @@ -0,0 +1,87 @@ +# Copyright (c) 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. + +# 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 \ No newline at end of file diff --git a/docs/theme/partials/footer.html b/docs/theme/partials/footer.html new file mode 100644 index 0000000..06759af --- /dev/null +++ b/docs/theme/partials/footer.html @@ -0,0 +1,56 @@ +{% import "partials/language.html" as lang %} + \ No newline at end of file