@oclif/test 2.0.0 → 2.1.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/CHANGELOG.md CHANGED
@@ -2,21 +2,49 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
- ## [2.0.0](https://github.com/oclif/test/compare/v1.2.8...v2.0.0) (2021-08-06)
5
+ ## [2.1.0](https://github.com/oclif/test/compare/v2.0.3...v2.1.0) (2022-02-10)
6
+
7
+
8
+ ### Features
9
+
10
+ * support commands with spaces ([531f8e0](https://github.com/oclif/test/commit/531f8e08e101e084a050410a6d63ac28c3277de9))
11
+
12
+ ### [2.0.3](https://github.com/oclif/test/compare/v2.0.2...v2.0.3) (2021-12-08)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * align deps ([742fdb3](https://github.com/oclif/test/commit/742fdb301057fef5762a83ff65b361873f338769))
18
+
19
+ ### [2.0.2](https://github.com/oclif/test/compare/v2.0.1...v2.0.2) (2021-12-02)
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * update package to v2 minimums ([52115cf](https://github.com/oclif/test/commit/52115cfa36ba73779e7f0bce80e17d6fc285da7d))
25
+
26
+ ### [2.0.1](https://github.com/oclif/test/compare/v1.2.8...v2.0.1) (2021-10-04)
6
27
 
7
28
 
8
29
  ### ⚠ BREAKING CHANGES
9
30
 
31
+ * require node 12+ (#189)
10
32
  * update to oclif/core
11
33
 
12
34
  ### Bug Fixes
13
35
 
14
36
  * ci ([3297d16](https://github.com/oclif/test/commit/3297d16beeb7fb1b1766584a4f55cb6a1b12519d))
15
37
  * release-process ([1d414db](https://github.com/oclif/test/commit/1d414db733e41c630690420e7c8da1610855a4a6))
38
+ * trigger release ([65bd420](https://github.com/oclif/test/commit/65bd420c7e575e27fab56751f1b4f2bc4d6ecc75))
16
39
 
17
40
 
18
41
  * Merge pull request #179 from oclif/re/oclif-core ([fedc128](https://github.com/oclif/test/commit/fedc128a6df0fe5aca2a520764f0261af3aadfa4)), closes [#179](https://github.com/oclif/test/issues/179)
19
42
 
43
+
44
+ ### build
45
+
46
+ * require node 12+ ([#189](https://github.com/oclif/test/issues/189)) ([04ac33e](https://github.com/oclif/test/commit/04ac33e34bf5acf9e5cde3f4d8780861d0504b3b))
47
+
20
48
  ## [1.2.8](https://github.com/oclif/test/compare/v1.2.7...v1.2.8) (2020-12-02)
21
49
 
22
50
 
package/README.md CHANGED
@@ -4,8 +4,7 @@
4
4
  test helpers for oclif components
5
5
 
6
6
  [![Version](https://img.shields.io/npm/v/@oclif/test.svg)](https://npmjs.org/package/@oclif/test)
7
- [![CircleCI](https://circleci.com/gh/oclif/test/tree/master.svg?style=svg)](https://circleci.com/gh/oclif/test/tree/master)
8
- [![Appveyor CI](https://ci.appveyor.com/api/projects/status/github/oclif/test?branch=master&svg=true)](https://ci.appveyor.com/project/heroku/test/branch/master)
7
+ [![CircleCI](https://circleci.com/gh/oclif/test/tree/main.svg?style=svg)](https://circleci.com/gh/oclif/test/tree/main)
9
8
  [![Known Vulnerabilities](https://snyk.io/test/npm/@oclif/test/badge.svg)](https://snyk.io/test/npm/@oclif/test)
10
9
  [![Downloads/week](https://img.shields.io/npm/dw/@oclif/test.svg)](https://npmjs.org/package/@oclif/test)
11
- [![License](https://img.shields.io/npm/l/@oclif/test.svg)](https://github.com/oclif/test/blob/master/package.json)
10
+ [![License](https://img.shields.io/npm/l/@oclif/test.svg)](https://github.com/oclif/test/blob/main/package.json)
package/lib/command.js CHANGED
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
4
+ const core_1 = require("@oclif/core");
3
5
  const load_config_1 = require("./load-config");
4
6
  const castArray = (input) => {
5
7
  if (input === undefined)
@@ -9,15 +11,14 @@ const castArray = (input) => {
9
11
  function command(args, opts = {}) {
10
12
  return {
11
13
  async run(ctx) {
12
- // eslint-disable-next-line require-atomic-updates
13
14
  if (!ctx.config || opts.reset)
14
- ctx.config = await load_config_1.loadConfig(opts).run({});
15
+ ctx.config = await (0, load_config_1.loadConfig)(opts).run({});
15
16
  args = castArray(args);
16
17
  const [id, ...extra] = args;
17
- // eslint-disable-next-line require-atomic-updates
18
+ const cmdId = (0, core_1.toStandardizedId)(id, ctx.config);
18
19
  ctx.expectation = ctx.expectation || `runs ${args.join(' ')}`;
19
- await ctx.config.runHook('init', { id, argv: extra });
20
- await ctx.config.runCommand(id, extra);
20
+ await ctx.config.runHook('init', { id: cmdId, argv: extra });
21
+ await ctx.config.runCommand(cmdId, extra);
21
22
  },
22
23
  };
23
24
  }
package/lib/exit.js CHANGED
@@ -10,12 +10,12 @@ const chai_1 = require("chai");
10
10
  */
11
11
  exports.default = (code = 0) => ({
12
12
  run() {
13
- chai_1.expect(process.exitCode).to.equal(code);
13
+ (0, chai_1.expect)(process.exitCode).to.equal(code);
14
14
  throw new Error(`Expected to exit with code ${code} but it ran without exiting`);
15
15
  },
16
16
  catch(ctx) {
17
17
  if (!ctx.error.oclif || ctx.error.oclif.exit === undefined)
18
18
  throw ctx.error;
19
- chai_1.expect(ctx.error.oclif.exit).to.equal(code);
19
+ (0, chai_1.expect)(ctx.error.oclif.exit).to.equal(code);
20
20
  },
21
21
  });
package/lib/hook.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Interfaces } from '@oclif/core';
2
2
  import { loadConfig } from './load-config';
3
- declare const _default: (event: string, hookOpts?: object, options?: loadConfig.Options) => {
3
+ declare const _default: (event: string, hookOpts?: Record<string, unknown>, options?: loadConfig.Options) => {
4
4
  run(ctx: {
5
5
  config: Interfaces.Config;
6
6
  expectation: string;
package/lib/hook.js CHANGED
@@ -19,7 +19,7 @@ exports.default = (event, hookOpts = {}, options = {}) => ({
19
19
  throw new Error('no hook provided');
20
20
  // eslint-disable-next-line require-atomic-updates
21
21
  if (!ctx.config)
22
- ctx.config = await load_config_1.loadConfig(options).run({});
22
+ ctx.config = await (0, load_config_1.loadConfig)(options).run({});
23
23
  // eslint-disable-next-line require-atomic-updates
24
24
  ctx.expectation = ctx.expectation || `runs ${event} hook`;
25
25
  await ctx.config.runHook(event, hookOpts || {});
package/lib/index.d.ts CHANGED
@@ -15,76 +15,76 @@ export declare const test: FancyTypes.Base<FancyTypes.Context, {
15
15
  } & {
16
16
  retries: {
17
17
  output: unknown;
18
- args: [number];
18
+ args: [count: number];
19
19
  };
20
20
  } & {
21
21
  catch: {
22
22
  output: {
23
23
  error: Error;
24
24
  };
25
- args: [string | RegExp | ((err: Error) => any), ({
25
+ args: [arg: string | RegExp | ((err: Error) => any), opts?: {
26
26
  raiseIfNotThrown?: boolean | undefined;
27
- } | undefined)?];
27
+ } | undefined];
28
28
  };
29
29
  } & {
30
30
  env: {
31
31
  output: unknown;
32
- args: [{
32
+ args: [env: {
33
33
  [k: string]: string | null | undefined;
34
- }, (FancyTypes.EnvOptions | undefined)?];
34
+ }, opts?: FancyTypes.EnvOptions | undefined];
35
35
  };
36
36
  } & {
37
37
  stub: {
38
38
  output: {
39
39
  stubs: any[];
40
40
  };
41
- args: [any, any, () => any];
41
+ args: [object: any, path: any, value: () => any];
42
42
  };
43
43
  } & {
44
44
  stdin: {
45
45
  output: unknown;
46
- args: [string, (number | undefined)?];
46
+ args: [input: string, delay?: number | undefined];
47
47
  };
48
48
  } & {
49
49
  stderr: {
50
50
  output: {
51
51
  readonly stderr: string;
52
52
  };
53
- args: [({
53
+ args: [opts?: {
54
54
  print?: boolean | undefined;
55
55
  stripColor?: boolean | undefined;
56
- } | undefined)?];
56
+ } | undefined];
57
57
  };
58
58
  } & {
59
59
  stdout: {
60
60
  output: {
61
61
  readonly stdout: string;
62
62
  };
63
- args: [({
63
+ args: [opts?: {
64
64
  print?: boolean | undefined;
65
65
  stripColor?: boolean | undefined;
66
- } | undefined)?];
66
+ } | undefined];
67
67
  };
68
68
  } & {
69
69
  nock: {
70
70
  output: {
71
71
  nock: number;
72
72
  };
73
- args: [string, FancyTypes.NockOptions | FancyTypes.NockCallback, (FancyTypes.NockCallback | undefined)?];
73
+ args: [host: string, options: FancyTypes.NockOptions | FancyTypes.NockCallback, cb?: FancyTypes.NockCallback | undefined];
74
74
  };
75
75
  } & {
76
76
  timeout: {
77
77
  output: {
78
78
  timeout: number;
79
79
  };
80
- args: [(number | undefined)?];
80
+ args: [timeout?: number | undefined];
81
81
  };
82
82
  } & {
83
83
  loadConfig: {
84
84
  output: {
85
85
  config: import("@oclif/core/lib/interfaces").Config;
86
86
  };
87
- args: [(loadConfig.Options | undefined)?];
87
+ args: [opts?: loadConfig.Options | undefined];
88
88
  };
89
89
  } & {
90
90
  command: {
@@ -92,14 +92,14 @@ export declare const test: FancyTypes.Base<FancyTypes.Context, {
92
92
  config: import("@oclif/core/lib/interfaces").Config;
93
93
  expectation: string;
94
94
  };
95
- args: [string | string[], (loadConfig.Options | undefined)?];
95
+ args: [args: string | string[], opts?: loadConfig.Options | undefined];
96
96
  };
97
97
  } & {
98
98
  exit: {
99
99
  output: {
100
100
  error: any;
101
101
  };
102
- args: [(number | undefined)?];
102
+ args: [code?: number | undefined];
103
103
  };
104
104
  } & {
105
105
  hook: {
@@ -107,7 +107,7 @@ export declare const test: FancyTypes.Base<FancyTypes.Context, {
107
107
  config: import("@oclif/core/lib/interfaces").Config;
108
108
  expectation: string;
109
109
  };
110
- args: [string, (object | undefined)?, (loadConfig.Options | undefined)?];
110
+ args: [event: string, hookOpts?: Record<string, unknown> | undefined, options?: loadConfig.Options | undefined];
111
111
  };
112
112
  }>;
113
113
  export default test;
package/lib/index.js CHANGED
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = exports.Config = exports.FancyTypes = exports.expect = exports.test = void 0;
3
4
  const core_1 = require("@oclif/core");
4
- exports.Config = core_1.Config;
5
+ Object.defineProperty(exports, "Config", { enumerable: true, get: function () { return core_1.Config; } });
5
6
  const fancy_test_1 = require("fancy-test");
6
- exports.expect = fancy_test_1.expect;
7
- exports.FancyTypes = fancy_test_1.FancyTypes;
7
+ Object.defineProperty(exports, "expect", { enumerable: true, get: function () { return fancy_test_1.expect; } });
8
+ Object.defineProperty(exports, "FancyTypes", { enumerable: true, get: function () { return fancy_test_1.FancyTypes; } });
8
9
  const command_1 = require("./command");
9
- exports.command = command_1.command;
10
+ Object.defineProperty(exports, "command", { enumerable: true, get: function () { return command_1.command; } });
10
11
  const exit_1 = require("./exit");
11
12
  const hook_1 = require("./hook");
12
13
  const load_config_1 = require("./load-config");
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadConfig = void 0;
3
4
  const core_1 = require("@oclif/core");
4
5
  /**
5
6
  * loads CLI plugin/multi config
package/package.json CHANGED
@@ -1,30 +1,30 @@
1
1
  {
2
2
  "name": "@oclif/test",
3
3
  "description": "test helpers for oclif components",
4
- "version": "2.0.0",
5
- "author": "Jeff Dickey @jdxcode",
4
+ "version": "2.1.0",
5
+ "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/test/issues",
7
7
  "dependencies": {
8
- "fancy-test": "^1.4.3"
8
+ "@oclif/core": "^1.3.1",
9
+ "fancy-test": "^2.0.0"
9
10
  },
10
11
  "devDependencies": {
11
- "@oclif/core": "^0.5.27",
12
12
  "@types/chai": "^4.1.7",
13
- "@types/mocha": "^8.0.0",
14
- "@types/node": "^14.0.14",
13
+ "@types/mocha": "^9.0.0",
14
+ "@types/node": "^14.18.0",
15
15
  "chai": "^4.2.0",
16
- "eslint": "^7.3.1",
17
- "eslint-config-oclif": "^3.1.0",
18
- "eslint-config-oclif-typescript": "^0.2.0",
16
+ "eslint": "^7.32.0",
17
+ "eslint-config-oclif": "^4.0.0",
18
+ "eslint-config-oclif-typescript": "^1.0.2",
19
19
  "globby": "^11.0.1",
20
- "mocha": "^8.2.1",
20
+ "mocha": "^9",
21
21
  "nock": "^13.0.1",
22
22
  "shx": "^0.3.3",
23
23
  "ts-node": "^9.0.0",
24
- "typescript": "3.8.3"
24
+ "typescript": "4.4.3"
25
25
  },
26
26
  "engines": {
27
- "node": ">=8.0.0"
27
+ "node": ">=12.0.0"
28
28
  },
29
29
  "files": [
30
30
  "/lib"