@oclif/test 1.2.4 → 1.2.8

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
@@ -1,3 +1,17 @@
1
+ ## [1.2.8](https://github.com/oclif/test/compare/v1.2.7...v1.2.8) (2020-12-02)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **deps:** bump fancy-test from 1.4.9 to 1.4.10 ([#126](https://github.com/oclif/test/issues/126)) ([132c914](https://github.com/oclif/test/commit/132c914d6fcfc92d6a90352706b28769c3ef22e7))
7
+
8
+ ## [1.2.7](https://github.com/oclif/test/compare/v1.2.6...v1.2.7) (2020-09-01)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps-dev:** bump eslint from 7.7.0 to 7.8.0 ([#111](https://github.com/oclif/test/issues/111)) ([2d81e06](https://github.com/oclif/test/commit/2d81e0653e0b27d6b3f6e666b63c066d789b154b))
14
+
1
15
  ## [1.2.2](https://github.com/oclif/test/compare/v1.2.1...v1.2.2) (2018-10-13)
2
16
 
3
17
 
package/lib/command.js CHANGED
@@ -1,22 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const load_config_1 = require("./load-config");
4
+ const castArray = (input) => {
5
+ if (input === undefined)
6
+ return [];
7
+ return Array.isArray(input) ? input : [input];
8
+ };
4
9
  function command(args, opts = {}) {
5
10
  return {
6
11
  async run(ctx) {
12
+ // eslint-disable-next-line require-atomic-updates
7
13
  if (!ctx.config || opts.reset)
8
14
  ctx.config = await load_config_1.loadConfig(opts).run({});
9
15
  args = castArray(args);
10
- let [id, ...extra] = args;
16
+ const [id, ...extra] = args;
17
+ // eslint-disable-next-line require-atomic-updates
11
18
  ctx.expectation = ctx.expectation || `runs ${args.join(' ')}`;
12
19
  await ctx.config.runHook('init', { id, argv: extra });
13
20
  await ctx.config.runCommand(id, extra);
14
- }
21
+ },
15
22
  };
16
23
  }
17
24
  exports.command = command;
