@teambit/jest
Version:
46 lines (43 loc) • 1.84 kB
JavaScript
;
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
class Watch {
constructor({
stdin,
stdout,
config
}) {
_defineProperty(this, "_stdin", void 0);
_defineProperty(this, "_stdout", void 0);
_defineProperty(this, "_prompt", void 0);
_defineProperty(this, "_testResults", void 0);
_defineProperty(this, "_usageInfo", void 0);
_defineProperty(this, "_specFiles", void 0);
_defineProperty(this, "_onComplete", void 0);
this._stdin = stdin;
this._stdout = stdout;
this._specFiles = config.specFiles;
this._onComplete = config.onComplete;
}
findComponent(specFile) {
const component = this._specFiles.toArray().find(([, specs]) => {
const paths = specs.map(spec => spec.path);
if (paths.includes(specFile)) return true;
return false;
});
return component?.[0];
}
apply(jestHooks) {
// jestHooks.shouldRunTestSuite(async (testSuite) => {
// const component = this.findComponent(testSuite.testPath);
// if ((await component?.isModified()) || (await component?.isNew())) return true;
// return false;
// });
jestHooks.onTestRunComplete(results => {
this._onComplete(results);
});
}
}
module.exports = Watch;
//# sourceMappingURL=watch.js.map