~endlessm/jasmine-gjs/trunk

« back to all changes in this revision

Viewing changes to src/tapReporter.js

  • Committer: Philip Chimento
  • Date: 2020-08-15 18:13:47 UTC
  • Revision ID: git-v1:452c83fe6c924d5b94315b98e189441971960dc2
let -> const

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
        if (result.status === 'disabled') {
40
40
            this._print('# Suite was disabled: %s\n'.format(result.fullName));
41
41
        } else {
42
 
            let failures = result.failedExpectations.length;
 
42
            const failures = result.failedExpectations.length;
43
43
            this._print('# Suite finished with %d %s: %s\n'.format(failures,
44
44
                failures === 1 ? 'failure' : 'failures', result.fullName));
45
45
        }
54
54
            this._print('ok');
55
55
        this._print(' %d - %s'.format(this._specCount, result.fullName));
56
56
        if (result.status === 'pending' || result.status === 'disabled') {
57
 
            let reason = result.pendingReason || result.status;
 
57
            const reason = result.pendingReason || result.status;
58
58
            this._print(` # SKIP ${reason}`);
59
59
        }
60
60
        if (result.status === 'failed' && result.failedExpectations) {
61
 
            let messages = result.failedExpectations.map(r => _removeNewlines(r.message)).join(' ');
 
61
            const messages = result.failedExpectations.map(r => _removeNewlines(r.message)).join(' ');
62
62
            this._print(' (%s)'.format(messages));
63
63
        }
64
64
        this._print('\n');
68
68
            result.failedExpectations.forEach(failedExpectation => {
69
69
                this._print('# Message: %s\n'.format(_removeNewlines(failedExpectation.message)));
70
70
                this._print('# Stack:\n');
71
 
                let stackTrace = this.filterStack(failedExpectation.stack).trim();
 
71
                const stackTrace = this.filterStack(failedExpectation.stack).trim();
72
72
                this._print(stackTrace.split('\n').map(str => `#   ${str}`).join('\n'));
73
73
                this._print('\n');
74
74
            });
77
77
});
78
78
 
79
79
function _removeNewlines(str) {
80
 
    let allNewlines = /\n/g;
 
80
    const allNewlines = /\n/g;
81
81
    return str.replace(allNewlines, '\\n');
82
82
}