@redocly/cli 1.2.1 → 1.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.
Files changed (64) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/lib/__mocks__/@redocly/openapi-core.d.ts +1 -0
  3. package/lib/__mocks__/@redocly/openapi-core.js +4 -3
  4. package/lib/__mocks__/utils.d.ts +2 -0
  5. package/lib/__mocks__/utils.js +3 -1
  6. package/lib/__tests__/commands/build-docs.test.js +2 -2
  7. package/lib/__tests__/commands/bundle.test.js +7 -7
  8. package/lib/__tests__/commands/join.test.js +25 -18
  9. package/lib/__tests__/commands/lint.test.js +15 -15
  10. package/lib/__tests__/commands/push-region.test.js +2 -2
  11. package/lib/__tests__/commands/push.test.js +30 -30
  12. package/lib/__tests__/fetch-with-timeout.test.js +2 -2
  13. package/lib/__tests__/utils.test.js +67 -41
  14. package/lib/__tests__/wrapper.test.js +3 -3
  15. package/lib/assert-node-version.js +1 -1
  16. package/lib/commands/build-docs/index.js +9 -9
  17. package/lib/commands/build-docs/types.d.ts +2 -2
  18. package/lib/commands/build-docs/utils.js +10 -10
  19. package/lib/commands/bundle.d.ts +1 -1
  20. package/lib/commands/bundle.js +25 -25
  21. package/lib/commands/join.d.ts +3 -3
  22. package/lib/commands/join.js +49 -48
  23. package/lib/commands/lint.d.ts +1 -1
  24. package/lib/commands/lint.js +27 -23
  25. package/lib/commands/login.d.ts +1 -1
  26. package/lib/commands/login.js +3 -3
  27. package/lib/commands/preview-docs/index.d.ts +1 -1
  28. package/lib/commands/preview-docs/index.js +7 -7
  29. package/lib/commands/preview-docs/preview-server/hot.js +19 -2
  30. package/lib/commands/preview-docs/preview-server/preview-server.js +15 -14
  31. package/lib/commands/preview-docs/preview-server/server.d.ts +3 -1
  32. package/lib/commands/preview-docs/preview-server/server.js +2 -2
  33. package/lib/commands/push.d.ts +2 -2
  34. package/lib/commands/push.js +31 -31
  35. package/lib/commands/split/__tests__/index.test.js +9 -9
  36. package/lib/commands/split/index.d.ts +2 -2
  37. package/lib/commands/split/index.js +41 -40
  38. package/lib/commands/split/types.d.ts +2 -2
  39. package/lib/commands/split/types.js +2 -2
  40. package/lib/commands/stats.d.ts +1 -1
  41. package/lib/commands/stats.js +9 -9
  42. package/lib/fetch-with-timeout.js +5 -2
  43. package/lib/index.js +46 -12
  44. package/lib/types.d.ts +6 -6
  45. package/lib/update-version-notifier.js +18 -18
  46. package/lib/utils.d.ts +6 -3
  47. package/lib/utils.js +69 -40
  48. package/lib/wrapper.js +5 -5
  49. package/package.json +3 -3
  50. package/src/__mocks__/@redocly/openapi-core.ts +1 -0
  51. package/src/__mocks__/utils.ts +2 -0
  52. package/src/__tests__/commands/join.test.ts +37 -7
  53. package/src/__tests__/utils.test.ts +49 -13
  54. package/src/commands/join.ts +10 -4
  55. package/src/commands/lint.ts +6 -1
  56. package/src/commands/preview-docs/preview-server/hot.js +19 -2
  57. package/src/commands/preview-docs/preview-server/preview-server.ts +6 -4
  58. package/src/commands/preview-docs/preview-server/server.ts +2 -2
  59. package/src/commands/split/__tests__/index.test.ts +14 -5
  60. package/src/commands/split/index.ts +25 -17
  61. package/src/fetch-with-timeout.ts +3 -0
  62. package/src/index.ts +35 -1
  63. package/src/utils.ts +45 -9
  64. package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @redocly/cli
2
2
 
