@apideck/portman
Version:
Port OpenAPI Spec to Postman Collection, with contract & variation tests included
26 lines • 944 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.writeNewmanEnv = void 0;
var tslib_1 = require("tslib");
var fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
var writeNewmanEnv = function (obj, newmanEnvFilePath) {
if (!(obj === null || obj === void 0 ? void 0 : obj.variable)) {
console.log('Collection contains no variables to write to env file');
return;
}
var envVariables = obj.variable.map(function (item) {
return {
enabled: true,
key: item.key,
value: item.value
};
});
fs_extra_1.default.outputFileSync(newmanEnvFilePath, JSON.stringify({
id: 'fed4e16e-2f7f-4a16-8fda-9929c41296dd',
name: 'Newman Run',
_postman_variable_scope: 'environment',
values: envVariables
}, null, 2));
};
exports.writeNewmanEnv = writeNewmanEnv;
//# sourceMappingURL=writeNewmanEnv.js.map