test: put jscs as part of tests

Because, yes, I'd like a consistent code style!
This commit is contained in:
Remy Sharp 2015-07-28 13:40:09 +01:00
parent 27d9e8e8b0
commit aace364794
6 changed files with 23 additions and 11 deletions

View File

@ -2,7 +2,12 @@
"preset": "node-style-guide",
"requireCapitalizedComments": null,
"requireSpacesInAnonymousFunctionExpression": {
"beforeOpeningCurlyBrace": true
"beforeOpeningCurlyBrace": true,
"beforeOpeningRoundBrace": true
},
"excludeFiles": ["node_modules/**"]
"disallowSpacesInNamedFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"excludeFiles": ["node_modules/**"],
"disallowSpacesInFunction": null
}

View File

@ -48,8 +48,10 @@ var argvKeys = Object.keys(argv).filter(function filter(item) {
});
if (!url && argvKeys.length === 0 || argv.help) {
// show USAGE!
console.log(require('fs').readFileSync(__dirname + '/../docs/usage.txt', 'utf8'));
var usage = require('fs').readFileSync(
__dirname + '/../docs/usage.txt', 'utf8'
);
console.log(usage);
process.exit(0);
}

View File

@ -1,3 +1,4 @@
module.exports = {
ENOTFOUND: 'The URL could not be loaded, possibly a typo, or no internet connection',
ENOTFOUND: 'The URL could not be loaded, possibly a typo, ' +
'or no internet connection',
};

View File

@ -68,7 +68,7 @@ function Inliner(url, options, callback) {
global.setImmediate = function setImmediatePolyfill(fn) {
// :-/
setTimeout(fn, 0);
}
};
}
global.setImmediate(this.main.bind(this));
}
@ -93,7 +93,7 @@ Inliner.prototype.main = main;
// static properties and methods
Inliner.version = version;
Inliner.errors = require('./errors');
Inliner.defaults = function() {
Inliner.defaults = function () {
return {
images: true,
compressCSS: true,
@ -177,7 +177,8 @@ function main() {
return inliner.get(url).then(function then(res) {
var css = res.body;
inliner.jobs.done.links();
return inliner.cssImports(url, css).then(inliner.cssImages.bind(inliner, url));
return inliner.cssImports(url, css)
.then(inliner.cssImages.bind(inliner, url));
}).then(function then(css) {
$(link).replaceWith('<style>' + css + '</style>');
});
@ -238,7 +239,8 @@ function main() {
});
}
return promise.then(inliner.uglify.bind(inliner)).then(function then(res) {
return promise.then(inliner.uglify.bind(inliner))
.then(function then(res) {
debug('uglify: %s', res);
$script.html(res);
});

View File

@ -5,7 +5,7 @@
"homepage": "http://github.com/remy/inliner",
"main": "lib/index.js",
"scripts": {
"test": "node test/*.test.js --cov"
"test": "jscs -v cli/*.js lib/*.js && node test/*.test.js --cov"
},
"keywords": [
"mobile",
@ -36,6 +36,7 @@
"inliner": "cli/index.js"
},
"devDependencies": {
"jscs": "^2.0.0",
"st": "^0.5.5",
"tap-spec": "^4.0.2",
"tape": "^4.0.1"

View File

@ -13,7 +13,8 @@ test('inliner core functions', function coreTests(t) {
var Inliner = require('../');
t.equal(typeof Inliner, 'function', 'Inliner is a function');
t.equal(Inliner.version, require('../package.json').version, 'should have version');
t.equal(Inliner.version,
require('../package.json').version, 'should have version');
var inliner = new Inliner();
t.ok(inliner, 'inline is instantiated');