18
- const castArray = (input) => {
19
- if (input === undefined)
20
- return [];
21
- return Array.isArray(input) ? input : [input];
22
- };
package/lib/exit.d.ts CHANGED
@@ -7,7 +7,7 @@ declare const _default: (code?: number) => {
7
7
  /**
8
8
  * ensures that a oclif command or hook exits
9
9
  *
10
- * @param code - expected code
10
+ * @param {number} code expected code
11
11
  * @default 0
12
12
  */
13
13
  export default _default;
package/lib/exit.js CHANGED
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const chai_1 = require("chai");
4
+ // eslint-disable-next-line valid-jsdoc
4
5
  /**
5
6
  * ensures that a oclif command or hook exits
6
7
  *
7
- * @param code - expected code
8
+ * @param {number} code expected code
8
9
  * @default 0
9
10
  */
10
11
  exports.default = (code = 0) => ({
package/lib/hook.d.ts CHANGED
@@ -14,7 +14,7 @@ declare const _default: (event: string, hookOpts?: object, options?: loadConfig.
14
14
  * expect(output.stdout).to.contain('this output')
15
15
  * })
16
16
  *
17
- * @param event - hook to run
18
- * @param hookOpts - options to pass to hook. Config object will be passed automatically.
17
+ * @param {string} event hook to run
18
+ * @param {object} hookOpts options to pass to hook. Config object will be passed automatically.
19
19
  */
20
20
  export default _default;
package/lib/hook.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const load_config_1 = require("./load-config");
4
+ // eslint-disable-next-line valid-jsdoc
4
5
  /**
5
6
  * tests a oclif hook
6
7
  *
@@ -9,16 +10,18 @@ const load_config_1 = require("./load-config");
9
10
  * expect(output.stdout).to.contain('this output')
10
11
  * })
11
12
  *
12
- * @param event - hook to run
13
- * @param hookOpts - options to pass to hook. Config object will be passed automatically.
13
+ * @param {string} event hook to run
14
+ * @param {object} hookOpts options to pass to hook. Config object will be passed automatically.
14
15
  */
15
16
  exports.default = (event, hookOpts = {}, options = {}) => ({
16
17
  async run(ctx) {
17
18
  if (!event)
18
19
  throw new Error('no hook provided');
20
+ // eslint-disable-next-line require-atomic-updates
19
21
  if (!ctx.config)
20
22
  ctx.config = await load_config_1.loadConfig(options).run({});
23
+ // eslint-disable-next-line require-atomic-updates
21
24
  ctx.expectation = ctx.expectation || `runs ${event} hook`;
22
25
  await ctx.config.runHook(event, hookOpts || {});
23
- }
26
+ },
24
27
  });
package/lib/index.d.ts CHANGED
@@ -4,17 +4,17 @@ import { command } from './command';
4
4
  import { loadConfig } from './load-config';
5
5
  export declare const test: FancyTypes.Base<FancyTypes.Context, {
6
6
  skip: {
7
- output: {};
7
+ output: unknown;
8
8
  args: [];
9
9
  };
10
10
  } & {
11
11
  only: {
12
- output: {};
12
+ output: unknown;
13
13
  args: [];
14
14
  };
15
15
  } & {
16
16
  retries: {
17
- output: {};
17
+ output: unknown;
18
18
  args: [number];
19
19
  };
20
20
  } & {
@@ -28,7 +28,7 @@ export declare const test: FancyTypes.Base<FancyTypes.Context, {
28
28
  };
29
29
  } & {
30
30
  env: {
31
- output: {};
31
+ output: unknown;
32
32
  args: [{
33
33
  [k: string]: string | null | undefined;
34
34
  }, (FancyTypes.EnvOptions | undefined)?];
@@ -38,11 +38,11 @@ export declare const test: FancyTypes.Base<FancyTypes.Context, {
38
38
  output: {
39
39
  stubs: any[];
40
40
  };
41
- args: any[];
41
+ args: [any, any, () => any];
42
42
  };
43
43
  } & {
44
44
  stdin: {
45
- output: {};
45
+ output: unknown;
46
46
  args: [string, (number | undefined)?];
47
47
  };
48
48
  } & {
@@ -1,6 +1,8 @@
1
1
  import * as Config from '@oclif/config';
2
2
  /**
3
3
  * loads CLI plugin/multi config
4
+ * @param {loadConfig.Options} opts options
5
+ * @return {Promise<Config.IConfig>} config
4
6
  */
5
7
  export declare function loadConfig(opts?: loadConfig.Options): {
6
8
  run(ctx: {
@@ -3,13 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const Config = require("@oclif/config");
4
4
  /**
5
5
  * loads CLI plugin/multi config
6
+ * @param {loadConfig.Options} opts options
7
+ * @return {Promise<Config.IConfig>} config
6
8
  */
7
9
  function loadConfig(opts = {}) {
8
10
  return {
9
11
  async run(ctx) {
10
12
  ctx.config = await Config.load(opts.root || loadConfig.root);
11
13
  return ctx.config;
12
- }
14
+ },
13
15
  };
14
16
  }
15
17
  exports.loadConfig = loadConfig;
package/package.json CHANGED
@@ -1,26 +1,28 @@
1
1
  {
2
2
  "name": "@oclif/test",
3
3
  "description": "test helpers for oclif components",
4
- "version": "1.2.4",
4
+ "version": "1.2.8",
5
5
  "author": "Jeff Dickey @jdxcode",
6
6
  "bugs": "https://github.com/oclif/test/issues",
7
7
  "dependencies": {
8
8
  "fancy-test": "^1.4.3"
9
9
  },
10
10
  "devDependencies": {
11
- "@oclif/command": "^1.5.10",
11
+ "@oclif/command": "^1.6.0",
12
12
  "@oclif/config": "^1.12.6",
13
13
  "@oclif/errors": "^1.2.2",
14
- "@oclif/tslint": "^3.1.1",
15
14
  "@types/chai": "^4.1.7",
16
- "@types/mocha": "^5.2.5",
17
- "@types/node": "^10.12.24",
15
+ "@types/mocha": "^8.0.0",
16
+ "@types/node": "^14.0.14",
18
17
  "chai": "^4.2.0",
19
- "globby": "^9.0.0",
20
- "mocha": "^5.2.0",
21
- "ts-node": "^8.0.2",
22
- "tslint": "^5.12.1",
23
- "typescript": "3.3.3"
18
+ "eslint": "^7.3.1",
19
+ "eslint-config-oclif": "^3.1.0",
20
+ "eslint-config-oclif-typescript": "^0.2.0",
21
+ "globby": "^11.0.1",
22
+ "mocha": "^8.2.1",
23
+ "nock": "^13.0.1",
24
+ "ts-node": "^9.0.0",
25
+ "typescript": "3.8.3"
24
26
  },
25
27
  "engines": {
26
28
  "node": ">=8.0.0"
@@ -37,10 +39,11 @@
37
39
  "repository": "oclif/test",
38
40
  "scripts": {
39
41
  "build": "rm -rf lib && tsc",
40
- "lint": "tsc -p test --noEmit && tslint -p test -t stylish",
41
- "posttest": "yarn run lint",
42
+ "lint": "eslint . --ext .ts --config .eslintrc",
43
+ "posttest": "yarn lint",
42
44
  "prepublishOnly": "yarn run build",
43
- "test": "mocha --forbid-only \"test/**/*.test.ts\""
45
+ "test": "mocha --forbid-only \"test/**/*.test.ts\"",
46
+ "pretest": "yarn build --noEmit && tsc -p test --noEmit"
44
47
  },
45
48
  "types": "lib/index.d.ts"
46
49
  }