Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added integration tests via plugin harness

  • Loading branch information...
commit 8f5b3b323319a9fbb738ee610dc4eba043f422f4 1 parent 9963e6e
@arobson arobson authored
View
3  build.json
@@ -0,0 +1,3 @@
+{
+
+}
View
11 lib/plugin.js
@@ -1,3 +1,12 @@
+/*
+ anvil.uglify - Uglify plugin for anvil.js
+ version: 0.0.4
+ author: Alex Robson <alex@sharplearningcurve.com> (http://sharplearningcurve.com)
+ copyright: 2012
+ license: Dual licensed
+ MIT (http://www.opensource.org/licenses/mit-license)
+ GPL (http://www.opensource.org/licenses/gpl-license)
+*/
var jsp = require( "uglify-js" ).parser;
var pro = require( "uglify-js" ).uglify;
@@ -14,7 +23,7 @@ var uglifyFactory = function( _, anvil ) {
],
configure: function( config, command, done ) {
- if( config["anvil.config"] ) {
+ if( config["anvil.uglify"] ) {
if( config["anvil.uglify"].all ) {
this.all = true;
} else if ( config["anvil.uglify"].include ) {
View
7 package.json
@@ -2,7 +2,7 @@
"author": "Alex Robson <alex@sharplearningcurve.com> (http://sharplearningcurve.com)",
"name": "anvil.uglify",
"description": "Uglify plugin for anvil.js",
- "version": "0.0.3",
+ "version": "0.0.4",
"repository": {
"type": "git",
"url": "git://github.com/arobson/anvil.uglify.git"
@@ -12,6 +12,9 @@
},
"main": "./lib/plugin.js",
"dependencies": { "uglify-js": "~1.3.3" },
- "devDependencies": {},
+ "devDependencies": {
+ "anvil.js": ">=0.8.4",
+ "should": "~1.1"
+ },
"optionalDependencies": {}
}
View
38 spec/plugin.spec.js
@@ -0,0 +1,38 @@
+var should = require( "should" );
+var _ = require( "underscore" );
+var Harness = require( "anvil.js" ).PluginHarness;
+
+var harness = new Harness( "anvil.uglify", "./" ),
+ tests = [];
+
+harness.addFile( "./build.json",
+ '{ "anvil.uglify": { "all": true } }' );
+
+harness.addFile( "./src/test.js",
+ "var x = 10;\n" +
+ "var y = 5;" );
+
+harness.expectFile( "./lib/test.min.js",
+ "var x=10,y=5" );
+
+describe( "when uglifying", function() {
+
+ before( function( done ) {
+ harness.build(
+ function( x, y ) {
+ y.should.equal( x );
+ },
+ function( results ) {
+ tests = results;
+ done();
+ }
+ );
+ } );
+
+ it( "should produce expected output", function() {
+ _.each( tests, function( test ) {
+ test.call();
+ } );
+ } );
+
+} );
View
2  src/plugin.js
@@ -14,7 +14,7 @@ var uglifyFactory = function( _, anvil ) {
],
configure: function( config, command, done ) {
- if( config["anvil.config"] ) {
+ if( config["anvil.uglify"] ) {
if( config["anvil.uglify"].all ) {
this.all = true;
} else if ( config["anvil.uglify"].include ) {
Please sign in to comment.
Something went wrong with that request. Please try again.