@oclif/test
Advanced tools
Comparing version 3.0.2 to 3.0.3
import { Interfaces } from '@oclif/core'; | ||
import { loadConfig } from './load-config'; | ||
export declare function command(args: string[] | string, opts?: loadConfig.Options): { | ||
run(ctx: { | ||
config: Interfaces.Config; | ||
expectation: string; | ||
returned: unknown; | ||
}): Promise<void>; | ||
type Context = { | ||
config: Interfaces.Config; | ||
expectation: string; | ||
returned: unknown; | ||
}; | ||
export declare function command(args: string | string[], opts?: loadConfig.Options): { | ||
run(ctx: Context): Promise<void>; | ||
}; | ||
export {}; |
@@ -20,3 +20,3 @@ "use strict"; | ||
ctx.expectation = ctx.expectation || `runs ${args.join(' ')}`; | ||
await ctx.config.runHook('init', { id: cmdId, argv: extra }); | ||
await ctx.config.runHook('init', { argv: extra, id: cmdId }); | ||
ctx.returned = await ctx.config.runCommand(cmdId, extra); | ||
@@ -23,0 +23,0 @@ }, |
/// <reference types="mocha" /> | ||
import { Errors } from '@oclif/core'; | ||
/** | ||
@@ -6,7 +7,7 @@ * ensures that a oclif command or hook exits | ||
declare const _default: (code?: number) => { | ||
run(): never; | ||
catch(ctx: { | ||
error: any; | ||
error: Errors.CLIError; | ||
}): void; | ||
run(): never; | ||
}; | ||
export default _default; |
@@ -9,6 +9,2 @@ "use strict"; | ||
exports.default = (code = 0) => ({ | ||
run() { | ||
(0, chai_1.expect)(process.exitCode).to.equal(code); | ||
throw new Error(`Expected to exit with code ${code} but it ran without exiting`); | ||
}, | ||
catch(ctx) { | ||
@@ -19,2 +15,6 @@ if (!ctx.error.oclif || ctx.error.oclif.exit === undefined) | ||
}, | ||
run() { | ||
(0, chai_1.expect)(process.exitCode).to.equal(code); | ||
throw new Error(`Expected to exit with code ${code} but it ran without exiting`); | ||
}, | ||
}); |
/// <reference types="mocha" /> | ||
import { Interfaces } from '@oclif/core'; | ||
import { loadConfig } from './load-config'; | ||
type Context = { | ||
config: Interfaces.Config; | ||
expectation: string; | ||
returned: unknown; | ||
}; | ||
/** | ||
@@ -16,8 +21,4 @@ * tests a oclif hook | ||
declare const _default: (event: string, hookOpts?: Record<string, unknown>, options?: loadConfig.Options) => { | ||
run(ctx: { | ||
config: Interfaces.Config; | ||
expectation: string; | ||
returned: unknown; | ||
}): Promise<void>; | ||
run(ctx: Context): Promise<void>; | ||
}; | ||
export default _default; |
@@ -99,3 +99,3 @@ /// <reference types="sinon" /> | ||
output: { | ||
error: any; | ||
error: import("@oclif/core/lib/errors").CLIError; | ||
}; | ||
@@ -115,4 +115,4 @@ args: [code?: number | undefined]; | ||
export default test; | ||
export { command } from './command'; | ||
export { Config } from '@oclif/core'; | ||
export { expect, FancyTypes } from 'fancy-test'; | ||
export { command } from './command'; | ||
export { FancyTypes, expect } from 'fancy-test'; |
"use strict"; | ||
var _a, _b; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.command = exports.FancyTypes = exports.expect = exports.Config = exports.test = void 0; | ||
const tslib_1 = require("tslib"); | ||
exports.expect = exports.FancyTypes = exports.Config = exports.command = exports.test = void 0; | ||
const fancy_test_1 = require("fancy-test"); | ||
const node_path_1 = require("node:path"); | ||
const fancy_test_1 = require("fancy-test"); | ||
const command_1 = require("./command"); | ||
const exit_1 = tslib_1.__importDefault(require("./exit")); | ||
const hook_1 = tslib_1.__importDefault(require("./hook")); | ||
const exit_1 = __importDefault(require("./exit")); | ||
const hook_1 = __importDefault(require("./hook")); | ||
const load_config_1 = require("./load-config"); | ||
@@ -21,3 +22,3 @@ function traverseFilePathUntil(filename, predicate) { | ||
// eslint-disable-next-line unicorn/prefer-module | ||
load_config_1.loadConfig.root = traverseFilePathUntil((_b = (_a = require.main) === null || _a === void 0 ? void 0 : _a.path) !== null && _b !== void 0 ? _b : module.path, p => !p.includes('node_modules')); | ||
load_config_1.loadConfig.root = traverseFilePathUntil(require.main?.path ?? module.path, (p) => !p.includes('node_modules')); | ||
exports.test = fancy_test_1.fancy | ||
@@ -30,8 +31,8 @@ .register('loadConfig', load_config_1.loadConfig) | ||
exports.default = exports.test; | ||
var command_2 = require("./command"); | ||
Object.defineProperty(exports, "command", { enumerable: true, get: function () { return command_2.command; } }); | ||
var core_1 = require("@oclif/core"); | ||
Object.defineProperty(exports, "Config", { enumerable: true, get: function () { return core_1.Config; } }); | ||
var fancy_test_2 = require("fancy-test"); | ||
Object.defineProperty(exports, "FancyTypes", { enumerable: true, get: function () { return fancy_test_2.FancyTypes; } }); | ||
Object.defineProperty(exports, "expect", { enumerable: true, get: function () { return fancy_test_2.expect; } }); | ||
Object.defineProperty(exports, "FancyTypes", { enumerable: true, get: function () { return fancy_test_2.FancyTypes; } }); | ||
var command_2 = require("./command"); | ||
Object.defineProperty(exports, "command", { enumerable: true, get: function () { return command_2.command; } }); |
@@ -15,5 +15,5 @@ import { Interfaces } from '@oclif/core'; | ||
interface Options { | ||
reset?: boolean; | ||
root?: string; | ||
reset?: boolean; | ||
} | ||
} |
@@ -19,3 +19,4 @@ "use strict"; | ||
exports.loadConfig = loadConfig; | ||
// eslint-disable-next-line @typescript-eslint/no-namespace | ||
(function (loadConfig) { | ||
})(loadConfig || (exports.loadConfig = loadConfig = {})); |
{ | ||
"name": "@oclif/test", | ||
"description": "test helpers for oclif components", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"author": "Salesforce", | ||
"bugs": "https://github.com/oclif/test/issues", | ||
"dependencies": { | ||
"@oclif/core": "^3.0.0-beta.19", | ||
"@oclif/core": "^3.6.0", | ||
"chai": "^4.3.10", | ||
@@ -13,13 +13,20 @@ "fancy-test": "^3.0.1" | ||
"devDependencies": { | ||
"@commitlint/config-conventional": "^18.0.0", | ||
"@oclif/prettier-config": "^0.2.1", | ||
"@types/cli-progress": "^3.11.4", | ||
"@types/mocha": "^10", | ||
"@types/node": "^18", | ||
"eslint": "^8.49.0", | ||
"commitlint": "^18.0.0", | ||
"eslint": "^8.52.0", | ||
"eslint-config-oclif": "^5.0.0", | ||
"eslint-config-oclif-typescript": "^2.0.1", | ||
"eslint-config-oclif-typescript": "^3.0.8", | ||
"eslint-config-prettier": "^9.0.0", | ||
"globby": "^11.0.1", | ||
"husky": "^8.0.3", | ||
"lint-staged": "^15.0.2", | ||
"mocha": "^10", | ||
"nock": "^13.3.3", | ||
"nock": "^13.3.6", | ||
"prettier": "^3.0.3", | ||
"shx": "^0.3.3", | ||
"ts-node": "^10.9.1", | ||
"tslib": "^2.6.2", | ||
"typescript": "^5" | ||
@@ -44,7 +51,8 @@ }, | ||
"posttest": "yarn lint", | ||
"prepare": "husky install", | ||
"prepublishOnly": "yarn run build", | ||
"test": "mocha --forbid-only \"test/**/*.test.ts\"", | ||
"pretest": "yarn build --noEmit && tsc -p test --noEmit" | ||
"pretest": "yarn build --noEmit && tsc -p test --noEmit", | ||
"test": "mocha --forbid-only \"test/**/*.test.ts\"" | ||
}, | ||
"types": "lib/index.d.ts" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13011
305
19
Updated@oclif/core@^3.6.0