From d3a1a9d86403ca8b4831e1ff0f62ddd1a377eb83 Mon Sep 17 00:00:00 2001 From: Carsten Klein Date: Sun, 31 Mar 2019 17:26:01 +0200 Subject: [PATCH] gh-5: guides/setup section --- pages/guide/setup.md | 77 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 67 insertions(+), 10 deletions(-) diff --git a/pages/guide/setup.md b/pages/guide/setup.md index 40ccf5a..6494676 100644 --- a/pages/guide/setup.md +++ b/pages/guide/setup.md @@ -63,17 +63,34 @@ npm install --save-dev chai @types/chai #### Example Code {% highlight TypeScript linenos %} -import { suite, test } from '@testdeck/mocha'; +import { suite, test } from '@testdeck/mocha'; // might as well use jasmine/jest here import * as chai from 'chai'; +// let's have chai should augmentations +chai.should(); + @suite class TestSuite { @test - someTest() { + assertTest() { chai.assert.isOk(false); } + + @test + expectTest() { + + chai.expect(false).to.be.true; + } + + @test + shouldTest() { + + const val = false; + + val.should.be.true; + } } {% endhighlight %} @@ -87,9 +104,10 @@ class TestSuite { {% highlight TypeScript linenos %} {% endhighlight %} + ### NodeJS assert -A simple assertion framework that is included with the standard NodeJS library. +A simple, no fuss, assertion framework that is included with the standard NodeJS library. #### Setup @@ -98,7 +116,7 @@ This is part of the standard NodeJS library. #### Example Code {% highlight TypeScript linenos %} -import { suite, test } from '@testdeck/mocha'; +import { suite, test } from '@testdeck/mocha'; // might as well use jasmine/jest here import * as assert from 'assert'; @suite @@ -115,18 +133,57 @@ class TestSuite { ### Jasmine built-in +For Jasmine, we recommend the built-in expectation framework. + +#### Setup + +This is an integral part of Jasmine. + +#### Example Code + +{% highlight TypeScript linenos %} +import { suite, test } from '@testdeck/jasmine'; + +@suite +class TestSuite { + + @test + someTest() { + + expect(false).to.be.true; + } +} +{% endhighlight %} + ### Jest built-in +For Jest, we recommend the built-in expectation framework. -
assert
+#### Setup -
Jasmine built-in
-
For Jasmine, we recommend the built-in expectation framework.
+This is an integral part of Jest. -
Jest built-in
-
For Jest, we recommend the built-in expectation framework.
- +#### Example Code + +{% highlight TypeScript linenos %} +import { suite, test } from '@testdeck/jest'; + +@suite +class TestSuite { + + @test + someTest() { + + expect(false).to.be.true; + } +} +{% endhighlight %} + + +### Our Recommendation + +For you to be able to switch between test frameworks easily, we recommend that you use the expectation style alone. ## Mocking Frameworks