Skip to content

Commit 6a3681c

Browse files
author
Peter Svetlichny
committed
test(setup): add chai-subset and global sandbox
1 parent b3659ff commit 6a3681c

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"devDependencies": {
2929
"chai": "^4.1.2",
3030
"chai-as-promised": "^7.1.1",
31+
"chai-subset": "^1.6.0",
3132
"dirty-chai": "^2.0.1",
3233
"fixd": "^1.0.1",
3334
"istanbul": "^0.4.5",
@@ -54,7 +55,8 @@
5455
"globals": [
5556
"sinon",
5657
"fixd",
57-
"expect"
58+
"expect",
59+
"sandbox"
5860
]
5961
}
6062
}

test/setup.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const chai = require('chai')
22
const dirtyChai = require('dirty-chai')
33
const chaiAsPromised = require('chai-as-promised')
4+
const chaiSubset = require('chai-subset')
45
const mod = require('module')
56
const path = require('path')
67
const sinon = require('sinon')
@@ -12,11 +13,17 @@ const fixd = require('fixd')
1213
global.expect = chai.expect
1314
chai.use(chaiAsPromised)
1415
chai.use(dirtyChai)
16+
chai.use(chaiSubset)
1517
chai.use(sinonChai)
1618

1719
// Sinon
1820
// ----------------------------------------
1921
global.sinon = sinon
22+
global.sandbox = sinon.sandbox.create()
23+
24+
if (global.afterEach) {
25+
afterEach(() => global.sandbox.restore())
26+
}
2027

2128
// Fixd
2229
// ----------------------------------------

yarn.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,10 @@ chai-as-promised@^7.1.1:
301301
dependencies:
302302
check-error "^1.0.2"
303303

304+
chai-subset@^1.6.0:
305+
version "1.6.0"
306+
resolved "https://registry.yarnpkg.com/chai-subset/-/chai-subset-1.6.0.tgz#a5d0ca14e329a79596ed70058b6646bd6988cfe9"
307+
304308
chai@^4.1.2:
305309
version "4.1.2"
306310
resolved "https://registry.yarnpkg.com/chai/-/chai-4.1.2.tgz#0f64584ba642f0f2ace2806279f4f06ca23ad73c"

0 commit comments

Comments
 (0)