@stepci/runner
Advanced tools
Comparing version 1.11.4 to 1.11.5
@@ -358,4 +358,5 @@ /// <reference types="node" /> | ||
}; | ||
export declare function runFromYAML(yamlString: string, options?: WorkflowOptions): Promise<WorkflowResult>; | ||
export declare function runFromFile(path: string, options?: WorkflowOptions): Promise<WorkflowResult>; | ||
export declare function run(workflow: Workflow, options?: WorkflowOptions): Promise<WorkflowResult>; | ||
export {}; |
@@ -29,3 +29,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.run = exports.runFromFile = void 0; | ||
exports.run = exports.runFromFile = exports.runFromYAML = void 0; | ||
const got_1 = __importDefault(require("got")); | ||
@@ -46,2 +46,3 @@ const proxy_agent_1 = require("proxy-agent"); | ||
const fs_1 = __importDefault(require("fs")); | ||
const js_yaml_1 = __importDefault(require("js-yaml")); | ||
const json_schema_ref_parser_1 = __importDefault(require("@apidevtools/json-schema-ref-parser")); | ||
@@ -62,5 +63,12 @@ const ajv_1 = __importDefault(require("ajv")); | ||
// Run from test file | ||
async function runFromYAML(yamlString, options) { | ||
const workflow = js_yaml_1.default.load(yamlString); | ||
const dereffed = await json_schema_ref_parser_1.default.dereference(workflow); | ||
return run(dereffed, options); | ||
} | ||
exports.runFromYAML = runFromYAML; | ||
// Run from test file | ||
async function runFromFile(path, options) { | ||
const workflow = await json_schema_ref_parser_1.default.dereference(path); | ||
return run(workflow, { ...options, path }); | ||
const testFile = await fs_1.default.promises.readFile(path); | ||
return runFromYAML(testFile.toString(), { ...options, path }); | ||
} | ||
@@ -67,0 +75,0 @@ exports.runFromFile = runFromFile; |
@@ -7,2 +7,4 @@ "use strict"; | ||
exports.loadTest = exports.loadTestFromFile = void 0; | ||
const fs_1 = __importDefault(require("fs")); | ||
const js_yaml_1 = __importDefault(require("js-yaml")); | ||
const json_schema_ref_parser_1 = __importDefault(require("@apidevtools/json-schema-ref-parser")); | ||
@@ -24,4 +26,6 @@ const phasic_1 = require("phasic"); | ||
async function loadTestFromFile(path, options) { | ||
const workflow = await json_schema_ref_parser_1.default.dereference(path); | ||
return loadTest(workflow, { ...options, path }); | ||
const testFile = await fs_1.default.promises.readFile(path); | ||
const workflow = js_yaml_1.default.load(testFile.toString()); | ||
const dereffed = await json_schema_ref_parser_1.default.dereference(workflow); | ||
return loadTest(dereffed, { ...options, path }); | ||
} | ||
@@ -28,0 +32,0 @@ exports.loadTestFromFile = loadTestFromFile; |
{ | ||
"name": "@stepci/runner", | ||
"version": "1.11.4", | ||
"version": "1.11.5", | ||
"description": "Step CI Runner", | ||
@@ -43,2 +43,3 @@ "main": "dist/index.js", | ||
"got": "^11.8.3", | ||
"js-yaml": "^4.1.0", | ||
"jsonpath-plus": "^7.2.0", | ||
@@ -45,0 +46,0 @@ "liquidless": "^1.2.0", |
93716
1729
26
3
+ Addedjs-yaml@^4.1.0