diff --git a/example/package.json b/example/package.json index 2574567..d54df41 100644 --- a/example/package.json +++ b/example/package.json @@ -7,10 +7,10 @@ "start": "node example.js" }, "dependencies": { - "async": "~0.9.0", - "bootstrap": "^3.3.2", - "express": "~4.11.0", - "flot": "^0.8.0-alpha", - "ejs": "^2.3.1" + "async": "1.2.x", + "bootstrap": "3.3.x", + "express": "4.11.x", + "flot": "0.8.x", + "ejs": "2.3.x" } } diff --git a/package.json b/package.json index 6601541..bfe4882 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "node-ff-assets", "version": "0.2.5", - "description": "Site assets local/remote aggregation with minify.", + "description": "Website assets aggregation and minification", "main": "lib/node-ff-assets.js", "scripts": { "test": "npm run-script test-clean;npm run-script test-mocha", @@ -9,21 +9,30 @@ "test-mocha": "export JUNIT_REPORT_PATH=test/data/report.xml;export JUNIT_REPORT_STACK=1;node_modules/mocha/bin/mocha --reporter mocha-jenkins-reporter" }, "author": "Willem (http://forwardfire.net/)", + "keywords": [ + "website", + "assets", + "aggregation", + "minification", + "javascript", + "css", + "minify" + ], "license": "BSD-2-Clause", "repository": { "type": "git", "url": "https://bitbucket.org/im_ik/node-ff-assets.git" }, "dependencies": { - "debug": "^2.2.0", - "fetch": "^0.3.6", - "fs-extra": "^0.16.3", - "minify": "^1.4.8", - "underscore": "^1.8.2" + "debug": "2.2.x", + "fetch": "0.3.x", + "fs-extra": "0.20.x", + "minify": "1.4.x", + "underscore": "1.8.x" }, "devDependencies": { - "mocha": "^2.1.0", - "mocha-jenkins-reporter": "^0.1.4", - "mocha-jshint": "0.0.9" + "mocha": "2.2.x", + "mocha-jenkins-reporter": "0.1.x", + "mocha-jshint": "2.2.x" } } diff --git a/test/test-asset-assembler.js b/test/test-asset-assembler.js index a994426..5bc60e9 100644 --- a/test/test-asset-assembler.js +++ b/test/test-asset-assembler.js @@ -1,9 +1,8 @@ 'use strict'; -var u = require('underscore'); var fs = require('fs-extra'); -var assert = require("assert"); -var assets = require("../lib/node-ff-assets"); +var assert = require('assert'); +var assets = require('../lib/node-ff-assets'); function createTestAssembler(suite, readFile) { var assetAssembler = new assets.AssetAssembler({ @@ -40,7 +39,8 @@ describe('lib/asset-assembler.js', function() { describe('config-null', function() { this.timeout(10000); try { - new assets.AssetAssembler(); + var result = new assets.AssetAssembler(); + assert.ok(result); assert.ok(false); } catch (err) { assert.ok(err !== undefined); @@ -53,6 +53,7 @@ describe('lib/asset-assembler.js', function() { var assetAssembler = createTestAssembler(this); it('run builder and check output', function (done) { assetAssembler.run(function (err) { + assert.ok(err === undefined); try { assert.ok(true); assert.equal(true, fs.existsSync(outputFile)); @@ -71,13 +72,14 @@ describe('lib/asset-assembler.js', function() { describe('aggregate-two-and-remote', function() { this.timeout(10000); - var remoteFile = 'test/data/'+this.title+'/fonts-sans-pro.css' + var remoteFile = 'test/data/'+this.title+'/fonts-sans-pro.css'; var outputFile = createTestData(this); var assetAssembler = createTestAssembler(this); assetAssembler.config.linkSources.push('/static-test/fonts-sans-pro.css@http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700'); it('run builder and check output', function (done) { assetAssembler.run(function (err) { + assert.ok(err === undefined); try { assert.ok(true); assert.equal(true, fs.existsSync(outputFile)); @@ -90,7 +92,7 @@ describe('lib/asset-assembler.js', function() { done(); } catch (err) { - console.log('sdf: '+Object.keys(err)); + //console.log('sdf: '+Object.keys(err)); done(err); } }); @@ -106,8 +108,8 @@ describe('lib/asset-assembler.js', function() { it('run builder and check output', function (done) { assetAssembler.run(function (err) { + assert.ok(err !== undefined); try { - assert.ok(err !== undefined); assert.equal(true, err.message.indexOf('404') >= 0); assert.equal(true, fs.existsSync(outputFile)); assert.equal(true, fs.existsSync(remoteFile)); @@ -131,7 +133,7 @@ describe('lib/asset-assembler.js', function() { describe('remote-closed', function() { this.timeout(10000); - var remoteFile = 'test/data/'+this.title+'/font-closed.css' + var remoteFile = 'test/data/'+this.title+'/font-closed.css'; var outputFile = createTestData(this); var assetAssembler = createTestAssembler(this); assetAssembler.config.linkSources.push('/static-test/font-closed.css@http://localhost:12345/closed'); @@ -166,6 +168,7 @@ describe('lib/asset-assembler.js', function() { var assetAssembler = createTestAssembler(this,assets.factory.assembler.constructor.readFileRegex()); it('run builder and check output', function (done) { assetAssembler.run(function (err) { + assert.ok(err === undefined); try { assert.ok(true); assert.equal(true, fs.existsSync(outputFile)); @@ -184,7 +187,7 @@ describe('lib/asset-assembler.js', function() { }); }); }); - + describe('aggregate-no-comments', function() { this.timeout(10000); var outputFile = createTestData(this); @@ -194,6 +197,7 @@ describe('lib/asset-assembler.js', function() { assetAssembler.config.assetSeperator = null; it('run builder and check output', function (done) { assetAssembler.run(function (err) { + assert.ok(err === undefined); try { assert.ok(true); assert.equal(true, fs.existsSync(outputFile)); diff --git a/test/test-assets-builder.js b/test/test-assets-builder.js index 8a55b5d..66b4bed 100644 --- a/test/test-assets-builder.js +++ b/test/test-assets-builder.js @@ -1,9 +1,8 @@ 'use strict'; -var u = require('underscore'); var fs = require('fs-extra'); -var assert = require("assert"); -var assets = require("../lib/node-ff-assets"); +var assert = require('assert'); +var assets = require('../lib/node-ff-assets'); function createTestConfig(suite,type) { @@ -26,13 +25,14 @@ function createTestConfig(suite,type) { ], assetType: type, }); - } + }; } function createTestBuilder(suite) { var testConfig = { assemblerFill: function (assembler, callback) { var serverResultKey = 'ff_assets_'+assembler.config.assetType; + assert.ok(serverResultKey); assembler.on ('log',function (logMessage) { console.log(' ' + ' ' + suite.title + ' assembler ' +logMessage); // == -2 space from asm }); @@ -55,7 +55,8 @@ describe('lib/assets-builder.js', function() { describe('config-null', function() { this.timeout(10000); try { - new assets.AssetsBuilder(); + var result = new assets.AssetsBuilder(); + assert.ok(result); assert.ok(false); } catch (err) { assert.ok(err !== undefined); diff --git a/test/test-factory.js b/test/test-factory.js index ec1719d..1ef0b30 100644 --- a/test/test-factory.js +++ b/test/test-factory.js @@ -4,6 +4,12 @@ var u = require('underscore'); var assert = require('assert'); var asserts = require('../lib/node-ff-assets'); +var checkResult = function(result) { + return function() { + assert.equal(true, u.isFunction(result)); + }; +}; + var checkFunctionResult = function(node,prefixParent) { var nodeKeys = Object.keys(node); for (var i = 0; i < nodeKeys.length; i++) { @@ -17,15 +23,13 @@ var checkFunctionResult = function(node,prefixParent) { } catch (err) { result = function() {}; } - it(prefix+' should return function', function() { - assert.equal(true, u.isFunction(result)); - }); + it(prefix+' should return function', checkResult(result)); } else if (u.isObject(nodeValue)) { checkFunctionResult(nodeValue,prefix); } } -} +}; describe('lib/factory.js', function() { describe('check function paths', function() { diff --git a/test/test-node-ff-assets.js b/test/test-node-ff-assets.js index 7f8d39f..f4e9572 100644 --- a/test/test-node-ff-assets.js +++ b/test/test-node-ff-assets.js @@ -1,7 +1,7 @@ 'use strict'; -var assert = require("assert"); -var assets = require("../lib/node-ff-assets"); +var assert = require('assert'); +var assets = require('../lib/node-ff-assets'); describe('lib/node-ff-assets.js', function() { describe('check exports', function() {