Skip to content

Commit 703dbd4

Browse files
committed
refactor spec reporter according to alpha
1 parent 30451e2 commit 703dbd4

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

spec/helper.js

+5-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
'use strict';
2+
const CurrentSpecReporter = require('./support/CurrentSpecReporter.js');
3+
const { SpecReporter } = require('jasmine-spec-reporter');
4+
25
// Sets up a Parse API server for testing.
36
jasmine.DEFAULT_TIMEOUT_INTERVAL = process.env.PARSE_SERVER_TEST_TIMEOUT || 5000;
4-
5-
const SpecReporter = require('jasmine-spec-reporter').SpecReporter;
6-
7-
jasmine.getEnv().clearReporters(); // remove default reporter logs
8-
jasmine.getEnv().addReporter(
9-
new SpecReporter({
10-
// add jasmine-spec-reporter
11-
spec: {
12-
displayPending: true,
13-
},
14-
})
15-
);
7+
jasmine.getEnv().addReporter(new CurrentSpecReporter());
8+
jasmine.getEnv().addReporter(new SpecReporter());
169

1710
global.on_db = (db, callback, elseCallback) => {
1811
if (process.env.PARSE_SERVER_TEST_DB == db) {

spec/support/CurrentSpecReporter.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Sets a global variable to the current test spec
2+
// ex: global.currentSpec.description
3+
4+
global.currentSpec = null;
5+
6+
class CurrentSpecReporter {
7+
specStarted(spec) {
8+
global.currentSpec = spec;
9+
}
10+
specDone() {
11+
global.currentSpec = null;
12+
}
13+
}
14+
15+
module.exports = CurrentSpecReporter;

0 commit comments

Comments
 (0)