-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(reporter): update icons when on windows to be compatible
- Loading branch information
Tom McGeehon
committed
Apr 7, 2016
1 parent
e42aa92
commit 3d511a3
Showing
3 changed files
with
76 additions
and
7 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 |
---|---|---|
@@ -1,21 +1,58 @@ | ||
/* global beforeEach, it, describe */ | ||
|
||
'use strict'; | ||
/* | ||
* Based upon "Function.prototype.bind polyfill for PhantomJS" | ||
* author: Tom Watson <[email protected]> | ||
* homepage: https://github.com/tom-james-watson/phantomjs-polyfill | ||
* | ||
* This fixes a compatibility issue with running Phantom1 with Angular 1.5 | ||
*/ | ||
|
||
/* jshint ignore:start */ | ||
|
||
// if (typeof Function.prototype.bind != 'function') { | ||
// Function.prototype.bind = function bind(obj) { | ||
// var args = Array.prototype.slice.call(arguments, 1), | ||
// self = this, | ||
// nop = function() { | ||
// }, | ||
// bound = function() { | ||
// return self.apply( | ||
// this instanceof nop ? this : (obj || {}), args.concat( | ||
// Array.prototype.slice.call(arguments) | ||
// ) | ||
// ); | ||
// }; | ||
// nop.prototype = this.prototype || {}; | ||
// bound.prototype = new nop(); | ||
// return bound; | ||
// }; | ||
// } | ||
|
||
/* jshint ignore:end */ | ||
|
||
var rewire = require('rewire'); | ||
var chai = require('chai'); | ||
var sinon = require('sinon'); | ||
var sinonChai = require('sinon-chai'); | ||
chai.use(sinonChai); | ||
var should = chai.should(); | ||
var expect = chai.expect; | ||
|
||
var SpecReporter = require('../index')['reporter:spec']; | ||
var reporterRewire = rewire('../index.js'); | ||
var SpecReporter = require('../index.js')['reporter:spec']; | ||
|
||
var ansiColors = { | ||
red: '\u001b[31m', | ||
yellow: '\u001b[33m', | ||
green: '\u001b[32m', | ||
reset: '\u001b[39m' | ||
}; | ||
var windowsIcons = { | ||
success: '\u221A', | ||
failure: '\u00D7', | ||
skipped: '.' | ||
} | ||
|
||
//baseReporterDecorator functions | ||
var formatError = function (a, b) { | ||
|
@@ -30,6 +67,31 @@ var baseReporterDecorator = function (context) { | |
|
||
describe('SpecReporter', function () { | ||
describe('when initializing', function () { | ||
describe('and on a windows machine', function () { | ||
var newSpecReporter; | ||
var config = {}; | ||
|
||
beforeEach(function () { | ||
var processMock = { | ||
platform: function () { | ||
return 'win32'; | ||
} | ||
}; | ||
reporterRewire.__set__({ | ||
'reporter:spec': SpecReporter, | ||
process: { | ||
platform: 'win32' | ||
} | ||
}); | ||
newSpecReporter = new reporterRewire['reporter:spec'][1](baseReporterDecorator, formatError, config); | ||
}); | ||
|
||
it('SpecReporter should have icons defined appropriately', function () { | ||
newSpecReporter.prefixes.success.should.equal(windowsIcons.success); | ||
newSpecReporter.prefixes.failure.should.equal(windowsIcons.failure); | ||
newSpecReporter.prefixes.skipped.should.equal(windowsIcons.skipped); | ||
}); | ||
}); | ||
describe('and colors are not defined', function () { | ||
var newSpecReporter; | ||
var config = {}; | ||
|
The problem with doing this is that it will overwrite the user configuration from reporterCfg.prefixes.
I think this should be done differently to allow the user customisations to remain.
e.g.