Skip to content

Commit

Permalink
Cherry pick
Browse files Browse the repository at this point in the history
  • Loading branch information
baruchiro committed Feb 16, 2020
1 parent 2115b74 commit 2fd2ad4
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions test/e2e/screenshotEnvironment.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
const JSDOMEnvironment = require('jest-environment-jsdom')
const JSDOMEnvironment = require('jest-environment-jsdom');

class ScreenshotEnvironment extends JSDOMEnvironment {
constructor(config, context) {
super(config, context)
super(config, context);

this.global.hasTestFailures = false;
this.global.lastTest = {};
}

handleTestEvent(event) {
this.global.lastTest = {
failed: event.name === 'test_fn_failure',
test: event.test,
};
switch (event.name) {
case 'test_fn_success':
this.global.lastTest = {
failed: false,
test: event.test,
};
break;
case 'test_fn_failure':
this.global.lastTest = {
failed: true,
test: event.test,
};
break;
default:
break;
}
}
}

Expand Down

0 comments on commit 2fd2ad4

Please sign in to comment.