You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

gruntmock

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gruntmock - npm Package Compare versions

Comparing version

to
0.2.0

.travis.yml

16

Gruntfile.js

@@ -46,3 +46,4 @@ 'use strict';

{ src: ['*.js'], dest: 'root.js', extra: 0 },
{ src: ['test/*.js'], dest: 'test.js', extra: 1 }
{ src: ['test/*.js'], dest: 'test.js', extra: 1 },
{ nosrc: ['none'] }
]

@@ -59,3 +60,3 @@ },

template: {},
util: {},
util: {}
},

@@ -68,2 +69,9 @@

// Test data
testData: {
pass: {
who: 'me'
}
},
// Linting

@@ -91,3 +99,3 @@ jshint: {

grunt.loadNpmTasks('grunt-contrib-watch');
// Load test bench task

@@ -97,3 +105,3 @@ grunt.loadTasks('test');

// Default: run, test, and lint
grunt.registerTask('default', ['testBench', 'example', 'nodeunit', 'jshint']);
grunt.registerTask('default', ['testBench', 'example', 'testData', 'nodeunit', 'jshint']);
};

@@ -17,3 +17,3 @@ /*

// Implementation
var GruntMock = function(target, files, options) {
var GruntMock = function(target, files, options, data) {
var self = this;

@@ -70,2 +70,3 @@

flags: {},
data: data,
options: function(defaults) {

@@ -197,3 +198,2 @@ // Override defaults with options

d.on('error', function(err) {
d.dispose();
if (err === _success) {

@@ -217,3 +217,3 @@ // Success, pass null for err

*
* @param {Object} config Configuration object (target, files, options).
* @param {Object} config Configuration object (target, files, options, data).
* @return {GruntMock} A new instance of GruntMock.

@@ -226,3 +226,4 @@ */