3
+ ## 1.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Added `recommended-strict` ruleset which uses the same rules as `recommended` but with the severity level set to `error` for all rules.
8
+ - Add JSON output support to the `split` and `join` commands.
9
+
10
+ ### Patch Changes
11
+
12
+ - The `--host/-h` argument in the `preview-docs` command is now also used by the WebSocket server for hot reloading.
13
+ - Updated @redocly/openapi-core to v1.4.0.
14
+
15
+ ## 1.3.0
16
+
17
+ ### Minor Changes
18
+
19
+ - Added the possibility to configure the linting severity level of the configuration file for all CLI commands.
20
+ Redocly CLI will exit with an error if there are any issues with the configuration file, and the severity is set to `error`.
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated @redocly/openapi-core to v1.3.0.
25
+
3
26
  ## 1.2.1
4
27
 
5
28
  ### Patch Changes
@@ -63,6 +63,7 @@ export declare const bundleDocument: jest.Mock<Promise<{
63
63
  }>, []>;
64
64
  export declare const detectSpec: jest.Mock<any, any>;
65
65
  export declare const isAbsoluteUrl: jest.Mock<any, any>;
66
+ export declare const stringifyYaml: jest.Mock<any, [data: any]>;
66
67
  export declare class BaseResolver {
67
68
  cache: Map<string, Promise<Document | ResolveError>>;
68
69
  getFiles: jest.Mock<any, any>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Oas3Operations = exports.SpecVersion = exports.YamlParseError = exports.ResolveError = exports.BaseResolver = exports.isAbsoluteUrl = exports.detectSpec = exports.bundleDocument = exports.doesYamlFileExist = exports.findConfig = exports.slash = exports.formatProblems = exports.getTotals = exports.bundle = exports.lint = exports.getMergedConfig = exports.loadConfig = exports.RedoclyClient = exports.__redoclyClient = void 0;
3
+ exports.Oas3Operations = exports.SpecVersion = exports.YamlParseError = exports.ResolveError = exports.BaseResolver = exports.stringifyYaml = exports.isAbsoluteUrl = exports.detectSpec = exports.bundleDocument = exports.doesYamlFileExist = exports.findConfig = exports.slash = exports.formatProblems = exports.getTotals = exports.bundle = exports.lint = exports.getMergedConfig = exports.loadConfig = exports.RedoclyClient = exports.__redoclyClient = void 0;
4
4
  const config_1 = require("./../../__tests__/fixtures/config");
5
5
  const documents_1 = require("../documents");
6
6
  exports.__redoclyClient = {
@@ -30,6 +30,7 @@ exports.doesYamlFileExist = jest.fn();
30
30
  exports.bundleDocument = jest.fn(() => Promise.resolve({ problems: {} }));
31
31
  exports.detectSpec = jest.fn();
32
32
  exports.isAbsoluteUrl = jest.fn();
33
+ exports.stringifyYaml = jest.fn((data) => data);
33
34
  class BaseResolver {
34
35
  constructor() {
35
36
  this.cache = new Map();
@@ -66,7 +67,7 @@ var SpecVersion;
66
67
  SpecVersion["OAS3_0"] = "oas3_0";
67
68
  SpecVersion["OAS3_1"] = "oas3_1";
68
69
  SpecVersion["Async2"] = "async2";
69
- })(SpecVersion = exports.SpecVersion || (exports.SpecVersion = {}));
70
+ })(SpecVersion || (exports.SpecVersion = SpecVersion = {}));
70
71
  var Oas3Operations;
71
72
  (function (Oas3Operations) {
72
73
  Oas3Operations["get"] = "get";
@@ -77,4 +78,4 @@ var Oas3Operations;
77
78
  Oas3Operations["head"] = "head";
78
79
  Oas3Operations["patch"] = "patch";
79
80
  Oas3Operations["trace"] = "trace";
80
- })(Oas3Operations = exports.Oas3Operations || (exports.Oas3Operations = {}));
81
+ })(Oas3Operations || (exports.Oas3Operations = Oas3Operations = {}));
@@ -37,3 +37,5 @@ export declare const loadConfigAndHandleErrors: jest.Mock<{
37
37
  }, []>;
38
38
  export declare const checkIfRulesetExist: jest.Mock<any, any>;
39
39
  export declare const sortTopLevelKeysForOas: jest.Mock<any, [document: any]>;
