pmpact 0.4.10 → 0.4.11

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/app/app.js CHANGED
@@ -44,10 +44,10 @@ function isValidVersion(version) {
44
44
  }
45
45
 
46
46
  const getParser = (version) => {
47
- if(isValidVersion(version)){
47
+ if (isValidVersion(version)) {
48
48
  try {
49
49
  return require(`./parsers/${version}/pact-parser`);
50
- } catch(err) {
50
+ } catch (err) {
51
51
  throw new Error(`Could not find a parser for the pact specification version: ${version}`);
52
52
  }
53
53
  } else {
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmpact",
3
- "version": "0.4.10",
3
+ "version": "0.4.11",
4
4
  "description": "A command line tool to convert Pact files to Postman collections.",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "npm run test-unit && npm run test-integration",
8
- "test-unit": "mocha --reporter mocha-better-spec-reporter \"tests/unit/**/*.js\"",
9
- "test-integration": "mocha --reporter mocha-better-spec-reporter \"tests/integration/**/*.js\""
8
+ "test-unit": "node --test 'tests/unit/**/*.js'",
9
+ "test-integration": "node --test tests/integration/**/*.js"
10
10
  },
11
11
  "bin": {
12
12
  "pmpact": "pmpact.js"
@@ -37,11 +37,7 @@
37
37
  "lodash": "4.17.23"
38
38
  },
39
39
  "devDependencies": {
40
- "chai": "4.3.7",
41
40
  "execa": "5.1.1",
42
- "mocha": "10.8.2",
43
- "mocha-better-spec-reporter": "3.1.0",
44
- "proxyquire": "2.1.3",
45
- "sinon": "15.0.3"
41
+ "proxyquire": "2.1.3"
46
42
  }
47
43
  }
@@ -1,10 +1,14 @@
1
- const fs = require('fs');
2
- const util = require('util');
1
+
2
+ import fs from 'node:fs'
3
+ import util from 'node:util'
4
+ import { describe, afterEach, it } from "node:test"
5
+ import assert from "node:assert/strict";
6
+ import http from 'node:http';
7
+ import execa from 'execa';
8
+
9
+ import simplePactJson from '../fixtures/v2/simple-pact.json' with { type: 'json' };
10
+
3
11
  const readFile = util.promisify(fs.readFile);
4
- const assert = require('chai').assert;
5
- const execa = require('execa');
6
- const http = require('http');
7
- const simplePactJson = require('../fixtures/v2/simple-pact.json');
8
12
 
9
13
  describe('pmpact integration', () => {
10
14
 
@@ -21,7 +25,7 @@ describe('pmpact integration', () => {
21
25
  server.close(() => {
22
26
  resolve();
23
27
  });
24
- } catch(err) {
28
+ } catch (err) {
25
29
  resolve();
26
30
  }
27
31
  });
@@ -34,7 +38,7 @@ describe('pmpact integration', () => {
34
38
  await createServerClosePromise(server);
35
39
  server = undefined;
36
40
  }
37
- } catch(err) {
41
+ } catch (err) {
38
42
 
39
43
  }
40
44
  });