config.files || [],
config.options || {});
config.options || {},
config.data || {});
};
{
"name": "gruntmock",
"description": "A simple mock for testing Grunt multi-tasks.",
"version": "0.1.1",
"version": "0.2.0",
"homepage": "https://github.com/DavidAnson/gruntMock",
"author": {
"name": "David Anson",
"url": "http://dlaa.me/"
},
"author": "David Anson (http://dlaa.me/)",
"repository": {
"type": "git",
"url": "git://github.com/DavidAnson/gruntMock.git"
"url": "https://github.com/DavidAnson/gruntMock.git"
},

@@ -17,8 +14,3 @@ "bugs": {

},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/DavidAnson/gruntMock/blob/master/LICENSE"
}
],
"license": "MIT",
"engines": {

@@ -29,3 +21,4 @@ "node": ">= 0.8.0"

"scripts": {
"test": "grunt nodeunit"
"test": "grunt nodeunit",
"test-cover": "istanbul cover node_modules/grunt-contrib-nodeunit/node_modules/nodeunit/bin/nodeunit"
},

@@ -36,6 +29,6 @@ "dependencies": {

"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-jshint": "^0.11.1",
"grunt-contrib-nodeunit": "^0.4.1",
"grunt-contrib-watch": "^0.6.1"
"grunt-contrib-watch": "^0.6.1",
"istanbul": "^0.3.8"
},

@@ -42,0 +35,0 @@ "peerDependencies": {

@@ -5,7 +5,13 @@ # gruntMock

[![npm version][npm-image]][npm-url]
[![GitHub tag][github-tag-image]][github-tag-url]
[![Build status][travis-image]][travis-url]
[![Coverage][coveralls-image]][coveralls-url]
[![License][license-image]][license-url]
## Overview
Some [Grunt](http://gruntjs.com/) tasks are thin wrappers over functionality that's already well tested (ex: [grunt-contrib-jshint](https://www.npmjs.org/package/grunt-contrib-jshint)). Other Grunt tasks offer custom functionality, specialized behavior, or need their output to be verified. gruntMock is targeted at the second set and offers a way to validate the complete, end-to-end lifecycle of a Grunt multi-task.
Some [Grunt](http://gruntjs.com/) tasks are thin wrappers over functionality that's already well tested (ex: [grunt-contrib-jshint](https://www.npmjs.com/package/grunt-contrib-jshint)). Other Grunt tasks offer custom functionality, specialized behavior, or need their output to be verified. gruntMock is targeted at the second set and offers a way to validate the complete, end-to-end lifecycle of a Grunt multi-task.
gruntMock is simple [mock object](http://en.wikipedia.org/wiki/Mock_object) that simulates the Grunt task runner for multi-tasks and can easily be integrated into a unit testing environment such as [Nodeunit](https://www.npmjs.org/package/nodeunit). gruntMock invokes tasks the same way Grunt does and exposes (almost) the same set of APIs. After providing input to a task, gruntMock runs and captures its output so tests can verify expected behavior. Task success and failure are unified, so it's easy to write positive and negative tests.
gruntMock is simple [mock object](http://en.wikipedia.org/wiki/Mock_object) that simulates the Grunt task runner for multi-tasks and can easily be integrated into a unit testing environment such as [Nodeunit](https://www.npmjs.com/package/nodeunit). gruntMock invokes tasks the same way Grunt does and exposes (almost) the same set of APIs. After providing input to a task, gruntMock runs and captures its output so tests can verify expected behavior. Task success and failure are unified, so it's easy to write positive and negative tests.

@@ -60,3 +66,3 @@ ## Example

*
* @param {Object} config Configuration object (target, files, options).
* @param {Object} config Configuration object (target, files, options, data).
* @return {GruntMock} A new instance of GruntMock.

@@ -131,2 +137,3 @@ */

* `async`
* `data`
* `errorCount`

@@ -158,1 +165,13 @@ * `files` (see note below)

* 0.1.1 - Lower-case package name per npm policy.
* 0.2.0 - Add support for this.data inside a task.
[npm-image]: https://img.shields.io/npm/v/gruntmock.svg
[npm-url]: https://www.npmjs.com/package/gruntmock
[github-tag-image]: https://img.shields.io/github/tag/DavidAnson/gruntMock.svg
[github-tag-url]: https://github.com/DavidAnson/gruntMock
[travis-image]: https://img.shields.io/travis/DavidAnson/gruntMock.svg
[travis-url]: https://travis-ci.org/DavidAnson/gruntMock
[coveralls-image]: https://img.shields.io/coveralls/DavidAnson/gruntMock.svg
[coveralls-url]: https://coveralls.io/r/DavidAnson/gruntMock
[license-image]: https://img.shields.io/npm/l/gruntmock.svg
[license-url]: http://opensource.org/licenses/MIT

@@ -32,3 +32,3 @@ // Unit tests for gruntMock

testLogs(test, mock,
['grunt version=0.1.1, package.name=gruntmock'],
['grunt version=0.2.0, package.name=gruntmock'],
[]);

@@ -52,3 +52,3 @@ test.done();

log: function(test) {
test.expect(30);
test.expect(31);
var mock = gruntMock.create({ target: 'log' });

@@ -61,3 +61,3 @@ mock.invoke(testBench, function(err) {

'verbose.ok', 'verbose.or.ok', 'grunt, log, wordlist', 'grunt log\nwraptext', '12 3 4 5 ',
'log.fail', 'log.header', 'log.success', 'log.warn', 'log.writelns', '12 3 4 ', '4'],
'log.fail', 'log.header', 'log.success', 'ERROR', 'log.warn', 'log.writelns', '12 3 4 ', '4'],
['ERROR', 'false', 'log.error', 'log.errorlns']);

@@ -163,3 +163,3 @@ test.done();

filesArray: function(test) {
test.expect(6);
test.expect(7);
var mock = gruntMock.create({

@@ -170,2 +170,3 @@ target: 'filesArray',

{ src: ['c.txt'], dest: 'd.txt', extra: 1 },
{ nosrc: ['none'] }
]

@@ -178,2 +179,3 @@ });

'Item: { src: [ \'c.txt\' ], dest: \'d.txt\', extra: 1 }',
'Item: { nosrc: [ \'none\' ] }',
'a.txt,b.txt,c.txt'],

@@ -180,0 +182,0 @@ []);

@@ -62,2 +62,3 @@ // A task to exercise the Grunt API and validate gruntMock

grunt.log.success('log.success');
grunt.log.warn();
grunt.log.warn('log.warn');

@@ -71,3 +72,3 @@ grunt.log.writelns('log.writelns');

grunt.warn('fail.warn');
grunt.log.ok('unreachable');
throw new Error('unreachable');
};

@@ -77,3 +78,3 @@

grunt.fatal('fail.fatal');
grunt.log.ok('unreachable');
throw new Error('unreachable');
};

@@ -111,3 +112,2 @@

done();
grunt.log.ok('unreachable');
}, 1);

@@ -120,3 +120,2 @@ };

done();
grunt.log.ok('unreachable');
});

@@ -129,3 +128,2 @@ };

done(true);
grunt.log.ok('unreachable');
}, 1);

@@ -138,3 +136,2 @@ };

done(false);
grunt.log.ok('unreachable');
}, 1);

@@ -147,3 +144,2 @@ };

done(new Error('asyncError'));
grunt.log.ok('unreachable');
}, 1);

@@ -156,3 +152,3 @@ };

grunt.fatal('asyncFatal');
grunt.log.ok('unreachable');
throw new Error('unreachable');
}, 1);

@@ -159,0 +155,0 @@ };

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet