Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
PhantomJS to 2.x
  • Loading branch information
eugenet8k committed Sep 28, 2016
1 parent 3b5e1c4 commit 5c78fa6
Show file tree
Hide file tree
Showing 10 changed files with 126 additions and 107 deletions.
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
# grunt-blanket-mocha

[![No Maintenance Intended](http://unmaintained.tech/badge.svg)](http://unmaintained.tech/)

# Unmaintained!

This project is no longer maintained. Feel free to fork and continue development!
# grunt-mocha-blanket

> Headless Blanket.js code coverage and Mocha testing via PhantomJS
## Wat?
## What?

Other plugins look similar, but are different in that they:

Expand All @@ -32,18 +26,18 @@ configurations of that plugin as of that version. Please see that repo for more
Changes from the upstream plugin will be merged periodically.

## Getting Started
This plugin requires Grunt `~0.4.1`
This plugin requires Grunt `~0.4.5`

If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

```shell
npm install grunt-blanket-mocha --save-dev
npm install grunt-mocha-blanket --save-dev
```

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

```js
grunt.loadNpmTasks('grunt-blanket-mocha');
grunt.loadNpmTasks('grunt-mocha-blanket');
```

## Dependencies
Expand Down Expand Up @@ -93,7 +87,7 @@ other scripts:
```html
<script>
if (window.PHANTOMJS) {
blanket.options("reporter", "../node_modules/grunt-blanket-mocha/support/grunt-reporter.js");
blanket.options("reporter", "../node_modules/grunt-mocha-blanket/support/grunt-reporter.js");
}
</script>
```
Expand All @@ -111,7 +105,7 @@ If you want to see blanketJS coverage reports in the browser as well (useful for
coverage and which do not) include this snippet it in your test html blanket and mocha.

```html
<script type="text/javascript" src="../node_modules/grunt-blanket-mocha/support/mocha-blanket.js"></script>
<script type="text/javascript" src="../node_modules/grunt-mocha-blanket/support/mocha-blanket.js"></script>
```

NOTE: The above path is assuming that the specs are being run from a directory one deeper than the root directory.
Expand Down Expand Up @@ -248,6 +242,11 @@ In lieu of a formal styleguide, take care to maintain the existing coding style.

## Release History

## 0.6.1
*Released 28 September 2016*

* Update PhantomJS to 2.x.

## 0.4.1
*Released 17 June 2014*

Expand Down
4 changes: 2 additions & 2 deletions example-requirejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

1. First, `cd` to the `examples` directory (this directory)
2. Next, run `npm install`
3. Run `grunt`
4. You should see some tests run, and a coverage report which will demonstrate a failure at the "per-module" level.
3. Run `npm run grunt`
4. You should see some tests run, and a coverage report which will demonstrate a failure at the "per-module" level.
15 changes: 10 additions & 5 deletions example-requirejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "grunt-blanket-mocha-test",
"description": "Test for grunt-blanket-mocha.",
"version": "0.5.1",
"homepage": "https://github.com/ModelN/grunt-blanket-mocha",
"homepage": "https://github.com/eugenet8k/grunt-mocha-blanket-test",
"author": {
"name": "Dave Cadwallader",
"email": "dcadwallader@gmail.com"
Expand All @@ -16,12 +16,17 @@
"engines": {
"node": ">= 0.8.0"
},
"scripts": {
"grunt": "grunt",
"test": "grunt test"
},
"devDependencies": {
"grunt-blanket-mocha": "0.4.2",
"grunt": "0.4.1",
"mocha": "2.0.1",
"chai": "1.8.1",
"blanket": "1.1.6",
"chai": "1.8.1",
"grunt-mocha-blanket": "0.6.1",
"grunt-cli": "1.2.0",
"grunt": "0.4.5",
"mocha": "2.0.1",
"requirejs": "2.1.10"
}
}
8 changes: 4 additions & 4 deletions example-requirejs/test.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<html>
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Mocha Tests</title>
Expand All @@ -11,13 +11,13 @@
data-cover-flags="branchTracking"
data-cover-only="//src/"></script>

<script type="text/javascript" src="node_modules/grunt-blanket-mocha/support/mocha-blanket.js"></script>
<script type="text/javascript" src="node_modules/grunt-mocha-blanket/support/mocha-blanket.js"></script>

<script>
mocha.setup('bdd');

if (window.PHANTOMJS) {
blanket.options("reporter", "node_modules/grunt-blanket-mocha/support/grunt-reporter.js"
blanket.options("reporter", "node_modules/grunt-mocha-blanket/support/grunt-reporter.js"
);
}

Expand All @@ -36,4 +36,4 @@
<div id="mocha"></div>

</body>
</html>
</html>
4 changes: 2 additions & 2 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

1. First, `cd` to the `examples` directory (this directory)
2. Next, run `npm install`
3. Run `grunt`
4. You should see some tests run, and a coverage report which will demonstrate a failure at the "per-module" level.
3. Run `npm run grunt`
4. You should see some tests run, and a coverage report which will demonstrate a failure at the "per-module" level.
15 changes: 10 additions & 5 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "grunt-blanket-mocha-test",
"description": "Test for grunt-blanket-mocha.",
"version": "0.5.1",
"homepage": "https://github.com/ModelN/grunt-blanket-mocha",
"homepage": "https://github.com/eugenet8k/grunt-mocha-blanket-test",
"author": {
"name": "Dave Cadwallader",
"email": "dcadwallader@gmail.com"
Expand All @@ -16,11 +16,16 @@
"engines": {
"node": ">= 0.8.0"
},
"scripts": {
"grunt": "grunt",
"test": "grunt test"
},
"devDependencies": {
"grunt-blanket-mocha": "0.4.2",
"grunt": "0.4.1",
"mocha": "2.0.1",
"blanket": "1.1.6",
"chai": "1.8.1",
"blanket": "1.1.6"
"grunt-mocha-blanket": "0.6.1",
"grunt-cli": "1.2.0",
"grunt": "0.4.5",
"mocha": "2.0.1"
}
}
6 changes: 3 additions & 3 deletions example/test.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<html>
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Mocha Tests</title>
Expand All @@ -16,15 +16,15 @@
data-cover-flags="branchTracking"
data-cover-only="//src/"></script>

<script type="text/javascript" src="node_modules/grunt-blanket-mocha/support/mocha-blanket.js"></script>
<script type="text/javascript" src="node_modules/grunt-mocha-blanket/support/mocha-blanket.js"></script>

<script>
window.expect = chai.expect;

mocha.setup('bdd');

if (window.PHANTOMJS) {
blanket.options("reporter", "node_modules/grunt-blanket-mocha/support/grunt-reporter.js"
blanket.options("reporter", "node_modules/grunt-mocha-blanket/support/grunt-reporter.js"
);
}
</script>
Expand Down
52 changes: 30 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,59 +1,67 @@
{
"name": "grunt-blanket-mocha",
"name": "grunt-mocha-blanket",
"description": "Headless Blanket.js code coverage and Mocha testing via PhantomJS",
"version": "0.5.0",
"homepage": "https://github.com/ModelN/grunt-blanket-mocha",
"version": "0.6.1",
"homepage": "https://github.com/eugenet8k/grunt-mocha-blanket",
"author": {
"name": "Dave Cadwallader",
"email": "dcadwallader@gmail.com",
"url": "http://geekdave.com"
},
"contributors": {
"name": "Sean Coker",
"email": "hello@sean.is",
"url": "http://sean.is"
},
"contributors": [
{
"name": "Sean Coker",
"email": "hello@sean.is",
"url": "http://sean.is"
},
{
"name": "Eugene Tiutiunnyk",
"email": "eugenet8k@gmail.com"
}
],
"repository": {
"type": "git",
"url": "git://github.com/ModelN/grunt-blanket-mocha.git"
"url": "git@github.com:eugenet8k/grunt-mocha-blanket.git"
},
"bugs": {
"url": "https://github.com/ModelN/grunt-blanket-mocha/issues"
"url": "https://github.com/eugenet8k/grunt-mocha-blanket/issues"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/ModelN/grunt-blanket-mocha/blob/master/LICENSE-MIT"
"url": "https://github.com/eugenet8k/grunt-mocha-blanket/blob/master/LICENSE-MIT"
}
],
"main": "Gruntfile.js",
"engines": {
"node": ">= 0.8.0"
},
"scripts": {
"test": "./node_modules/.bin/grunt test"
"grunt": "grunt",
"test": "grunt test"
},
"dependencies": {
"blanket": "~1.1.6",
"grunt-lib-phantomjs": "~0.6.0",
"mocha": "~2.0.1",
"lodash": "~2.4.1"
"grunt-lib-phantomjs": "1.0.0",
"lodash": "~2.4.1",
"mocha": "~2.0.1"
},
"peerDependencies": {
"grunt": "~0.4"
"grunt": "0.4.5"
},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-connect": "~0.5.0",
"grunt-contrib-jshint": "~0.7.1"
"grunt-cli": "1.2.0",
"grunt-contrib-connect": "1.0.2",
"grunt-contrib-jshint": "1.0.0",
"grunt": "0.4.5"
},
"keywords": [
"gruntplugin",
"blanket",
"blanketjs",
"coverage",
"gruntplugin",
"mocha",
"test",
"phantomjs"
"phantomjs",
"test"
]
}
59 changes: 25 additions & 34 deletions phantomjs/bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,43 +33,41 @@
}

sendMessage('mocha.' + ev, data);

});
}

