Skip to content

Commit

Permalink
fix(colors): replace colors.js with chalk
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieMason committed Mar 9, 2017
1 parent ec3f0e7 commit 10daf6a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

> A Karma plugin. Report results with each describe indented.
[![npm downloads](https://img.shields.io/npm/dm/karma-nested-reporter.svg?style=flat-square)](https://www.npmjs.com/package/karma-nested-reporter)
[![npm downloads](https://img.shields.io/npm/dm/karma-nested-reporter.svg?style=flat-square)](https://www.npmjs.com/package/karma-nested-reporter)
[![Analytics](https://ga-beacon.appspot.com/UA-45466560-5/karma-nested-reporter?flat&useReferer)](https://github.com/igrigorik/ga-beacon)
[![GitHub stars](https://img.shields.io/github/stars/JamieMason/karma-nested-reporter.svg?style=social&label=Star)](https://github.com/JamieMason/karma-nested-reporter)
[![GitHub followers](https://img.shields.io/github/followers/JamieMason.svg?style=social&label=Follow)](https://github.com/JamieMason)
[![GitHub stars](https://img.shields.io/github/stars/JamieMason/karma-nested-reporter.svg?style=social&label=Star)](https://github.com/JamieMason/karma-nested-reporter)
[![GitHub followers](https://img.shields.io/github/followers/JamieMason.svg?style=social&label=Follow)](https://github.com/JamieMason)
[![Twitter](https://img.shields.io/twitter/url/https/github.com/JamieMason/karma-nested-reporter.svg?style=social)](https://twitter.com/intent/tweet?text=Easy%20to%20read%20test%20output%20with%20nested%20describe%20and%20it%20blocks.%20%23JavaScript%20%23NodeJS&url=https%3A%2F%2Fgithub.com%2FJamieMason%2Fkarma-nested-reporter)

![screenshot of karma nested reporter](https://github.com/JamieMason/karma-nested-reporter/blob/master/karma-nested-reporter.png)
Expand All @@ -17,15 +17,15 @@ The easiest way is to keep `karma-nested-reporter` as a devDependency in your `p
```json
{
"devDependencies": {
"karma": "~0.10",
"karma-nested-reporter": "~0.1"
"karma": ">=0.9",
"karma-nested-reporter": "0.1.5"
}
}
```

You can simply do it with:

```bash
```
npm install karma-nested-reporter --save-dev
```

Expand Down Expand Up @@ -76,7 +76,7 @@ module.exports = function(config) {
This reporter will output in color if `colors: true` is present in your Karma configuration.

Colors can be optionally overridden with any of the values defined by
[colors.js' colors and styles](https://github.com/marak/colors.js/#colors-and-styles).
[chalk's colors and styles](https://github.com/chalk/chalk).

### Icons

Expand All @@ -86,4 +86,3 @@ other icons can be substituted for others.
## The Karma Test Runner

For more information on Karma see the [homepage](http://karma-runner.github.com).

24 changes: 12 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var chalk = require('chalk');
var util = require('util');

function NestedReporter(extendBaseReporter, formatError, config, options) {
Expand All @@ -20,19 +21,18 @@ function NestedReporter(extendBaseReporter, formatError, config, options) {
options.color.browser = options.color.browser || 'yellow';

if (config.colors) {
require('colors');
self.USE_COLORS = true;
self.LOG_SINGLE_BROWSER = '%s: ' + '%s'.cyan + '\n';
self.LOG_MULTI_BROWSER = '%s %s: ' + '%s'.cyan + '\n';
self.SPEC_FAILURE = '%s %s FAILED'.red + '\n';
self.SPEC_SLOW = '%s SLOW %s: %s'.yellow + '\n';
self.ERROR = '%s ERROR'.red + '\n';
self.FINISHED_ERROR = ' ERROR'.red;
self.FINISHED_SUCCESS = ' SUCCESS'.green;
self.FINISHED_DISCONNECTED = ' DISCONNECTED'.red;
self.X_FAILED = ' (%d FAILED)'.red;
self.TOTAL_SUCCESS = 'TOTAL: %d SUCCESS'.green + '\n';
self.TOTAL_FAILED = 'TOTAL: %d FAILED, %d SUCCESS'.red + '\n';
self.LOG_SINGLE_BROWSER = '%s: ' + chalk.cyan('%s') + '\n';
self.LOG_MULTI_BROWSER = '%s %s: ' + chalk.cyan('%s') + '\n';
self.SPEC_FAILURE = chalk.red('%s %s FAILED') + '\n';
self.SPEC_SLOW = chalk.yellow('%s SLOW %s: %s') + '\n';
self.ERROR = chalk.red('%s ERROR') + '\n';
self.FINISHED_ERROR = chalk.red(' ERROR');
self.FINISHED_SUCCESS = chalk.green(' SUCCESS');
self.FINISHED_DISCONNECTED = chalk.red(' DISCONNECTED');
self.X_FAILED = chalk.red(' (%d FAILED)');
self.TOTAL_SUCCESS = chalk.green('TOTAL: %d SUCCESS') + '\n';
self.TOTAL_FAILED = chalk.red('TOTAL: %d FAILED, %d SUCCESS') + '\n';
}

self.onBrowserComplete = function() {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"Jamie Mason (https://github.com/JamieMason)"
],
"dependencies": {
"colors": "~0.6.2",
"chalk": "1.1.3",
"karma": ">=0.9"
},
"homepage": "https://github.com/JamieMason/karma-nested-reporter",
Expand Down

0 comments on commit 10daf6a

Please sign in to comment.