1
0

Add node, chai, jest diff comparison

This commit is contained in:
Eugen Wissner 2018-12-31 07:44:25 +01:00
parent c623c4d16f
commit 54fcfda40a
11 changed files with 1264 additions and 0 deletions

View File

@ -65,3 +65,8 @@ See also:
- Custom formatters: https://github.com/cucumber/cucumber-js/blob/master/docs/custom_formatters.md - Custom formatters: https://github.com/cucumber/cucumber-js/blob/master/docs/custom_formatters.md
- Built-in formatters: https://github.com/cucumber/cucumber-js/tree/master/src/formatter. - Built-in formatters: https://github.com/cucumber/cucumber-js/tree/master/src/formatter.
### assertion
This package contains some failing tests demonstrating object diffs provided by
node's native asserts, chai and jest.

View File

@ -0,0 +1,7 @@
Feature: Chai variants
Scenario:
When I use chai
Then I can choose the expect syntax
When I use chai
Then I can choose the should syntax

View File

@ -0,0 +1,12 @@
Feature: Failure
Scenario:
When I use chai
Then I see chai diff on failure
Scenario:
When I use jest
Then I see jest diff on failure
Scenario:
When I use node
Then I see node diff on failure

View File

@ -0,0 +1,6 @@
const { expect } = require('chai')
const { Then } = require('cucumber')
Then('I can choose the expect syntax', function () {
expect(true).to.be.true
})

View File

@ -0,0 +1,10 @@
const { expect } = require('chai')
const { When, Then } = require('cucumber')
const compared = require('../support/compared')
When('I use chai', function () {
})
Then('I see chai diff on failure', function () {
expect(compared.actual).to.deep.equal(compared.expected)
})

View File

@ -0,0 +1,8 @@
const { Then } = require('cucumber')
require('chai').should()
Then('I can choose the should syntax', function () {
const boolean = true
boolean.should.be.true
})

View File

@ -0,0 +1,10 @@
const expect = require('expect')
const { When, Then } = require('cucumber')
const compared = require('../support/compared')
When('I use jest', function () {
})
Then('I see jest diff on failure', function () {
expect(compared.actual).toEqual(compared.expected)
})

View File

@ -0,0 +1,10 @@
const assert = require('assert')
const { When, Then } = require('cucumber')
const compared = require('../support/compared')
When('I use node', function () {
})
Then('I see node diff on failure', function () {
assert.equal(compared.actual, compared.expected)
})

View File

@ -0,0 +1,9 @@
module.exports = {
actual: {},
expected: [
{
author: 'Nicolaus Cusanus',
title: 'Die belehrte Unwissenheit'
}
]
}

1171
assertion/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

16
assertion/package.json Normal file
View File

@ -0,0 +1,16 @@
{
"name": "assertion",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "cucumber-js"
},
"author": "Eugen Wissner <belka@caraus.de>",
"license": "MPL-2.0",
"devDependencies": {
"chai": "^4.2.0",
"cucumber": "^5.0.3",
"expect": "^23.6.0"
}
}