@oclif/test 2.1.2 → 2.2.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/lib/command.d.ts CHANGED
@@ -4,5 +4,6 @@ export declare function command(args: string[] | string, opts?: loadConfig.Optio
4
4
  run(ctx: {
5
5
  config: Interfaces.Config;
6
6
  expectation: string;
7
+ returned: unknown;
7
8
  }): Promise<void>;
8
9
  };
package/lib/command.js CHANGED
@@ -18,7 +18,7 @@ function command(args, opts = {}) {
18
18
  const cmdId = (0, core_1.toStandardizedId)(id, ctx.config);
19
19
  ctx.expectation = ctx.expectation || `runs ${args.join(' ')}`;
20
20
  await ctx.config.runHook('init', { id: cmdId, argv: extra });
21
- await ctx.config.runCommand(cmdId, extra);
21
+ ctx.returned = await ctx.config.runCommand(cmdId, extra);
22
22
  },
23
23
  };
24
24
  }
package/lib/exit.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference types="mocha" />
1
2
  declare const _default: (code?: number) => {
2
3
  run(): never;
3
4
  catch(ctx: {
@@ -6,8 +7,5 @@ declare const _default: (code?: number) => {
6
7
  };
7
8
  /**
8
9
  * ensures that a oclif command or hook exits
9
- *
10
- * @param {number} code expected code
11
- * @default 0
12
10
  */
13
11
  export default _default;
package/lib/exit.js CHANGED
@@ -4,9 +4,6 @@ const chai_1 = require("chai");
4
4
  // eslint-disable-next-line valid-jsdoc
5
5
  /**
6
6
  * ensures that a oclif command or hook exits
7
- *
8
- * @param {number} code expected code
9
- * @default 0
10
7
  */
11
8
  exports.default = (code = 0) => ({
12
9
  run() {
package/lib/hook.d.ts CHANGED
@@ -1,9 +1,11 @@
1
+ /// <reference types="mocha" />
1
2
  import { Interfaces } from '@oclif/core';
2
3
  import { loadConfig } from './load-config';
3
4
  declare const _default: (event: string, hookOpts?: Record<string, unknown>, options?: loadConfig.Options) => {
4
5
  run(ctx: {
5
6
  config: Interfaces.Config;
6
7
  expectation: string;
8
+ returned: unknown;
7
9
  }): Promise<void>;
8
10
  };
9
11
  /**
package/lib/hook.js CHANGED
@@ -17,11 +17,9 @@ exports.default = (event, hookOpts = {}, options = {}) => ({
17
17
  async run(ctx) {
18
18
  if (!event)
19
19
  throw new Error('no hook provided');
20
- // eslint-disable-next-line require-atomic-updates
21
20
  if (!ctx.config)
22
21
  ctx.config = await (0, load_config_1.loadConfig)(options).run({});
23
- // eslint-disable-next-line require-atomic-updates
24
22
  ctx.expectation = ctx.expectation || `runs ${event} hook`;
25
- await ctx.config.runHook(event, hookOpts || {});
23
+ ctx.returned = await ctx.config.runHook(event, hookOpts || {});
26
24
  },
27
25
  });
package/lib/index.d.ts CHANGED
@@ -91,6 +91,7 @@ export declare const test: FancyTypes.Base<FancyTypes.Context, {
91
91
  output: {
92
92
  config: import("@oclif/core/lib/interfaces").Config;
93
93
  expectation: string;
94
+ returned: unknown;
94
95
  };
95
96
  args: [args: string | string[], opts?: loadConfig.Options | undefined];
96
97
  };
@@ -106,6 +107,7 @@ export declare const test: FancyTypes.Base<FancyTypes.Context, {
106
107
  output: {
107
108
  config: import("@oclif/core/lib/interfaces").Config;
108
109
  expectation: string;
110
+ returned: unknown;
109
111
  };
110
112
  args: [event: string, hookOpts?: Record<string, unknown> | undefined, options?: loadConfig.Options | undefined];
111
113
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oclif/test",
3
3
  "description": "test helpers for oclif components",
4
- "version": "2.1.2",
4
+ "version": "2.2.0",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/test/issues",
7
7
  "dependencies": {
@@ -11,7 +11,7 @@
11
11
  "devDependencies": {
12
12
  "@types/chai": "^4.1.7",
13
13
  "@types/mocha": "^9.1.1",
14
- "@types/node": "^14.18.0",
14
+ "@types/node": "^14.18.30",
15
15
  "chai": "^4.2.0",
16
16
  "eslint": "^7.32.0",
17
17
  "eslint-config-oclif": "^4.0.0",