Skip to content

Commit

Permalink
Fixes/3535 fix lodash dependency (#3536)
Browse files Browse the repository at this point in the history
  • Loading branch information
gravityvi committed Dec 29, 2022
1 parent 98f0a09 commit d9d5157
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/reporter/results.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const AssertionError = require('assertion-error');
const {merge: lodashMerge} = require('lodash');
const lodashMerge = require('lodash.merge');
const Utils = require('../utils');
const {Logger} = Utils;

Expand Down
14 changes: 14 additions & 0 deletions test/extra/commands/customCommandAppendResults.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = class AppendResult {
command() {
const {name} = this.client.reporter.currentTest;
const {testResults} = this.client.reporter;
testResults.appendTestResult({
[name]: {
customReport: {
success: true
}
}
});

}
};
5 changes: 5 additions & 0 deletions test/sampletests/appendtestresult/sampleWithAppendResults.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
demoTest(client) {
client.url('http://localhost').customCommandAppendResults().end();
}
};
35 changes: 35 additions & 0 deletions test/src/runner/testReporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,4 +329,39 @@ describe('testReporter', function() {
assert.strictEqual(possibleError, null);

});

it('check reporter output with appended results', async function() {
let possibleError = null;
const testPath = [path.join(__dirname, '../../sampletests/appendtestresult/sampleWithAppendResults.js')];
const customCommands = [path.join(__dirname, '../../extra/commands')];

try {
await runTests({
source: testPath
}, settings({
custom_commands_path: customCommands,
globals: {
waitForConditionPollInterval: 20,
waitForConditionTimeout: 50,
retryAssertionTimeout: 50,
reporter: function (results) {
const module = results.modules['sampleWithAppendResults'];

assert.ok(Object.keys(module).includes('completedSections'));
const completedSections = module['completedSections'];
assert.ok(Object.keys(completedSections).includes('demoTest'));

const test = completedSections['demoTest'];
assert.ok(Object.keys(test).includes('customReport'));
assert.deepStrictEqual(test.customReport, {success: true});
}
},
silent: true,
output: false
}));
} catch (err) {
possibleError = err;
}
assert.strictEqual(possibleError, null);
});
});

0 comments on commit d9d5157

Please sign in to comment.