@oclif/test 1.2.7 → 2.0.2
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 +40 -0
- package/README.md +0 -1
- package/lib/command.d.ts +2 -2
- package/lib/command.js +2 -1
- package/lib/exit.js +2 -2
- package/lib/hook.d.ts +3 -3
- package/lib/hook.js +1 -1
- package/lib/index.d.ts +21 -21
- package/lib/index.js +6 -5
- package/lib/load-config.d.ts +4 -4
- package/lib/load-config.js +4 -3
- package/package.json +12 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,43 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
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
|
+
|
|
5
|
+
### [2.0.2](https://github.com/oclif/test/compare/v2.0.1...v2.0.2) (2021-12-02)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* update package to v2 minimums ([52115cf](https://github.com/oclif/test/commit/52115cfa36ba73779e7f0bce80e17d6fc285da7d))
|
|
11
|
+
|
|
12
|
+
### [2.0.1](https://github.com/oclif/test/compare/v1.2.8...v2.0.1) (2021-10-04)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### ⚠ BREAKING CHANGES
|
|
16
|
+
|
|
17
|
+
* require node 12+ (#189)
|
|
18
|
+
* update to oclif/core
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* ci ([3297d16](https://github.com/oclif/test/commit/3297d16beeb7fb1b1766584a4f55cb6a1b12519d))
|
|
23
|
+
* release-process ([1d414db](https://github.com/oclif/test/commit/1d414db733e41c630690420e7c8da1610855a4a6))
|
|
24
|
+
* trigger release ([65bd420](https://github.com/oclif/test/commit/65bd420c7e575e27fab56751f1b4f2bc4d6ecc75))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
* 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)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### build
|
|
31
|
+
|
|
32
|
+
* require node 12+ ([#189](https://github.com/oclif/test/issues/189)) ([04ac33e](https://github.com/oclif/test/commit/04ac33e34bf5acf9e5cde3f4d8780861d0504b3b))
|
|
33
|
+
|
|
34
|
+
## [1.2.8](https://github.com/oclif/test/compare/v1.2.7...v1.2.8) (2020-12-02)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Bug Fixes
|
|
38
|
+
|
|
39
|
+
* **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))
|
|
40
|
+
|
|
1
41
|
## [1.2.7](https://github.com/oclif/test/compare/v1.2.6...v1.2.7) (2020-09-01)
|
|
2
42
|
|
|
3
43
|
|
package/README.md
CHANGED
|
@@ -6,7 +6,6 @@ test helpers for oclif components
|
|
|
6
6
|
[](https://npmjs.org/package/@oclif/test)
|
|
7
7
|
[](https://circleci.com/gh/oclif/test/tree/master)
|
|
8
8
|
[](https://ci.appveyor.com/project/heroku/test/branch/master)
|
|
9
|
-
[](https://codecov.io/gh/oclif/test)
|
|
10
9
|
[](https://snyk.io/test/npm/@oclif/test)
|
|
11
10
|
[](https://npmjs.org/package/@oclif/test)
|
|
12
11
|
[](https://github.com/oclif/test/blob/master/package.json)
|
package/lib/command.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Interfaces } from '@oclif/core';
|
|
2
2
|
import { loadConfig } from './load-config';
|
|
3
3
|
export declare function command(args: string[] | string, opts?: loadConfig.Options): {
|
|
4
4
|
run(ctx: {
|
|
5
|
-
config: Config
|
|
5
|
+
config: Interfaces.Config;
|
|
6
6
|
expectation: string;
|
|
7
7
|
}): Promise<void>;
|
|
8
8
|
};
|
package/lib/command.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
3
4
|
const load_config_1 = require("./load-config");
|
|
4
5
|
const castArray = (input) => {
|
|
5
6
|
if (input === undefined)
|
|
@@ -11,7 +12,7 @@ function command(args, opts = {}) {
|
|
|
11
12
|
async run(ctx) {
|
|
12
13
|
// 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
18
|
// eslint-disable-next-line require-atomic-updates
|
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,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Interfaces } from '@oclif/core';
|
|
2
2
|
import { loadConfig } from './load-config';
|
|
3
|
-
declare const _default: (event: string, hookOpts?:
|
|
3
|
+
declare const _default: (event: string, hookOpts?: Record<string, unknown>, options?: loadConfig.Options) => {
|
|
4
4
|
run(ctx: {
|
|
5
|
-
config: Config
|
|
5
|
+
config: Interfaces.Config;
|
|
6
6
|
expectation: string;
|
|
7
7
|
}): Promise<void>;
|
|
8
8
|
};
|
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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Config } from '@oclif/core';
|
|
2
2
|
import { expect, FancyTypes } from 'fancy-test';
|
|
3
3
|
import { command } from './command';
|
|
4
4
|
import { loadConfig } from './load-config';
|
|
@@ -15,99 +15,99 @@ 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
|
-
},
|
|
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,
|
|
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,
|
|
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: [
|
|
80
|
+
args: [timeout?: number | undefined];
|
|
81
81
|
};
|
|
82
82
|
} & {
|
|
83
83
|
loadConfig: {
|
|
84
84
|
output: {
|
|
85
|
-
config: Config
|
|
85
|
+
config: import("@oclif/core/lib/interfaces").Config;
|
|
86
86
|
};
|
|
87
|
-
args: [
|
|
87
|
+
args: [opts?: loadConfig.Options | undefined];
|
|
88
88
|
};
|
|
89
89
|
} & {
|
|
90
90
|
command: {
|
|
91
91
|
output: {
|
|
92
|
-
config: Config
|
|
92
|
+
config: import("@oclif/core/lib/interfaces").Config;
|
|
93
93
|
expectation: string;
|
|
94
94
|
};
|
|
95
|
-
args: [string | string[],
|
|
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: [
|
|
102
|
+
args: [code?: number | undefined];
|
|
103
103
|
};
|
|
104
104
|
} & {
|
|
105
105
|
hook: {
|
|
106
106
|
output: {
|
|
107
|
-
config: Config
|
|
107
|
+
config: import("@oclif/core/lib/interfaces").Config;
|
|
108
108
|
expectation: string;
|
|
109
109
|
};
|
|
110
|
-
args: [string,
|
|
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
|
-
|
|
4
|
-
|
|
3
|
+
exports.command = exports.Config = exports.FancyTypes = exports.expect = exports.test = void 0;
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
Object.defineProperty(exports, "Config", { enumerable: true, get: function () { return core_1.Config; } });
|
|
5
6
|
const fancy_test_1 = require("fancy-test");
|
|
6
|
-
exports
|
|
7
|
-
exports
|
|
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
|
|
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");
|
package/lib/load-config.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Interfaces, Config } from '@oclif/core';
|
|
2
2
|
/**
|
|
3
3
|
* loads CLI plugin/multi config
|
|
4
4
|
* @param {loadConfig.Options} opts options
|
|
5
|
-
* @return {Promise<Config
|
|
5
|
+
* @return {Promise<Interfaces.Config>} config
|
|
6
6
|
*/
|
|
7
7
|
export declare function loadConfig(opts?: loadConfig.Options): {
|
|
8
8
|
run(ctx: {
|
|
9
|
-
config: Config
|
|
10
|
-
}): Promise<Config
|
|
9
|
+
config: Interfaces.Config;
|
|
10
|
+
}): Promise<Interfaces.Config>;
|
|
11
11
|
};
|
|
12
12
|
export declare namespace loadConfig {
|
|
13
13
|
let root: string;
|
package/lib/load-config.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
exports.loadConfig = void 0;
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
4
5
|
/**
|
|
5
6
|
* loads CLI plugin/multi config
|
|
6
7
|
* @param {loadConfig.Options} opts options
|
|
7
|
-
* @return {Promise<Config
|
|
8
|
+
* @return {Promise<Interfaces.Config>} config
|
|
8
9
|
*/
|
|
9
10
|
function loadConfig(opts = {}) {
|
|
10
11
|
return {
|
|
11
12
|
async run(ctx) {
|
|
12
|
-
ctx.config = await Config.load(opts.root || loadConfig.root);
|
|
13
|
+
ctx.config = await core_1.Config.load(opts.root || loadConfig.root);
|
|
13
14
|
return ctx.config;
|
|
14
15
|
},
|
|
15
16
|
};
|
package/package.json
CHANGED
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oclif/test",
|
|
3
3
|
"description": "test helpers for oclif components",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.2",
|
|
5
5
|
"author": "Jeff Dickey @jdxcode",
|
|
6
6
|
"bugs": "https://github.com/oclif/test/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"fancy-test": "^
|
|
8
|
+
"fancy-test": "^2.0.0"
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
11
|
-
"@oclif/
|
|
12
|
-
"@oclif/config": "^1.12.6",
|
|
13
|
-
"@oclif/errors": "^1.2.2",
|
|
11
|
+
"@oclif/core": "^1.0.5",
|
|
14
12
|
"@types/chai": "^4.1.7",
|
|
15
|
-
"@types/mocha": "^
|
|
13
|
+
"@types/mocha": "^9.0.0",
|
|
16
14
|
"@types/node": "^14.0.14",
|
|
17
15
|
"chai": "^4.2.0",
|
|
18
|
-
"eslint": "^7.
|
|
19
|
-
"eslint-config-oclif": "^
|
|
20
|
-
"eslint-config-oclif-typescript": "^0.2
|
|
16
|
+
"eslint": "^7.32.0",
|
|
17
|
+
"eslint-config-oclif": "^4.0.0",
|
|
18
|
+
"eslint-config-oclif-typescript": "^1.0.2",
|
|
21
19
|
"globby": "^11.0.1",
|
|
22
|
-
"mocha": "^
|
|
20
|
+
"mocha": "^9",
|
|
23
21
|
"nock": "^13.0.1",
|
|
22
|
+
"shx": "^0.3.3",
|
|
24
23
|
"ts-node": "^9.0.0",
|
|
25
|
-
"typescript": "
|
|
24
|
+
"typescript": "4.4.3"
|
|
26
25
|
},
|
|
27
26
|
"engines": {
|
|
28
|
-
"node": ">=
|
|
27
|
+
"node": ">=12.0.0"
|
|
29
28
|
},
|
|
30
29
|
"files": [
|
|
31
30
|
"/lib"
|
|
@@ -38,7 +37,7 @@
|
|
|
38
37
|
"main": "lib/index.js",
|
|
39
38
|
"repository": "oclif/test",
|
|
40
39
|
"scripts": {
|
|
41
|
-
"build": "rm -rf lib && tsc",
|
|
40
|
+
"build": "shx rm -rf lib && tsc",
|
|
42
41
|
"lint": "eslint . --ext .ts --config .eslintrc",
|
|
43
42
|
"posttest": "yarn lint",
|
|
44
43
|
"prepublishOnly": "yarn run build",
|