Add node, chai, jest diff comparison
This commit is contained in:
parent
c623c4d16f
commit
54fcfda40a
@ -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.
|
||||||
|
7
assertion/features/chai-variants.feature
Normal file
7
assertion/features/chai-variants.feature
Normal 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
|
12
assertion/features/failure.feature
Normal file
12
assertion/features/failure.feature
Normal 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
|
6
assertion/features/steps/chai-expect.js
Normal file
6
assertion/features/steps/chai-expect.js
Normal 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
|
||||||
|
})
|
10
assertion/features/steps/chai-failure.js
Normal file
10
assertion/features/steps/chai-failure.js
Normal 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)
|
||||||
|
})
|
8
assertion/features/steps/chai-should.js
Normal file
8
assertion/features/steps/chai-should.js
Normal 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
|
||||||
|
})
|
10
assertion/features/steps/jest-failure.js
Normal file
10
assertion/features/steps/jest-failure.js
Normal 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)
|
||||||
|
})
|
10
assertion/features/steps/node-failure.js
Normal file
10
assertion/features/steps/node-failure.js
Normal 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)
|
||||||
|
})
|
9
assertion/features/support/compared.js
Normal file
9
assertion/features/support/compared.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
module.exports = {
|
||||||
|
actual: {},
|
||||||
|
expected: [
|
||||||
|
{
|
||||||
|
author: 'Nicolaus Cusanus',
|
||||||
|
title: 'Die belehrte Unwissenheit'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
1171
assertion/package-lock.json
generated
Normal file
1171
assertion/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
16
assertion/package.json
Normal file
16
assertion/package.json
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user