-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added istanbul/jsdom for code coverage and leaner tests. Changed `inn…
…erText` usage to `textContent` based on [this discussion](jsdom/jsdom#1245). Added tests for many evaluators.
- Loading branch information
Showing
7 changed files
with
234 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
var jsdom = require('jsdom'); | ||
|
||
describe('getFailedSpecs', function() { | ||
|
||
describe('returns the failed tests with their names, failure reason, and call stacks as objects in an array', function() { | ||
|
||
beforeAll(function() { | ||
this.evaluator = require('../../lib/evaluators/evaluators.js' ).getFailedSpecs; | ||
}); | ||
|
||
afterAll(function() { | ||
global.document = this.realDocument; | ||
}); | ||
|
||
function setDom(dom) { | ||
this.document = jsdom.jsdom(dom); | ||
var global = (function() { return this; })(); | ||
this.realDocument = global.document; | ||
global.document = this.document; | ||
} | ||
|
||
it('detects success summary', function() { | ||
setDom('<body><div class="jasmine_html-reporter">' + | ||
'<div class="jasmine-spec-detail jasmine-failed">' + | ||
'<div class="jasmine-description">desc1</div>' + | ||
'<div class="jasmine-messages">' + | ||
'<div class="jasmine-result-message">msg1.1</div>' + | ||
'</div>' + | ||
'<div class="jasmine-stack-trace">stacktrace1</div>' + | ||
'</div>' + | ||
'<div class="jasmine-spec-detail jasmine-failed">' + | ||
'<div class="jasmine-description">desc2</div>' + | ||
'<div class="jasmine-messages">' + | ||
'<div class="jasmine-result-message">msg2.1</div>' + | ||
'<div class="jasmine-result-message">msg2.2</div>' + | ||
'</div>' + | ||
'<div class="jasmine-stack-trace">stacktrace2</div>' + | ||
'</div>' + | ||
'</div></body>'); | ||
|
||
var actual = this.evaluator(); | ||
expect( actual ).toEqual([ | ||
{ | ||
desc: ['desc1'], | ||
fail: ['msg1.1'], | ||
failStackTrace: ['stacktrace1'] | ||
}, | ||
{ | ||
desc: ['desc2'], | ||
fail: ['msg2.1', 'msg2.2'], | ||
failStackTrace: ['stacktrace2'] | ||
} | ||
]); | ||
}); | ||
|
||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
var jsdom = require('jsdom'); | ||
|
||
describe('getPendingSpecs', function() { | ||
|
||
describe('returns the pending tests with their names as objects in an array', function() { | ||
|
||
beforeAll(function() { | ||
this.evaluator = require('../../lib/evaluators/evaluators.js' ).getPendingSpecs; | ||
}); | ||
|
||
afterAll(function() { | ||
global.document = this.realDocument; | ||
}); | ||
|
||
function setDom(dom) { | ||
this.document = jsdom.jsdom(dom); | ||
var global = (function() { return this; })(); | ||
this.realDocument = global.document; | ||
global.document = this.document; | ||
} | ||
|
||
it('detects summary', function() { | ||
setDom('<div class="jasmine_html-reporter">' + | ||
'<div class="jasmine-summary">' + | ||
'<div class="pending">' + | ||
'<div class="jasmine-messages">' + | ||
'<div class="jasmine-result-message">Some skipped test</div>' + | ||
'</div>' + | ||
'<div class="jasmine-stack-trace">stack trace info</div>' + | ||
'</div>' + | ||
'</div>' + | ||
'</div>'); | ||
|
||
var actual = this.evaluator(); | ||
expect( actual ).toEqual([{name:'Some skipped teststack trace info'}]); | ||
}); | ||
|
||
it('detects multiple summaries', function() { | ||
setDom('<div class="jasmine_html-reporter">' + | ||
'<div class="jasmine-summary">' + | ||
'<div class="pending">' + | ||
'<div class="jasmine-messages">' + | ||
'<div class="jasmine-result-message">Some skipped test1</div>' + | ||
'</div>' + | ||
'<div class="jasmine-stack-trace">stack trace info1</div>' + | ||
'</div>' + | ||
'<div class="pending">' + | ||
'<div class="jasmine-messages">' + | ||
'<div class="jasmine-result-message">Some skipped test2</div>' + | ||
'</div>' + | ||
'<div class="jasmine-stack-trace">stack trace info2</div>' + | ||
'</div>' + | ||
'</div>'); | ||
|
||
var actual = this.evaluator(); | ||
expect( actual ).toEqual([ | ||
{name:'Some skipped test1stack trace info1'}, | ||
{name:'Some skipped test2stack trace info2'} | ||
]); | ||
}); | ||
|
||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
var jsdom = require('jsdom'); | ||
|
||
describe('getResultSummarySpec', function() { | ||
|
||
describe('returns the summary blurb from page', function() { | ||
|
||
beforeAll(function() { | ||
this.evaluator = require('../../lib/evaluators/evaluators.js' ).getResultSummary; | ||
}); | ||
|
||
afterAll(function() { | ||
global.document = this.realDocument; | ||
}); | ||
|
||
function setDom(dom) { | ||
this.document = jsdom.jsdom(dom); | ||
var global = (function() { return this; })(); | ||
this.realDocument = global.document; | ||
global.document = this.document; | ||
} | ||
|
||
it('detects success summary', function() { | ||
setDom('<body><div class="jasmine-bar">' + | ||
'38 specs' + | ||
'</div></body>'); | ||
|
||
var actual = this.evaluator(); | ||
expect( actual ).toBe('38 specs'); | ||
}); | ||
|
||
it('detects failure', function() { | ||
setDom('<body><div class="jasmine-alert">' + | ||
'<span class="jasmine-bar">38 specs | 1 failing</span>' + | ||
'</div></body>'); | ||
|
||
var actual = this.evaluator(); | ||
expect( actual ).toBe('38 specs | 1 failing'); | ||
}); | ||
|
||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
var jsdom = require('jsdom'); | ||
|
||
describe('getSymbolsStatusArray', function() { | ||
|
||
describe('returns the status array from page', function() { | ||
|
||
beforeAll(function() { | ||
this.evaluator = require('../../lib/evaluators/evaluators.js' ).getSymbolsStatusArray; | ||
}); | ||
|
||
beforeEach(function() { | ||
this.document = jsdom.jsdom('<body><div class="jasmine-symbol-summary">' + | ||
'<li class="passing">.</li>' + | ||
'<li class="pending">?</li>' + | ||
'<li class="failed">x</li>' + | ||
'<li class="passing">.</li>' + | ||
'<li class="unexpected">Y?</li>' + | ||
'</div></body>'); | ||
|
||
var global = (function() { return this; })(); | ||
this.realDocument = global.document; | ||
global.document = this.document; | ||
}); | ||
|
||
afterAll(function() { | ||
global.document = this.realDocument; | ||
}); | ||
|
||
it('returns jasmine title and version from page', function() { | ||
var actual = this.evaluator(); | ||
expect( actual ).toEqual([ | ||
'passing', | ||
'pending', | ||
'failed', | ||
'passing', | ||
'unexpected' | ||
]); | ||
}); | ||
|
||
}); | ||
|
||
}); |