@@ -44,7 +48,7 @@ describe('pmpact integration', () => {
44
48
  const { stdout, stderr } = await execa('node pmpact.js tests/fixtures/v2/simple-pact.json', undefined, { shell: true });
45
49
  assert.ok(isPostmanCollection(stdout));
46
50
  assert.equal(stderr, '');
47
- } catch(err) {
51
+ } catch (err) {
48
52
  console.log(err);
49
53
  assert.ok(0, 'Should not fail');
50
54
  }
@@ -60,7 +64,7 @@ describe('pmpact integration', () => {
60
64
  const { stdout, stderr } = await execa('node pmpact.js http://localhost:9012', undefined, { shell: true });
61
65
  assert.ok(isPostmanCollection(stdout));
62
66
  assert.equal(stderr, '');
63
- } catch(err) {
67
+ } catch (err) {
64
68
  console.log(err);
65
69
  assert.ok(0, 'Should not fail');
66
70
  }
@@ -79,7 +83,7 @@ describe('pmpact integration', () => {
79
83
  assert.ok(isPostmanCollection(stdout));
80
84
  assert.equal(headerAuth, 'Basic ZFhmbHR5Rk1n...');
81
85
  assert.equal(stderr, '');
82
- } catch(err) {
86
+ } catch (err) {
83
87
  console.log(err);
84
88
  assert.ok(0, 'Should not fail');
85
89
  }
@@ -92,7 +96,7 @@ describe('pmpact integration', () => {
92
96
  const contentJson = (await readFile(FILE_OUTPUT_TEST)).toString('utf8');
93
97
  assert.ok(isPostmanCollection(contentJson));
94
98
  assert.equal(stderr, '');
95
- } catch(err) {
99
+ } catch (err) {
96
100
  console.log(err);
97
101
  assert.ok(0, 'Should not fail');
98
102
  }
@@ -102,7 +106,7 @@ describe('pmpact integration', () => {
102
106
  try {
103
107
  await execa('node pmpact.js non-existing-file.json', undefined, { shell: true });
104
108
  assert.ok(0, 'Should not be successful');
105
- } catch(err) {
109
+ } catch (err) {
106
110
  assert.ok(err.exitCode > 0);
107
111
  }
108
112
  });
@@ -1,84 +1,83 @@
1
- const assert = require('chai').assert;
2
- const sinon = require('sinon');
3
- const proxyquire = require('proxyquire').noCallThru();
4
- const simplePactV2Json = require('../../fixtures/v2/simple-pact.json');
5
- const simplePactV3Json = require('../../fixtures/v3/simple-pact.json');
1
+ import { it, describe } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import simplePactV2Json from '../../fixtures/v2/simple-pact.json' with { type: 'json' };
4
+ import simplePactV3Json from '../../fixtures/v3/simple-pact.json' with { type: 'json' };
6
5
 
7
- describe('pmpact > app', () => {
6
+ import { createRequire } from 'module';
7
+ const require = createRequire(import.meta.url);
8
+ const proxyquire = require('proxyquire');
8
9
 
9
- const SIMPLE_PACT_URL_V2 = 'http://simple-pact-v2';
10
- const SIMPLE_PACT_URL_V3 = 'http://simple-pact-v3';
11
10
 
12
- let app
13
- let Application;
11
+ describe('pmpact > app', () => {
12
+
14
13
  let axiosStub;
15
14
  let fsStub;
16
15
 
16
+ const SIMPLE_PACT_URL_V2 = 'http://simple-pact-v2';
17
+ const SIMPLE_PACT_URL_V3 = 'http://simple-pact-v3';
18
+
17
19
  const isPostmanCollection = (json) => {
18
20
  return JSON.parse(json).info.schema.indexOf('schema.getpostman.com') !== -1;
19
21
  };
20
22
 
21
- beforeEach(() => {
22
- axiosStub = sinon.stub({
23
- get: () => {}
24
- });
25
- axiosStub.get.withArgs(SIMPLE_PACT_URL_V2).returns({ data: simplePactV2Json });
26
- axiosStub.get.withArgs(SIMPLE_PACT_URL_V3).returns({ data: simplePactV3Json });
27
- fsStub = {
28
- writeFile: (path, data, opts, cb) => {
29
- cb();
23
+ const getApp = async () => {
24
+ axiosStub = {
25
+ get: (url) => {
26
+ if (url === SIMPLE_PACT_URL_V2) return { data: simplePactV2Json };
27
+ if (url === SIMPLE_PACT_URL_V3) return { data: simplePactV3Json };
30
28
  }
31
- }
32
- Application = proxyquire('../../../app/app', {
29
+ };
30
+
31
+ fsStub = {
32
+ writeFile: (path, data, opts, cb) => cb()
33
+ };
34
+ const Application = proxyquire('../../../app/app.js', {
33
35
  'axios': axiosStub,
34
36
  'fs': fsStub
35
37
  });
36
- app = new Application();
37
- });
38
+ return new Application();
39
+
40
+ };
38
41
 
39
- afterEach(() => {
40
- Application = undefined;
41
- axiosStub = undefined;
42
- fsStub = undefined;
43
- app = undefined;
44
- });
45
42
 
46
43
  it('should parse a pact file version 2.0.0', async () => {
44
+ const app = await getApp();
47
45
  const result = await app.parse('./tests/fixtures/v2/simple-pact.json');
48
46
  assert.ok(isPostmanCollection(result));
49
47
  });
50
48
 
51
49
  it('should parse a pact url version 2.0.0', async () => {
50
+ const app = await getApp();
52
51
  const result = await app.parse(SIMPLE_PACT_URL_V2);
53
52
  assert.ok(isPostmanCollection(result));
54
53
  });
55
54
 
56
55
  it('should parse a pact file version 3.0.0', async () => {
56
+ const app = await getApp();
57
57
  const result = await app.parse('./tests/fixtures/v3/simple-pact.json');
58
58
  assert.ok(isPostmanCollection(result));
59
59
  });
60
60
 
61
61
  it('should parse a pact url version 3.0.0', async () => {
62
+ const app = await getApp();
62
63
  const result = await app.parse(SIMPLE_PACT_URL_V3);
63
64
  assert.ok(isPostmanCollection(result));
64
65
  });
65
66
 
66
67
  it('should parse a pact url with headers', async () => {
68
+ const app = await getApp();
67
69
  const result = await app.parse(SIMPLE_PACT_URL_V2, '{"Accept":"application/json"}');
68
- assert.ok(axiosStub.get.withArgs(SIMPLE_PACT_URL_V2, {
69
- headers: {
70
- Accept: 'application/json'
71
- }
72
- }));
73
70
  assert.ok(isPostmanCollection(result));
74
71
  });
75
72
 
76
73
  it('should save a collection to a file', async () => {
74
+ const app = await getApp();
77
75
  const result = await app.parse('./tests/fixtures/v2/simple-pact.json', undefined, '~/file-output.json');
78
76
  assert.equal(result, 'The collection has been successfully written in ~/file-output.json');
79
77
  });
80
78
 
81
79
  it('should handle errors when saving to a file', async () => {
80
+ const app = await getApp();
82
81
  const error = new Error('Something happened!');
83
82
  fsStub.writeFile = (path, data, opts, cb) => {
84
83
  cb(error);
@@ -86,44 +85,48 @@ describe('pmpact > app', () => {
86
85
  try {
87
86
  await app.parse('./tests/fixtures/v2/simple-pact.json', undefined, '~/file-output.json');
88
87
  assert.ok(0, 'Should not be successful');
89
- } catch(err) {
88
+ } catch (err) {
90
89
  assert.equal(err, error);
91
90
  }
92
91
  });
93
92
 
94
93
  it('should not parse a bad url or a non-existing file', async () => {
94
+ const app = await getApp();
95
95
  try {
96
96
  await app.parse('something-wrong-here');
97
97
  assert.ok(0, 'Should not resolve');
98
- } catch(err) {
98
+ } catch (err) {
99
99
  assert.ok(err.message.indexOf('Cannot find module') !== -1);
100
100
  }
101
101
  });
102
102
 
103
103
  it('should not parse an unsupported Pact specification', async () => {
104
+ const app = await getApp();
104
105
  try {
105
106
  await app.parse('./tests/fixtures/unsupported-pact.json');
106
107
  assert.ok(0, 'Should not resolve');
107
- } catch(err) {
108
+ } catch (err) {
108
109
  assert.ok(err.message.indexOf('Could not find a parser') !== -1);
109
110
  }
110
111
  });
111
112
 
112
113
  it('should default an unspecified pact specification to 2.0.0', async () => {
114
+ const app = await getApp();
113
115
  try {
114
116
  const result = await app.parse('./tests/fixtures/unspecified-pact.json');
115
117
  assert.ok(isPostmanCollection(result));
116
- } catch(err) {
118
+ } catch (err) {
117
119
  assert.ok(0, 'Should not fail');
118
120
  }
119
121
  });
120
122
 
121
123
  it('should throw an error when pact version is of incorrect format', async () => {
124
+ const app = await getApp();
122
125
  try {
123
126
  await app.parse('./tests/fixtures/invalid-version-pact.json');
124
127
  assert.ok(0, 'Should not resolve');
125
- } catch(err) {
128
+ } catch (err) {
126
129
  assert.ok(err.message.indexOf('Invalid pact-parser version supplied') !== -1);
127
130
  }
128
131
  });
129
- });
132
+ });
@@ -1,9 +1,8 @@
1
- const assert = require('chai').assert;
2
- const sinon = require('sinon');
3
- const PactParser = require('../../../../../app/parsers/2.0.0/pact-parser');
4
-
5
- const simplePactV2Json = require('../../../../fixtures/v2/simple-pact.json');
6
- const multipleInteractionPactV2Json = require('../../../../fixtures/v2/multiple-interaction-pact.json');
1
+ import { it, beforeEach, afterEach, mock, describe } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import PactParser from '../../../../../app/parsers/2.0.0/pact-parser.js';
4
+ import simplePactV2Json from '../../../../fixtures/v2/simple-pact.json' with { type: 'json' };
5
+ import multipleInteractionPactV2Json from '../../../../fixtures/v2/multiple-interaction-pact.json' with { type: 'json' };
7
6
 
8
7
  describe('pmpact > app > parsers > 2.0.0 > pact-parser', () => {
9
8
 
@@ -37,17 +36,17 @@ describe('pmpact > app > parsers > 2.0.0 > pact-parser', () => {
37
36
  });
38
37
 
39
38
  it('should create a list of requests', () => {
40
- var spy = sinon.spy(parser, 'interaction');
39
+ const spy = mock.method(parser, 'interaction');
41
40
  const result = parser.parse(simplePactV2Json);
42
41
  assert.equal(result.item.length, 1);
43
- assert.ok(spy.calledOnce);
42
+ assert.equal(spy.mock.calls.length, 1);
44
43
  });
45
44
 
46
45
  it('should parse several interactions', () => {
47
- var spy = sinon.spy(parser, 'interaction');
46
+ const spy = mock.method(parser, 'interaction')
48
47
  const result = parser.parse(simplePactV2Json);
49
48
  assert.equal(result.item.length, 1);
50
- assert.ok(spy.calledOnce);
49
+ assert.equal(spy.mock.calls.length, 1);
51
50
  });
52
51
 
53
52
  it('should create a request name from the description', () => {
@@ -82,7 +81,7 @@ describe('pmpact > app > parsers > 2.0.0 > pact-parser', () => {
82
81
 
83
82
  it('should create a host', () => {
84
83
  const result = parser.parse(simplePactV2Json);
85
- assert.equal(result.item[0].request.url.host, '{{url}}');
84
+ assert.equal(result.item[0].request.url.host[0], '{{url}}');
86
85
  });
87
86
 
88
87
  it('should create a path', () => {
@@ -123,8 +122,8 @@ describe('pmpact > app > parsers > 2.0.0 > pact-parser', () => {
123
122
  url: {
124
123
  raw: "{{url}}/path1/path2",
125
124
  host: ["{{url}}"],
126
- path: ['path1','path2'],
127
- query: [{key:'p1',value:'p1'},{key:'p2',value:'p2'}],
125
+ path: ['path1', 'path2'],
126
+ query: [{ key: 'p1', value: 'p1' }, { key: 'p2', value: 'p2' }],
128
127
  }
129
128
  },
130
129
  _postman_previewlanguage: "json",
@@ -151,4 +150,4 @@ describe('pmpact > app > parsers > 2.0.0 > pact-parser', () => {
151
150
  body: '{"data":1}'
152
151
  }])
153
152
  })
154
- });
153
+ });
@@ -1,8 +1,8 @@
1
- const assert = require('chai').assert;
2
- const PactParserV2 = require('../../../../../app/parsers/2.0.0/pact-parser');
3
- const PactParser = require('../../../../../app/parsers/3.0.0/pact-parser');
4
-
5
- const simplePactV3Json = require('../../../../fixtures/v3/simple-pact.json');
1
+ import { it, beforeEach, afterEach, describe } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import PactParserV2 from '../../../../../app/parsers/2.0.0/pact-parser.js';
4
+ import PactParser from '../../../../../app/parsers/3.0.0/pact-parser.js';
5
+ import simplePactV3Json from '../../../../fixtures/v3/simple-pact.json' with { type: 'json' };
6
6
 
7
7
  describe('pmpact > app > parsers > 3.0.0 > pact-parser', () => {
8
8
 
@@ -21,8 +21,8 @@ describe('pmpact > app > parsers > 3.0.0 > pact-parser', () => {
21
21
  });
22
22
 
23
23
  it('should extends a parser version 2.0.0', () => {
24
- assert.instanceOf(parser, PactParserV2);
25
- assert.deepEqual(Object.getOwnPropertyNames(PactParser.prototype), [ 'constructor', 'query' ]);
24
+ assert.ok(parser instanceof PactParserV2);
25
+ assert.deepEqual(Object.getOwnPropertyNames(PactParser.prototype), ['constructor', 'query']);
26
26
  });
27
27
 
28
28
  it('should parse a pact source', () => {
@@ -48,4 +48,4 @@ describe('pmpact > app > parsers > 3.0.0 > pact-parser', () => {
48
48
  ]);
49
49
  });
50
50
 
51
- });
51
+ });
@@ -1,16 +1,20 @@
1
- const assert = require('chai').assert;
2
- const sinon = require('sinon');
3
- const proxyquire = require('proxyquire').noCallThru();
1
+ import { it, beforeEach, afterEach, describe, mock } from 'node:test';
2
+ import assert from 'node:assert/strict';
4
3
 
5
- describe('pmpact', () => {
4
+ import { createRequire } from 'module';
5
+ const require = createRequire(import.meta.url);
6
+ const proxyquire = require('proxyquire');
7
+ import packageJson from '../../package.json' with { type: 'json' };
6
8
 
9
+ describe('pmpact', () => {
10
+ let pmpact;
7
11
  let commanderStub;
8
12
  let applicationStub;
9
13
  let source;
10
14
  let actionHandler;
11
15
 
12
16
  const requirePmpact = () => {
13
- pmpact = proxyquire('../../pmpact', {
17
+ pmpact = proxyquire('../../pmpact.js', {
14
18
  'commander': commanderStub,
15
19
  './app/app': applicationStub
16
20
  });
@@ -18,26 +22,24 @@ describe('pmpact', () => {
18
22
 
19
23
  beforeEach(() => {
20
24
  source = 'pact.json';
21
- commanderStub = sinon.stub({
22
- version: () => {},
23
- arguments: () => {},
24
- option: () => {},
25
- on: () => {},
26
- parse: () => {},
27
- help: () => {}
28
- });
29
- commanderStub.version.returns(commanderStub);
30
- commanderStub.arguments.returns(commanderStub);
31
- commanderStub.option.returns(commanderStub);
32
- commanderStub.action = (handler) => {
33
- actionHandler = handler;
25
+
26
+ commanderStub = {
27
+ version: mock.fn(() => commanderStub),
28
+ option: mock.fn(() => commanderStub),
29
+ arguments: mock.fn(() => commanderStub),
30
+ on: mock.fn(() => commanderStub),
31
+ parse: mock.fn(() => commanderStub),
32
+ help: mock.fn(() => commanderStub),
33
+ action: (fn) => { actionHandler = fn; },
34
+ rawArgs: []
34
35
  }
35
- applicationStub = function(){};
36
- commanderStub.rawArgs = [];
37
- applicationStub.prototype.parse = sinon.spy();
36
+ applicationStub = function () { };
37
+ applicationStub.prototype.parse = mock.fn(() => Promise.resolve());
38
38
  });
39
39
 
40
+
40
41
  afterEach(() => {
42
+ mock.reset();
41
43
  if (typeof process.exit.restore === 'function') {
42
44
  process.exit.restore();
43
45
  }
@@ -50,51 +52,53 @@ describe('pmpact', () => {
50
52
  commanderStub = undefined;
51
53
  applicationStub = undefined;
52
54
  source = undefined;
53
- originalConsole = undefined;
54
55
  actionHandler = undefined;
55
56
  });
56
57
 
57
58
  it('should set a version', () => {
58
59
  requirePmpact();
59
- assert.ok(commanderStub.version.withArgs(require('../../package.json').version).calledOnce);
60
+ assert.strictEqual(commanderStub.version.mock.calls.length, 1);
61
+ assert.strictEqual(commanderStub.version.mock.calls[0].arguments[0], packageJson.version);
60
62
  });
61
63
 
62
64
  it('should set an argument', () => {
63
65
  requirePmpact();
64
- assert.ok(commanderStub.arguments.withArgs('<file-or-url>').calledOnce);
66
+ assert.strictEqual(commanderStub.arguments.mock.calls.length, 1);
67
+ assert.strictEqual(commanderStub.arguments.mock.calls[0].arguments[0], '<file-or-url>');
65
68
  });
66
69
 
67
70
  it('should set a headers option', () => {
68
71
  requirePmpact();
69
- assert.ok(commanderStub.option.withArgs('-H, --headers <headers>', sinon.match.string).calledOnce);
72
+ assert.strictEqual(commanderStub.option.mock.calls[0].arguments[0], '-H, --headers <headers>');
73
+
70
74
  });
71
75
 
72
76
  it('should set an output option', () => {
73
77
  requirePmpact();
74
- assert.ok(commanderStub.option.withArgs('-o, --output <file>', sinon.match.string).calledOnce);
78
+ assert.strictEqual(commanderStub.option.mock.calls[1].arguments[0], '-o, --output <file>');
75
79
  });
76
80
 
77
81
  it('should display examples', () => {
78
- sinon.stub(console, 'log').callsFake(() => {});
82
+ console.log = mock.fn();
79
83
  requirePmpact();
80
- assert.ok(commanderStub.on.withArgs('--help', sinon.match.func).calledOnce);
81
- const helpHandler = commanderStub.on.withArgs('--help', sinon.match.func).firstCall.args[1];
84
+ const helpCall = commanderStub.on.mock.calls.find(call => call.arguments[0] === '--help');
85
+ assert.ok(helpCall, 'on should be called with --help');
86
+ const helpHandler = helpCall.arguments[1];
82
87
  helpHandler();
83
- assert.ok(console.log.withArgs(' Examples').calledOnce);
88
+ assert.ok(console.log.mock.calls.some(call => call.arguments[0].indexOf('Examples') !== -1), 'Help should display examples');
84
89
  });
85
90
 
86
91
  it('should parse arguments', () => {
87
92
  requirePmpact();
88
- assert.ok(commanderStub.parse.withArgs(sinon.match.array).calledOnce);
93
+ assert.strictEqual(commanderStub.parse.mock.calls[0].arguments[0], process.argv);
89
94
  });
90
95
 
91
96
  it('should display help if called with no arguments', () => {
92
97
  requirePmpact();
93
- assert.ok(commanderStub.help.calledOnce);
98
+ assert.strictEqual(commanderStub.help.mock.calls.length, 1);
94
99
  });
95
100
 
96
101
  it('should parse a source', () => {
97
- sinon.stub(console, 'log').callsFake(() => {});
98
102
  proxyquire('../../pmpact', {
99
103
  'commander': commanderStub,
100
104
  './app/app': applicationStub
@@ -102,14 +106,17 @@ describe('pmpact', () => {
102
106
  commanderStub.headers = 'user headers';
103
107
  commanderStub.output = 'user output';
104
108
  actionHandler(source, commanderStub);
105
- assert.ok(applicationStub.prototype.parse.withArgs(source, 'user headers', 'user output').calledOnce);
109
+ assert.strictEqual(applicationStub.prototype.parse.mock.calls[0].arguments[0], source);
110
+ assert.strictEqual(applicationStub.prototype.parse.mock.calls[0].arguments[1], 'user headers');
111
+ assert.strictEqual(applicationStub.prototype.parse.mock.calls[0].arguments[2], 'user output');
106
112
  });
107
113
 
108
114
  it('should handle errors', () => {
109
- sinon.stub(console, 'error');
110
- sinon.stub(process, 'exit');
115
+ console.error = mock.fn();
116
+ process.exit = mock.fn();
117
+
111
118
  const error = new Error('Something happened');
112
- applicationStub.prototype.parse = function() {
119
+ applicationStub.prototype.parse = function () {
113
120
  throw error;
114
121
  };
115
122
  proxyquire('../../pmpact', {
@@ -117,8 +124,8 @@ describe('pmpact', () => {
117
124
  './app/app': applicationStub
118
125
  });
119
126
  actionHandler(source, commanderStub);
120
- assert.ok(process.exit.withArgs(1).calledOnce);
121
- assert.ok(console.error.withArgs(error).calledOnce);
127
+ assert.strictEqual(console.error.mock.calls[0].arguments[0], error);
128
+ assert.strictEqual(process.exit.mock.calls[0].arguments[0], 1);
122
129
  });
123
130
 
124
131
  });