40
+ export declare const getAndValidateFileExtension: jest.Mock<string | undefined, [fileName: string]>;
41
+ export declare const writeToFileByExtension: jest.Mock<any, any>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sortTopLevelKeysForOas = exports.checkIfRulesetExist = exports.loadConfigAndHandleErrors = exports.writeYaml = exports.exitWithError = exports.handleError = exports.getOutputFileName = exports.printLintTotals = exports.printUnusedWarnings = exports.printExecutionTime = exports.getExecutionTime = exports.pluralize = exports.slash = exports.dumpBundle = exports.getFallbackApisOrExit = void 0;
3
+ exports.writeToFileByExtension = exports.getAndValidateFileExtension = exports.sortTopLevelKeysForOas = exports.checkIfRulesetExist = exports.loadConfigAndHandleErrors = exports.writeYaml = exports.exitWithError = exports.handleError = exports.getOutputFileName = exports.printLintTotals = exports.printUnusedWarnings = exports.printExecutionTime = exports.getExecutionTime = exports.pluralize = exports.slash = exports.dumpBundle = exports.getFallbackApisOrExit = void 0;
4
4
  const config_1 = require("../__tests__/fixtures/config");
5
5
  exports.getFallbackApisOrExit = jest.fn((entrypoints) => entrypoints.map((path) => ({ path })));
6
6
  exports.dumpBundle = jest.fn(() => '');
@@ -17,3 +17,5 @@ exports.writeYaml = jest.fn();
17
17
  exports.loadConfigAndHandleErrors = jest.fn(() => config_1.ConfigFixture);
18
18
  exports.checkIfRulesetExist = jest.fn();
19
19
  exports.sortTopLevelKeysForOas = jest.fn((document) => document);
20
+ exports.getAndValidateFileExtension = jest.fn((fileName) => fileName.split('.').pop());
21
+ exports.writeToFileByExtension = jest.fn();
@@ -33,14 +33,14 @@ jest.mock('handlebars', () => ({
33
33
  }));
