node-tdd 3.3.3 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -36,6 +36,16 @@ describe('Testing some stuff', /* { ...options }, */ () => {
36
36
 
37
37
  Please see tests for further usage examples.
38
38
 
39
+ ### Custom Cassette Logic
40
+
41
+ ### delayConnection
42
+
43
+ Delay the connection by a certain number of ms.
44
+
45
+ ### delayBody
46
+
47
+ Delay the response body by a certain number of ms.
48
+
39
49
  ### Function Kwargs
40
50
 
41
51
  #### dir
@@ -183,6 +183,14 @@ export default (opts) => {
183
183
  scope.on('request', (req, interceptor, requestBodyString) => {
184
184
  const idx = pendingMocks.findIndex((e) => e.idx === scopeIdx);
185
185
 
186
+ // https://github.com/nock/nock/blob/79ee0429050af929c525ae21a326d22796344bfc/lib/interceptor.js#L616
187
+ if (Number.isInteger(pendingMocks[idx]?.record?.delayConnection)) {
188
+ interceptor.delayConnection(pendingMocks[idx].record.delayConnection);
189
+ }
190
+ if (Number.isInteger(pendingMocks[idx]?.record?.delayBody)) {
191
+ interceptor.delayBody(pendingMocks[idx].record.delayBody);
192
+ }
193
+
186
194
  if (anyFlagPresent(['magic', 'headers'])) {
187
195
  // add new headers
188
196
  const reqheaders = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "node-tdd",
3
3
  "type": "module",
4
- "version": "3.3.3",
4
+ "version": "3.4.0",
5
5
  "description": "Drop in extension for mocha to abstract commonly used test setups",
6
6
  "main": "lib/index.js",
7
7
  "scripts": {
@@ -42,18 +42,18 @@
42
42
  },
43
43
  "homepage": "https://github.com/blackflux/node-tdd#readme",
44
44
  "devDependencies": {
45
- "@babel/core": "7.17.9",
45
+ "@babel/core": "7.17.10",
46
46
  "@babel/eslint-parser": "7.17.0",
47
47
  "@babel/register": "7.17.7",
48
48
  "@blackflux/eslint-plugin-rules": "2.1.0",
49
- "@blackflux/robo-config-plugin": "7.7.6",
50
- "aws-sdk": "2.1112.0",
51
- "aws-sdk-wrap": "12.0.4",
52
- "axios": "0.26.1",
53
- "c8": "7.11.0",
49
+ "@blackflux/robo-config-plugin": "7.7.12",
50
+ "aws-sdk": "2.1131.0",
51
+ "aws-sdk-wrap": "12.1.3",
52
+ "axios": "0.27.2",
53
+ "c8": "7.11.2",
54
54
  "chai": "4.3.6",
55
55
  "coveralls": "3.1.1",
56
- "eslint": "8.13.0",
56
+ "eslint": "8.15.0",
57
57
  "eslint-config-airbnb-base": "15.0.0",
58
58
  "eslint-plugin-import": "2.26.0",
59
59
  "eslint-plugin-json": "3.1.0",