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
71 lines (55 loc) • 1.58 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.TesterService = void 0;
function _bluebird() {
const data = require("bluebird");
_bluebird = function () {
return data;
};
return data;
}
function _path() {
const data = require("path");
_path = function () {
return data;
};
return data;
}
function _utils() {
const data = require("./utils");
_utils = function () {
return data;
};
return data;
}
class TesterService {
constructor(workspace, testsRegex) {
this.workspace = workspace;
this.testsRegex = testsRegex;
}
run(context) {
var _this = this;
return (0, _bluebird().coroutine)(function* () {
const tester = context.env.getTester();
const components = (0, _utils().detectTestFiles)(context.components);
const testMatch = components.reduce((acc, component) => {
const specs = component.specs.map(specFile => {
var _component$state$_con;
return (0, _path().join)(_this.workspace.path, (_component$state$_con = component.state._consumer.componentMap) === null || _component$state$_con === void 0 ? void 0 : _component$state$_con.getComponentDir(), specFile);
});
acc = acc.concat(specs);
return acc;
}, []);
const testerContext = Object.assign(context, {
release: false,
specFiles: testMatch,
rootPath: _this.workspace.path,
workspace: _this.workspace
});
return tester.test(testerContext);
})();
}
}
exports.TesterService = TesterService;
;