@contrast/cli 1.41.1 → 1.41.3

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/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@contrast/cli",
3
- "version": "1.41.1",
3
+ "version": "1.41.3",
4
4
  "description": "A collection of agent related CLI utilities",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
7
7
  "files": [
8
- "lib/"
8
+ "lib/",
9
+ "!*.test.*",
10
+ "!tsconfig.*",
11
+ "!*.map"
9
12
  ],
10
13
  "bin": {
11
14
  "config-diagnostics": "lib/config-diagnostics.js",
@@ -21,14 +24,14 @@
21
24
  },
22
25
  "dependencies": {
23
26
  "@contrast/find-package-json": "^1.1.0",
24
- "@contrast/rewriter": "1.21.1",
27
+ "@contrast/rewriter": "1.21.3",
25
28
  "@contrast/common": "1.29.1",
26
- "@contrast/config": "1.40.1",
27
- "@contrast/core": "1.45.1",
28
- "@contrast/logger": "1.18.1",
29
+ "@contrast/config": "1.40.2",
30
+ "@contrast/core": "1.45.2",
31
+ "@contrast/logger": "1.18.2",
29
32
  "@contrast/perf": "1.3.1",
30
- "@contrast/reporter": "1.41.1",
31
- "@contrast/scopes": "1.15.1",
33
+ "@contrast/reporter": "1.41.2",
34
+ "@contrast/scopes": "1.15.2",
32
35
  "@swc/core": "1.5.29",
33
36
  "commander": "^9.4.1"
34
37
  }
@@ -1,47 +0,0 @@
1
- 'use strict';
2
-
3
- const sinon = require('sinon');
4
- const proxyquire = require('proxyquire');
5
- const { expect } = require('chai');
6
- const mocks = require('@contrast/test/mocks');
7
-
8
- describe('config-diagnostics.js', function () {
9
- let mockFs, config, reporter, action;
10
-
11
- beforeEach(function () {
12
- mockFs = {
13
- writeFileSync: sinon.stub()
14
- };
15
- config = mocks.config();
16
- config.getReport.returns({ Config: {} });
17
- reporter = mocks.installable();
18
- action = proxyquire('./config-diagnostics', {
19
- '@contrast/config': (core) => core.config = config,
20
- '@contrast/logger': { default: (core) => core.logger = mocks.logger() },
21
- '@contrast/reporter': { default: (core) => core.reporter = reporter },
22
- fs: mockFs
23
- }).action;
24
- });
25
-
26
- it('writes report to disc and stdout with options -o provided and -q omitted', async function () {
27
- const opts = { quiet: false, output: 'eff-conf.json' };
28
-
29
- await action('index.js', opts);
30
-
31
- const stdoutContent = mockFs.writeFileSync.getCalls()[0].args[1];
32
- const fileContent = mockFs.writeFileSync.getCalls()[1].args[1];
33
- const data = JSON.parse(stdoutContent);
34
- const { Config } = config.getReport.getCall(0).returnValue;
35
-
36
- expect(reporter.install).to.have.been.called;
37
- expect(mockFs.writeFileSync).to.have.been.calledWith(1);
38
- expect(mockFs.writeFileSync).to.have.been.calledWith(sinon.match(opts.output));
39
- expect(stdoutContent).to.equal(fileContent);
40
- expect(data.Config).to.deep.equal(Config);
41
- });
42
-
43
- it('does not write to file or stdout with -q provided and -o omitted', async function () {
44
- await action('index.js', { quiet: true, output: undefined });
45
- expect(mockFs.writeFileSync).not.to.have.been.called;
46
- });
47
- });
@@ -1,42 +0,0 @@
1
- 'use strict';
2
-
3
- const sinon = require('sinon');
4
- const proxyquire = require('proxyquire');
5
- const { expect } = require('chai');
6
- const mocks = require('@contrast/test/mocks');
7
-
8
- describe('system-diagnostics.js', function () {
9
- let mockFs, getSystemInfo, action;
10
-
11
- beforeEach(function () {
12
- mockFs = {
13
- writeFileSync: sinon.stub()
14
- };
15
- getSystemInfo = sinon.stub().returns({});
16
- action = proxyquire('./system-diagnostics', {
17
- '@contrast/config': (core) => core.config = mocks.config(),
18
- '@contrast/logger': { default: (core) => core.logger = mocks.logger() },
19
- '@contrast/core/lib/system-info': (core) => core.getSystemInfo = getSystemInfo,
20
- fs: mockFs
21
- }).action;
22
- });
23
-
24
- it('writes report to disc and stdout with options -o provided and -q omitted', async function () {
25
- const opts = { quiet: false, output: 'sys-info.json' };
26
- await action(opts);
27
-
28
- const stdoutContent = mockFs.writeFileSync.getCalls()[0].args[1];
29
- const fileContent = mockFs.writeFileSync.getCalls()[1].args[1];
30
- const data = JSON.parse(stdoutContent);
31
-
32
- expect(mockFs.writeFileSync).to.have.been.calledWith(1);
33
- expect(mockFs.writeFileSync).to.have.been.calledWith(sinon.match(opts.output));
34
- expect(stdoutContent).to.equal(fileContent);
35
- expect(data).to.deep.equal(getSystemInfo.getCall(0).returnValue);
36
- });
37
-
38
- it('does not write to file or stdout with -q provided and -o omitted', async function () {
39
- await action({ quiet: true, output: undefined });
40
- expect(mockFs.writeFileSync).not.to.have.been.called;
41
- });
42
- });