bit-bin
Version:
<a href="https://opensource.org/licenses/Apache-2.0"><img alt="apache" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"></a> <a href="https://github.com/teambit/bit/blob/master/CONTRIBUTING.md"><img alt="prs" src="https://img.shields.io/b
110 lines (94 loc) • 2.12 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = runAndUpdateCI;
function _bluebird() {
const data = require("bluebird");
_bluebird = function () {
return data;
};
return data;
}
function _serializeError() {
const data = require("serialize-error");
_serializeError = function () {
return data;
};
return data;
}
function _scope() {
const data = require("../../api/scope");
_scope = function () {
return data;
};
return data;
}
function runAndUpdateCI(_x) {
return _runAndUpdateCI.apply(this, arguments);
}
function _runAndUpdateCI() {
_runAndUpdateCI = (0, _bluebird().coroutine)(function* ({
id,
scopePath,
verbose,
directory,
keep = false,
noCache = false
}) {
function addCIAttrsInTheModel({
error,
startTime
}) {
const endTime = Date.now().toString();
const ciProps = {
startTime,
endTime,
error: undefined
};
if (error) {
const serializedError = (0, _serializeError().serializeError)(error);
ciProps.error = serializedError;
return (0, _scope().modifyCIProps)(id, ciProps, scopePath);
}
return (0, _scope().modifyCIProps)(id, ciProps, scopePath);
}
const startTime = Date.now().toString();
try {
// define options
const save = true;
const buildResults = yield (0, _scope().buildInScope)({
id,
scopePath,
save,
verbose,
directory,
keep,
noCache
});
const testResults = yield (0, _scope().testInScope)({
id,
scopePath,
save,
verbose,
directory,
keep
});
const dists = buildResults ? buildResults.dists : null;
yield addCIAttrsInTheModel({
startTime
});
return {
specsResults: testResults,
dists
};
} catch (e) {
yield addCIAttrsInTheModel({
error: e,
startTime
});
throw e;
}
});
return _runAndUpdateCI.apply(this, arguments);
}
;