Skip to content

Commit

Permalink
Merge pull request #1000 from bertdeblock/remove-use-of-core-object-f…
Browse files Browse the repository at this point in the history
…or-utils

Remove use of `core-object` for utils
  • Loading branch information
bertdeblock authored Dec 10, 2024
2 parents 399dba5 + 03adef4 commit ced2d08
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
21 changes: 14 additions & 7 deletions lib/utils/result-summary.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
'use strict';

const CoreObject = require('core-object');
const chalk = require('chalk');
const Table = require('cli-table3');

module.exports = CoreObject.extend({
module.exports = class ResultSummary {
constructor(options) {
this.results = options.results;
this.ui = options.ui;
}

print() {
let task = this;
let colorAndMessage;
Expand Down Expand Up @@ -39,13 +43,15 @@ module.exports = CoreObject.extend({

task.ui.writeLine('');
task._printResultsSummary(countFailed, countPassed, allowedFailCount, this.results.length);
},
}

_printResultHeader() {
let task = this;
task.ui.writeLine('');
task.ui.writeLine('------ RESULTS ------');
task.ui.writeLine('');
},
}

_printDependencyTable(dependencyStatus) {
if (!dependencyStatus.length) {
return;
Expand Down Expand Up @@ -80,7 +86,8 @@ module.exports = CoreObject.extend({
});
task.ui.writeLine(table);
task.ui.writeLine('');
},
}

_printResultsSummary(countFailed, countPassed, allowedFailCount, total) {
let task = this;
if (countFailed) {
Expand All @@ -94,5 +101,5 @@ module.exports = CoreObject.extend({
} else {
task.ui.writeLine(chalk.green(`All ${countPassed} scenarios succeeded`));
}
},
});
}
};
15 changes: 9 additions & 6 deletions lib/utils/scenario-manager.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
'use strict';

const CoreObject = require('core-object');
module.exports = class ScenarioManager {
constructor(options) {
this.dependencyManagerAdapters = options.dependencyManagerAdapters;
this.ui = options.ui;
}

module.exports = CoreObject.extend({
async setup() {
let { ui } = this;

for (let depManager of this.dependencyManagerAdapters) {
await depManager.setup({ ui });
}
},
}

async changeTo(scenario) {
let results = [];
Expand All @@ -23,11 +26,11 @@ module.exports = CoreObject.extend({
}

return results;
},
}

async cleanup() {
for (let depManager of this.dependencyManagerAdapters) {
await depManager.cleanup();
}
},
});
}
};

0 comments on commit ced2d08

Please sign in to comment.