// 1.4.2 moved reporters to Mocha instead of mocha
var mochaInstance = window.Mocha || window.mocha;

function createBlanketReporter(runner) {
runner.on('start', function() {
window.blanket.setupCoverage();
});
runner.on('start', function() {
window.blanket.setupCoverage();
});

runner.on('end', function() {
window.blanket.onTestsDone();
});
runner.on('end', function() {
window.blanket.onTestsDone();
});

runner.on('suite', function() {
window.blanket.onModuleStart();
});
runner.on('suite', function() {
window.blanket.onModuleStart();
});

runner.on('test', function() {
window.blanket.onTestStart();
});
runner.on('test', function() {
window.blanket.onTestStart();
});

runner.on('test end', function(test) {
window.blanket.onTestDone(test.parent.tests.length, test.state === 'passed');
});
runner.on('test end', function(test) {
window.blanket.onTestDone(test.parent.tests.length, test.state === 'passed');
});

//I dont know why these became global leaks
runner.globals(['stats', 'failures', 'runner']);
//I dont know why these became global leaks
runner.globals(['stats', 'failures', 'runner']);
}

// 1.4.2 moved reporters to Mocha instead of mocha
var mochaInstance = window.Mocha || window.mocha;

var GruntReporter = function(runner){

var GruntReporter = function(runner) {
if (!mochaInstance) {
throw new Error('Mocha was not found, make sure you include Mocha in your HTML spec file.');
}
Expand All @@ -95,7 +93,6 @@
}

createBlanketReporter(runner);

};

var Klass = function () {};
Expand All @@ -105,29 +102,23 @@
var options = window.PHANTOMJS;
// Default mocha options
var config = {
ui: 'bdd',
ignoreLeaks: true,
reporter: GruntReporter
},
run = options.run || false,
key;
ui: 'bdd',
ignoreLeaks: true,
reporter: GruntReporter
};

if (options) {
// If options is a string, assume it is to set the UI (bdd/tdd etc)
if (typeof options === "string") {
config.ui = options;
} else {
// Extend defaults with passed options
for (key in options.mocha) {
for (var key in options.mocha) {
config[key] = options.mocha[key];
}
}
}

mocha.setup(config);

// task option `run`, automatically runs mocha for grunt only
if (run) {
mocha.run();
}
mocha.run();
}());

0 comments on commit 5c78fa6

Please sign in to comment.