Comparing version 0.3.0 to 0.3.1
{ | ||
"name": "empower", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"main": [ | ||
@@ -13,5 +13,16 @@ "lib/empower.js", | ||
"package.json", | ||
"test", | ||
"test_helper.js" | ||
] | ||
"coverage", | ||
"test" | ||
], | ||
"dependencies": { | ||
"es5-shim": "~2.2.0" | ||
}, | ||
"devDependencies": { | ||
"espower": "~0.3.0", | ||
"esprima": "~1.0.4", | ||
"escodegen": "~0.0.28", | ||
"mocha": "~1.16.2", | ||
"requirejs": "~2.1.5", | ||
"assert": "Jxck/assert" | ||
} | ||
} |
@@ -8,2 +8,10 @@ module.exports = function(grunt) { | ||
pkg: pkg, | ||
bower: { | ||
all: { | ||
rjsConfig: 'test/rjsconfig.js', | ||
options: { | ||
baseUrl: 'test' | ||
} | ||
} | ||
}, | ||
bump: { | ||
@@ -24,2 +32,11 @@ options: { | ||
}, | ||
connect: { | ||
server: { | ||
options: { | ||
port: 9001, | ||
base: '.', | ||
keepalive: true | ||
} | ||
} | ||
}, | ||
jshint: { | ||
@@ -33,2 +50,16 @@ files: [ | ||
}, | ||
mocha: { | ||
browser: { | ||
src: ['test/test-browser.html'], | ||
options: { | ||
run: true | ||
} | ||
}, | ||
amd: { | ||
src: ['test/test-amd.html'], | ||
options: { | ||
run: false | ||
} | ||
} | ||
}, | ||
mochaTest: { | ||
@@ -40,3 +71,3 @@ unit: { | ||
}, | ||
src: ['test/**/*.js'] | ||
src: ['test/**/*_test.js'] | ||
}, | ||
@@ -51,3 +82,3 @@ coverage: { | ||
}, | ||
src: ['test/**/*.js'] | ||
src: ['test/**/*_test.js'] | ||
} | ||
@@ -58,3 +89,3 @@ }, | ||
files: ['test/**/*.js', 'lib/**/*.js'], | ||
tasks: ['test'] | ||
tasks: ['unit'] | ||
} | ||
@@ -64,4 +95,5 @@ } | ||
grunt.registerTask('test', ['jshint', 'mochaTest:unit']); | ||
grunt.registerTask('unit', ['jshint', 'mochaTest:unit']); | ||
grunt.registerTask('test', ['jshint', 'mochaTest:unit', 'mocha:browser', 'mocha:amd']); | ||
grunt.registerTask('coverage', ['mochaTest:coverage']); | ||
}; |
{ | ||
"name": "empower", | ||
"description": "Power Assert feature enhancer for assert function/object", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"keywords": [ | ||
@@ -17,2 +17,3 @@ "test", | ||
"scripts": { | ||
"bower": "./node_modules/bower/bin/bower install", | ||
"test": "grunt test", | ||
@@ -39,5 +40,9 @@ "coveralls": "grunt coverage && cat ./coverage.lcov | ./node_modules/coveralls/bin/coveralls.js" | ||
"mocha-lcov-reporter": "~0.0.1", | ||
"blanket": "~1.1.5", | ||
"coveralls": "~2.6.0", | ||
"load-grunt-tasks": "~0.2.1" | ||
"blanket": "~1.1.6", | ||
"coveralls": "~2.6.1", | ||
"load-grunt-tasks": "~0.2.1", | ||
"grunt-contrib-connect": "~0.5.0", | ||
"grunt-mocha": "~0.4.7", | ||
"bower": "~1.2.8", | ||
"grunt-bower-requirejs": "~0.8.0" | ||
}, | ||
@@ -44,0 +49,0 @@ "licenses": [ |
@@ -8,2 +8,3 @@ empower | ||
[![Coverage Status](https://coveralls.io/repos/twada/empower/badge.png?branch=master)](https://coveralls.io/r/twada/empower?branch=master) | ||
[![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/) | ||
@@ -10,0 +11,0 @@ Power Assert feature enhancer for assert function/object. |
@@ -1,4 +0,22 @@ | ||
var empower = require('../lib/empower'), | ||
assert = require('assert'), | ||
fakeFormatter = function (context) { | ||
(function (root, factory) { | ||
'use strict'; | ||
var dependencies = [ | ||
'../lib/empower', | ||
'assert' | ||
]; | ||
if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
} else if (typeof exports === 'object') { | ||
factory.apply(root, dependencies.map(function (path) { return require(path); })); | ||
} else { | ||
factory.apply(root, dependencies.map(function (path) { | ||
var tokens = path.split('/'); | ||
return root[tokens[tokens.length - 1]]; | ||
})); | ||
} | ||
}(this, function (empower, assert) { | ||
var fakeFormatter = function (context) { | ||
return [ | ||
@@ -265,1 +283,3 @@ context.location.path, | ||
}); | ||
})); |
@@ -1,3 +0,58 @@ | ||
var empower = require('../lib/empower'), | ||
weave = require('../test_helper').weave, | ||
(function (root, factory) { | ||
'use strict'; | ||
var dependencies = [ | ||
'../lib/empower', | ||
'espower', | ||
'esprima', | ||
'escodegen', | ||
'assert' | ||
]; | ||
if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
} else if (typeof exports === 'object') { | ||
factory.apply(root, dependencies.map(function (path) { return require(path); })); | ||
} else { | ||
factory.apply(root, dependencies.map(function (path) { | ||
var tokens = path.split('/'); | ||
return root[tokens[tokens.length - 1]]; | ||
})); | ||
} | ||
}(this, function ( | ||
empower, | ||
espower, | ||
esprima, | ||
escodegen, | ||
baseAssert | ||
) { | ||
// see: https://github.com/Constellation/escodegen/issues/115 | ||
if (typeof define === 'function' && define.amd) { | ||
escodegen = window.escodegen; | ||
} | ||
var weave = function () { | ||
function extractBodyFrom (source) { | ||
var tree = esprima.parse(source, {tolerant: true, loc: true, range: true}); | ||
return tree.body[0]; | ||
} | ||
function extractBodyOfAssertionAsCode (node) { | ||
var expression; | ||
if (node.type === 'ExpressionStatement') { | ||
expression = node.expression; | ||
} | ||
return escodegen.generate(expression.arguments[0], {format: {compact: true}}); | ||
} | ||
function applyEspower (line, options) { | ||
options = options || {destructive: false, source: line, path: '/path/to/some_test.js', powerAssertVariableName: 'assert'}; | ||
var tree = extractBodyFrom(line); | ||
return espower(tree, options); | ||
} | ||
return function (line, options) { | ||
return escodegen.generate(applyEspower(line, options), {format: {compact: true}}); | ||
}; | ||
}(), | ||
fakeFormatter = function (context) { | ||
@@ -12,4 +67,3 @@ return [ | ||
suite('assertion method with one argument', function () { | ||
var baseAssert = require('assert'), | ||
assert = empower(baseAssert, fakeFormatter); | ||
var assert = empower(baseAssert, fakeFormatter); | ||
@@ -33,4 +87,3 @@ test('Identifier', function () { | ||
suite('assertion method with two arguments', function () { | ||
var baseAssert = require('assert'), | ||
assert = empower(baseAssert, fakeFormatter); | ||
var assert = empower(baseAssert, fakeFormatter); | ||
@@ -79,1 +132,3 @@ test('both Identifier', function () { | ||
}); | ||
})); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
32314
14
699
32
4
16
2