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
38 lines (31 loc) • 1.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
/**
* Convert specsResults from object to array and add the spec file
* @param {Object} versionModel
*/
function specsResultstoArray(versionModel) {
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
if (versionModel.specsResults && !Array.isArray(versionModel.specsResults)) {
// Get the first found spec file
// This should be ok since when the specs results was an object there were only one spec file
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
const specFile = versionModel.files.filter(file => {
return file.test;
})[0]; // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
const oldSpecsResults = versionModel.specsResults; // Add the spec file path
oldSpecsResults.specFile = specFile.relativePath;
const specsResults = [oldSpecsResults]; // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
versionModel.specsResults = specsResults;
}
return versionModel;
}
var _default = {
name: 'convert specs results array',
migrate: specsResultstoArray
};
exports.default = _default;