Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions lib/plugin/allure.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ module.exports = (config) => {
}
};

plugin.createStep = (name, stepFunc = () => {}) => {
plugin.createStep = (name, stepFunc = () => { }) => {
let result;
let status = 'passed';
reporter.startStep(name);
Expand All @@ -119,8 +119,8 @@ module.exports = (config) => {
throw error;
} finally {
if (!!result
&& (typeof result === 'object' || typeof result === 'function')
&& typeof result.then === 'function'
&& (typeof result === 'object' || typeof result === 'function')
&& typeof result.then === 'function'
) {
result.then(() => reporter.endStep('passed'), () => reporter.endStep('broken'));
} else {
Expand Down Expand Up @@ -234,6 +234,18 @@ module.exports = (config) => {
reporter.endCase('passed');
});

event.dispatcher.on(event.test.skipped, (test) => {
let loaded = true;
if (test.opts.skipInfo.isFastSkipped) {
loaded = false;
reporter.startSuite(test.parent.fullTitle());
}
reporter.pendingCase(test.title, null, test.opts.skipInfo);
if (!loaded) {
reporter.endSuite();
}
});

event.dispatcher.on(event.step.started, (step) => {
if (isHookSteps === false) {
startMetaStep(step.metaStep);
Expand Down
12 changes: 9 additions & 3 deletions lib/reporter/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Cli extends Base {
constructor(runner, opts) {
super(runner);
let level = 0;
this.failedTests = [];
this.loadedTests = [];
opts = opts.reporterOptions || opts;
if (opts.steps) level = 1;
if (opts.debug) level = 2;
Expand Down Expand Up @@ -43,7 +43,7 @@ class Cli extends Base {

runner.on('fail', (test, err) => {
if (test.ctx.currentTest) {
this.failedTests.push(test.ctx.currentTest.id);
this.loadedTests.push(test.ctx.currentTest.id);
}
if (showSteps && test.steps) {
return output.scenario.failed(test);
Expand All @@ -53,6 +53,7 @@ class Cli extends Base {
});

runner.on('pending', (test) => {
this.loadedTests.push(test.id);
cursor.CR();
output.test.skipped(test);
});
Expand Down Expand Up @@ -97,8 +98,13 @@ class Cli extends Base {
let skippedCount = 0;
const grep = runner._grep;
for (const test of suite.tests) {
if (!test.state && !this.failedTests.includes(test.id)) {
if (!test.state && !this.loadedTests.includes(test.id)) {
if (matchTest(grep, test.title)) {
if (!test.opts.skipInfo) {
test.opts.skipInfo = {};
}
test.opts.skipInfo.message = 'Skipped due to failure in \'before\' hook';
test.opts.skipInfo.isFastSkipped = true;
event.emit(event.test.skipped, test);
test.state = 'skipped';
output.test.skipped(test);
Expand Down