34
34
  describe('build-docs', () => {
35
35
  it('should return correct html and call function for ssr', () => __awaiter(void 0, void 0, void 0, function* () {
36
- const result = yield utils_1.getPageHTML({}, '../some-path/openapi.yaml', Object.assign(Object.assign({}, config), { redocCurrentVersion: '2.0.0' }));
36
+ const result = yield (0, utils_1.getPageHTML)({}, '../some-path/openapi.yaml', Object.assign(Object.assign({}, config), { redocCurrentVersion: '2.0.0' }));
37
37
  expect(server_1.renderToString).toBeCalledTimes(1);
38
38
  expect(redoc_1.createStore).toBeCalledTimes(1);
39
39
  expect(result).toBe('<html></html>');
40
40
  }));
41
41
  it('should work correctly when calling handlerBuildCommand', () => __awaiter(void 0, void 0, void 0, function* () {
42
42
  const processExitMock = jest.spyOn(process, 'exit').mockImplementation();
43
- yield build_docs_1.handlerBuildCommand({
43
+ yield (0, build_docs_1.handlerBuildCommand)({
44
44
  o: '',
45
45
  title: 'test',
46
46
  disableGoogleFont: false,
@@ -34,7 +34,7 @@ describe('bundle', () => {
34
34
  });
35
35
  it('bundles definitions w/o linting', () => __awaiter(void 0, void 0, void 0, function* () {
36
36
  const apis = ['foo.yaml', 'bar.yaml'];
37
- yield wrapper_1.commandWrapper(bundle_1.handleBundle)({
37
+ yield (0, wrapper_1.commandWrapper)(bundle_1.handleBundle)({
38
38
  apis,
39
39
  ext: 'yaml',
40
40
  format: 'codeframe',
@@ -44,7 +44,7 @@ describe('bundle', () => {
44
44
  }));
45
45
  it('exits with code 0 when bundles definitions', () => __awaiter(void 0, void 0, void 0, function* () {
46
46
  const apis = ['foo.yaml', 'bar.yaml', 'foobar.yaml'];
47
- yield wrapper_1.commandWrapper(bundle_1.handleBundle)({
47
+ yield (0, wrapper_1.commandWrapper)(bundle_1.handleBundle)({
48
48
  apis,
49
49
  ext: 'yaml',
50
50
  format: 'codeframe',
@@ -59,7 +59,7 @@ describe('bundle', () => {
59
59
  warnings: 0,
60
60
  ignored: 0,
61
61
  });
62
- yield wrapper_1.commandWrapper(bundle_1.handleBundle)({
62
+ yield (0, wrapper_1.commandWrapper)(bundle_1.handleBundle)({
63
63
  apis,
64
64
  ext: 'yaml',
65
65
  format: 'codeframe',
@@ -70,7 +70,7 @@ describe('bundle', () => {
70
70
  }));
71
71
  it('exits with code 0 when bundles definitions w/linting w/o errors', () => __awaiter(void 0, void 0, void 0, function* () {
72
72
  const apis = ['foo.yaml', 'bar.yaml', 'foobar.yaml'];
73
- yield wrapper_1.commandWrapper(bundle_1.handleBundle)({
73
+ yield (0, wrapper_1.commandWrapper)(bundle_1.handleBundle)({
74
74
  apis,
75
75
  ext: 'yaml',
76
76
  format: 'codeframe',
@@ -86,7 +86,7 @@ describe('bundle', () => {
86
86
  warnings: 0,
87
87
  ignored: 0,
88
88
  });
89
- yield wrapper_1.commandWrapper(bundle_1.handleBundle)({
89
+ yield (0, wrapper_1.commandWrapper)(bundle_1.handleBundle)({
90
90
  apis,
91
91
  ext: 'yaml',
92
92
  format: 'codeframe',
@@ -101,7 +101,7 @@ describe('bundle', () => {
101
101
  openapi_core_1.bundle.mockImplementationOnce(() => {
102
102
  throw new Error('Invalid definition');
103
103
  });
104
- yield wrapper_1.commandWrapper(bundle_1.handleBundle)({
104
+ yield (0, wrapper_1.commandWrapper)(bundle_1.handleBundle)({
105
105
  apis,
106
106
  ext: 'json',
107
107
  format: 'codeframe',
@@ -117,7 +117,7 @@ describe('bundle', () => {
117
117
  warnings: 0,
118
118
  ignored: 0,
119
119
  });
120
- yield wrapper_1.commandWrapper(bundle_1.handleBundle)({
120
+ yield (0, wrapper_1.commandWrapper)(bundle_1.handleBundle)({
121
121
  apis,
122
122
  ext: 'yaml',
123
123
  format: 'codeframe',
@@ -21,11 +21,11 @@ describe('handleJoin fails', () => {
21
21
  const colloreteYellowMock = colorette_1.yellow;
22
22
  colloreteYellowMock.mockImplementation((string) => string);
23
23
  it('should call exitWithError because only one entrypoint', () => __awaiter(void 0, void 0, void 0, function* () {
24
- yield join_1.handleJoin({ apis: ['first.yaml'] }, {}, 'cli-version');
24
+ yield (0, join_1.handleJoin)({ apis: ['first.yaml'] }, {}, 'cli-version');
25
25
  expect(utils_1.exitWithError).toHaveBeenCalledWith(`At least 2 apis should be provided. \n\n`);
26
26
  }));
27
27
  it('should call exitWithError because passed all 3 options for tags', () => __awaiter(void 0, void 0, void 0, function* () {
28
- yield join_1.handleJoin({
28
+ yield (0, join_1.handleJoin)({
29
29
  apis: ['first.yaml', 'second.yaml'],
30
30
  'prefix-tags-with-info-prop': 'something',
31
31
  'without-x-tag-groups': true,
@@ -34,7 +34,7 @@ describe('handleJoin fails', () => {
34
34
  expect(utils_1.exitWithError).toHaveBeenCalledWith(`You use prefix-tags-with-filename, prefix-tags-with-info-prop, without-x-tag-groups together.\nPlease choose only one! \n\n`);
35
35
  }));
36
36
  it('should call exitWithError because passed all 2 options for tags', () => __awaiter(void 0, void 0, void 0, function* () {
37
- yield join_1.handleJoin({
37
+ yield (0, join_1.handleJoin)({
38
38
  apis: ['first.yaml', 'second.yaml'],
39
39
  'without-x-tag-groups': true,
40
40
  'prefix-tags-with-filename': true,
@@ -42,7 +42,7 @@ describe('handleJoin fails', () => {
42
42
  expect(utils_1.exitWithError).toHaveBeenCalledWith(`You use prefix-tags-with-filename, without-x-tag-groups together.\nPlease choose only one! \n\n`);
43
43
  }));
44
44
  it('should call exitWithError because Only OpenAPI 3.0 and OpenAPI 3.1 are supported', () => __awaiter(void 0, void 0, void 0, function* () {
45
- yield join_1.handleJoin({
45
+ yield (0, join_1.handleJoin)({
46
46
  apis: ['first.yaml', 'second.yaml'],
47
47
  }, config_1.ConfigFixture, 'cli-version');
48
48
  expect(utils_1.exitWithError).toHaveBeenCalledWith('Only OpenAPI 3.0 and OpenAPI 3.1 are supported: undefined \n\n');
@@ -51,50 +51,57 @@ describe('handleJoin fails', () => {
51
51
  openapi_core_1.detectSpec
52
52
  .mockImplementationOnce(() => 'oas3_0')
53
53
  .mockImplementationOnce(() => 'oas3_1');
54
- yield join_1.handleJoin({
54
+ yield (0, join_1.handleJoin)({
55
55
  apis: ['first.yaml', 'second.yaml'],
56
56
  }, config_1.ConfigFixture, 'cli-version');
57
57
  expect(utils_1.exitWithError).toHaveBeenCalledWith('All APIs must use the same OpenAPI version: undefined \n\n');
58
58
  }));
59
- it('should call writeYaml function', () => __awaiter(void 0, void 0, void 0, function* () {
59
+ it('should call writeToFileByExtension function', () => __awaiter(void 0, void 0, void 0, function* () {
60
60
  openapi_core_1.detectSpec.mockReturnValue('oas3_0');
61
- yield join_1.handleJoin({
61
+ yield (0, join_1.handleJoin)({
62
62
  apis: ['first.yaml', 'second.yaml'],
63
63
  }, config_1.ConfigFixture, 'cli-version');
64
- expect(utils_1.writeYaml).toHaveBeenCalledWith(expect.any(Object), 'openapi.yaml', expect.any(Boolean));
64
+ expect(utils_1.writeToFileByExtension).toHaveBeenCalledWith(expect.any(Object), 'openapi.yaml', expect.any(Boolean));
65
65
  }));
66
- it('should call writeYaml function for OpenAPI 3.1', () => __awaiter(void 0, void 0, void 0, function* () {
66
+ it('should call writeToFileByExtension function for OpenAPI 3.1', () => __awaiter(void 0, void 0, void 0, function* () {
67
67
  openapi_core_1.detectSpec.mockReturnValue('oas3_1');
68
- yield join_1.handleJoin({
68
+ yield (0, join_1.handleJoin)({
69
69
  apis: ['first.yaml', 'second.yaml'],
70
70
  }, config_1.ConfigFixture, 'cli-version');
71
- expect(utils_1.writeYaml).toHaveBeenCalledWith(expect.any(Object), 'openapi.yaml', expect.any(Boolean));
71
+ expect(utils_1.writeToFileByExtension).toHaveBeenCalledWith(expect.any(Object), 'openapi.yaml', expect.any(Boolean));
72
72
  }));
73
- it('should call writeYaml function with custom output file', () => __awaiter(void 0, void 0, void 0, function* () {
73
+ it('should call writeToFileByExtension function with custom output file', () => __awaiter(void 0, void 0, void 0, function* () {
74
74
  openapi_core_1.detectSpec.mockReturnValue('oas3_0');
75
- yield join_1.handleJoin({
75
+ yield (0, join_1.handleJoin)({
76
76
  apis: ['first.yaml', 'second.yaml'],
77
77
  output: 'output.yml',
78
78
  }, config_1.ConfigFixture, 'cli-version');
79
- expect(utils_1.writeYaml).toHaveBeenCalledWith(expect.any(Object), 'output.yml', expect.any(Boolean));
79
+ expect(utils_1.writeToFileByExtension).toHaveBeenCalledWith(expect.any(Object), 'output.yml', expect.any(Boolean));
80
+ }));
81
+ it('should call writeToFileByExtension function with json file extension', () => __awaiter(void 0, void 0, void 0, function* () {
82
+ openapi_core_1.detectSpec.mockReturnValue('oas3_0');
83
+ yield (0, join_1.handleJoin)({
84
+ apis: ['first.json', 'second.yaml'],
85
+ }, config_1.ConfigFixture, 'cli-version');
86
+ expect(utils_1.writeToFileByExtension).toHaveBeenCalledWith(expect.any(Object), 'openapi.json', expect.any(Boolean));
80
87
  }));
81
88
  it('should call skipDecorators and skipPreprocessors', () => __awaiter(void 0, void 0, void 0, function* () {
82
89
  openapi_core_1.detectSpec.mockReturnValue('oas3_0');
83
- yield join_1.handleJoin({
90
+ yield (0, join_1.handleJoin)({
84
91
  apis: ['first.yaml', 'second.yaml'],
85
92
  }, config_1.ConfigFixture, 'cli-version');
86
- const config = openapi_core_2.loadConfig();
93
+ const config = (0, openapi_core_2.loadConfig)();
87
94
  expect(config.styleguide.skipDecorators).toHaveBeenCalled();
88
95
  expect(config.styleguide.skipPreprocessors).toHaveBeenCalled();
89
96
  }));
90
97
  it('should not call skipDecorators and skipPreprocessors', () => __awaiter(void 0, void 0, void 0, function* () {
91
98
  openapi_core_1.detectSpec.mockReturnValue('oas3_0');
92
- yield join_1.handleJoin({
99
+ yield (0, join_1.handleJoin)({
93
100
  apis: ['first.yaml', 'second.yaml'],
94
101
  decorate: true,
95
102
  preprocess: true,
96
103
  }, config_1.ConfigFixture, 'cli-version');
97
- const config = openapi_core_2.loadConfig();
104
+ const config = (0, openapi_core_2.loadConfig)();
98
105
  expect(config.styleguide.skipDecorators).not.toHaveBeenCalled();
99
106
  expect(config.styleguide.skipPreprocessors).not.toHaveBeenCalled();
100
107
  }));
@@ -47,11 +47,11 @@ describe('handleLint', () => {
47
47
  });
48
48
  describe('loadConfig and getEnrtypoints stage', () => {
49
49
  it('should fail if config file does not exist', () => __awaiter(void 0, void 0, void 0, function* () {
50
- yield wrapper_1.commandWrapper(lint_1.handleLint)(Object.assign(Object.assign({}, argvMock), { config: 'config.yaml' }));
50
+ yield (0, wrapper_1.commandWrapper)(lint_1.handleLint)(Object.assign(Object.assign({}, argvMock), { config: 'config.yaml' }));
51
51
  expect(utils_1.exitWithError).toHaveBeenCalledWith('Please, provide valid path to the configuration file');
52
52
  }));
53
53
  it('should call loadConfigAndHandleErrors and getFallbackApisOrExit', () => __awaiter(void 0, void 0, void 0, function* () {
54
- yield wrapper_1.commandWrapper(lint_1.handleLint)(argvMock);
54
+ yield (0, wrapper_1.commandWrapper)(lint_1.handleLint)(argvMock);
55
55
  expect(utils_1.loadConfigAndHandleErrors).toHaveBeenCalledWith({
56
56
  configPath: undefined,
57
57
  customExtends: undefined,
@@ -60,7 +60,7 @@ describe('handleLint', () => {
60
60
  expect(utils_1.getFallbackApisOrExit).toHaveBeenCalled();
61
61
  }));
62
62
  it('should call loadConfig with args if such exist', () => __awaiter(void 0, void 0, void 0, function* () {
63
- yield wrapper_1.commandWrapper(lint_1.handleLint)(Object.assign(Object.assign({}, argvMock), { config: 'redocly.yaml', extends: ['some/path'] }));
63
+ yield (0, wrapper_1.commandWrapper)(lint_1.handleLint)(Object.assign(Object.assign({}, argvMock), { config: 'redocly.yaml', extends: ['some/path'] }));
64
64
  expect(utils_1.loadConfigAndHandleErrors).toHaveBeenCalledWith({
65
65
  configPath: 'redocly.yaml',
66
66
  customExtends: ['some/path'],
@@ -68,35 +68,35 @@ describe('handleLint', () => {
68
68
  });
69
69
  }));
70
70
  it('should call mergedConfig with clear ignore if `generate-ignore-file` argv', () => __awaiter(void 0, void 0, void 0, function* () {
71
- yield wrapper_1.commandWrapper(lint_1.handleLint)(Object.assign(Object.assign({}, argvMock), { 'generate-ignore-file': true }));
71
+ yield (0, wrapper_1.commandWrapper)(lint_1.handleLint)(Object.assign(Object.assign({}, argvMock), { 'generate-ignore-file': true }));
72
72
  expect(getMergedConfigMock).toHaveBeenCalled();
73
73
  }));
74
74
  it('should check if ruleset exist', () => __awaiter(void 0, void 0, void 0, function* () {
75
- yield wrapper_1.commandWrapper(lint_1.handleLint)(argvMock);
75
+ yield (0, wrapper_1.commandWrapper)(lint_1.handleLint)(argvMock);
76
76
  expect(utils_1.checkIfRulesetExist).toHaveBeenCalledTimes(1);
77
77
  }));
78
78
  it('should fail if apis not provided', () => __awaiter(void 0, void 0, void 0, function* () {
79
- yield wrapper_1.commandWrapper(lint_1.handleLint)(Object.assign(Object.assign({}, argvMock), { apis: [] }));
79
+ yield (0, wrapper_1.commandWrapper)(lint_1.handleLint)(Object.assign(Object.assign({}, argvMock), { apis: [] }));
80
80
  expect(utils_1.getFallbackApisOrExit).toHaveBeenCalledTimes(1);
81
81
  expect(utils_1.exitWithError).toHaveBeenCalledWith('No APIs were provided');
82
82
  }));
83
83
  });
84
84
  describe('loop through entrypoints and lint stage', () => {
85
85
  it('should call getMergedConfig and lint ', () => __awaiter(void 0, void 0, void 0, function* () {
86
- yield wrapper_1.commandWrapper(lint_1.handleLint)(argvMock);
86
+ yield (0, wrapper_1.commandWrapper)(lint_1.handleLint)(argvMock);
87
87
  expect(perf_hooks_1.performance.now).toHaveBeenCalled();
88
88
  expect(getMergedConfigMock).toHaveBeenCalled();
89
89
  expect(openapi_core_1.lint).toHaveBeenCalled();
90
90
  }));
91
91
  it('should call skipRules,skipPreprocessors and addIgnore with argv', () => __awaiter(void 0, void 0, void 0, function* () {
92
92
  openapi_core_1.lint.mockResolvedValueOnce(['problem']);
93
- yield wrapper_1.commandWrapper(lint_1.handleLint)(Object.assign(Object.assign({}, argvMock), { 'skip-preprocessor': ['preprocessor'], 'skip-rule': ['rule'], 'generate-ignore-file': true }));
93
+ yield (0, wrapper_1.commandWrapper)(lint_1.handleLint)(Object.assign(Object.assign({}, argvMock), { 'skip-preprocessor': ['preprocessor'], 'skip-rule': ['rule'], 'generate-ignore-file': true }));
94
94
  expect(config_1.ConfigFixture.styleguide.skipRules).toHaveBeenCalledWith(['rule']);
95
95
  expect(config_1.ConfigFixture.styleguide.skipPreprocessors).toHaveBeenCalledWith(['preprocessor']);
96
96
  }));
97
97
  it('should call formatProblems and getExecutionTime with argv', () => __awaiter(void 0, void 0, void 0, function* () {
98
98
  openapi_core_1.lint.mockResolvedValueOnce(['problem']);
99
- yield wrapper_1.commandWrapper(lint_1.handleLint)(Object.assign(Object.assign({}, argvMock), { 'max-problems': 2, format: 'stylish' }));
99
+ yield (0, wrapper_1.commandWrapper)(lint_1.handleLint)(Object.assign(Object.assign({}, argvMock), { 'max-problems': 2, format: 'stylish' }));
100
100
  expect(openapi_core_1.getTotals).toHaveBeenCalledWith(['problem']);
101
101
  expect(openapi_core_1.formatProblems).toHaveBeenCalledWith(['problem'], {
102
102
  format: 'stylish',
@@ -108,26 +108,26 @@ describe('handleLint', () => {
108
108
  }));
109
109
  it('should catch error in handleError if something fails', () => __awaiter(void 0, void 0, void 0, function* () {
110
110
  openapi_core_1.lint.mockRejectedValueOnce('error');
111
- yield wrapper_1.commandWrapper(lint_1.handleLint)(argvMock);
111
+ yield (0, wrapper_1.commandWrapper)(lint_1.handleLint)(argvMock);
112
112
  expect(utils_1.handleError).toHaveBeenCalledWith('error', 'openapi.yaml');
113
113
  }));
114
114
  });
115
115
  describe('erros and warning handle after lint stage', () => {
116
116
  it('should call printLintTotals and printLintTotals', () => __awaiter(void 0, void 0, void 0, function* () {
117
- yield wrapper_1.commandWrapper(lint_1.handleLint)(argvMock);
117
+ yield (0, wrapper_1.commandWrapper)(lint_1.handleLint)(argvMock);
118
118
  expect(utils_1.printUnusedWarnings).toHaveBeenCalled();
119
119
  }));
120
120
  it('should call exit with 0 if no errors', () => __awaiter(void 0, void 0, void 0, function* () {
121
121
  utils_1.loadConfigAndHandleErrors.mockImplementation(() => {
122
122
  return Object.assign({}, config_1.ConfigFixture);
123
123
  });
124
- yield wrapper_1.commandWrapper(lint_1.handleLint)(argvMock);
124
+ yield (0, wrapper_1.commandWrapper)(lint_1.handleLint)(argvMock);
125
125
  yield (exitCb === null || exitCb === void 0 ? void 0 : exitCb());
126
126
  expect(processExitMock).toHaveBeenCalledWith(0);
127
127
  }));
128
128
  it('should exit with 1 if total errors > 0', () => __awaiter(void 0, void 0, void 0, function* () {
129
129
  openapi_core_1.getTotals.mockReturnValueOnce({ errors: 1 });
130
- yield wrapper_1.commandWrapper(lint_1.handleLint)(argvMock);
130
+ yield (0, wrapper_1.commandWrapper)(lint_1.handleLint)(argvMock);
131
131
  yield (exitCb === null || exitCb === void 0 ? void 0 : exitCb());
132
132
  expect(processExitMock).toHaveBeenCalledWith(1);
133
133
  }));
@@ -142,8 +142,8 @@ describe('handleLint', () => {
142
142
  },
143
143
  };
144
144
  });
145
- yield wrapper_1.commandWrapper(lint_1.handleLint)(argvMock);
146
- expect(process.stderr.write).toHaveBeenCalledWith(`No configurations were provided -- using built in ${colorette_1.blue('recommended')} configuration by default.\n\n`);
145
+ yield (0, wrapper_1.commandWrapper)(lint_1.handleLint)(argvMock);
146
+ expect(process.stderr.write).toHaveBeenCalledWith(`No configurations were provided -- using built in ${(0, colorette_1.blue)('recommended')} configuration by default.\n\n`);
147
147
  }));
148
148
  });
149
149
  });
@@ -33,7 +33,7 @@ describe('push-with-region', () => {
33
33
  });
34
34
  it('should call login with default domain when region is US', () => __awaiter(void 0, void 0, void 0, function* () {
35
35
  redoclyClient.domain = 'redoc.ly';
36
- yield push_1.handlePush({
36
+ yield (0, push_1.handlePush)({
37
37
  upsert: true,
38
38
  api: 'spec.json',
39
39
  destination: '@org/my-api@1.0.0',
@@ -44,7 +44,7 @@ describe('push-with-region', () => {
44
44
  }));
45
45
  it('should call login with EU domain when region is EU', () => __awaiter(void 0, void 0, void 0, function* () {
46
46
  redoclyClient.domain = 'eu.redocly.com';
47
- yield push_1.handlePush({
47
+ yield (0, push_1.handlePush)({
48
48
  upsert: true,
49
49
  api: 'spec.json',
50
50
  destination: '@org/my-api@1.0.0',