Commit 606ca863 by Nick Schonning

Merge pull request #294 from XhmikosR/master

Update deps and JSHint options
Closes gh-292
parents 3a5607fc 1b2dd431
{
"node": true,
"laxbreak": true,
"indent": 2,
"bitwise": true,
"camelcase": false,
"curly": true,
"trailing": true,
"undef": true,
"unused": true,
"expr":true,
"eqeqeq": true,
"expr": true,
"immed": true,
"indent": 2,
"laxbreak": true,
"mocha": true,
"multistr": true,
"globals": {
"it": true,
"describe": true
}
"newcap": true,
"noarg": true,
"node": true,
"quotmark": "single",
"strict": false,
"undef": true,
"unused": true
}
\ No newline at end of file
......@@ -40,7 +40,7 @@ if (!force && !process.env.SKIP_NODE_SASS_TESTS) {
timeout: 999999
});
mocha.addFile(path.resolve(__dirname, "test", "test.js"));
mocha.addFile(path.resolve(__dirname, 'test', 'test.js'));
mocha.run(function (done) {
if (done !== 0) {
......
......@@ -44,7 +44,7 @@ module.exports = function(options){
options = options || {};
// Accept src/dest dir
if ('string' == typeof options) {
if ('string' === typeof options) {
options = { src: options };
}
......@@ -72,7 +72,7 @@ module.exports = function(options){
// Middleware
return function sass(req, res, next){
if ('GET' != req.method && 'HEAD' != req.method) { return next(); }
if ('GET' !== req.method && 'HEAD' !== req.method) { return next(); }
var path = url.parse(req.url).pathname;
if (options.prefix && 0 === path.indexOf(options.prefix)) {
path = path.substring(options.prefix.length);
......@@ -97,7 +97,7 @@ module.exports = function(options){
// Ignore ENOENT to fall through as 404
var error = function(err) {
next('ENOENT' == err.code
next('ENOENT' === err.code
? null
: err);
};
......@@ -139,7 +139,7 @@ module.exports = function(options){
fs.stat(cssPath, function(err, cssStats){
// CSS has not been compiled, compile it!
if (err) {
if ('ENOENT' == err.code) {
if ('ENOENT' === err.code) {
if (debug) { log('not found', cssPath); }
compile();
} else {
......
......@@ -38,18 +38,18 @@
"node": ">=0.10.0"
},
"dependencies": {
"mkdirp": "0.3.x",
"optimist": "0.6.x",
"node-watch": "0.3.x",
"chalk": "~0.4.0",
"mkdirp": "~0.3.5",
"mocha": "~1.18.2",
"nan": "~0.8.0",
"mocha": "1.18.x",
"sinon": "^1.9.1"
"node-watch": "~0.3.4",
"optimist": "~0.6.1",
"sinon": "~1.9.1"
},
"devDependencies": {
"jshint": "~2.4.4",
"coveralls": "~2.10.0",
"mocha-lcov-reporter": "0.0.1",
"jscoverage": "~0.3.8"
"jscoverage": "~0.3.8",
"jshint": "~2.5.0",
"mocha-lcov-reporter": "~0.0.1"
}
}
/*jshint multistr:true */
var sass = require('../sass');
var assert = require('assert');
......@@ -20,8 +19,8 @@ var expectedCommentsScssStr = '/* line 1, ' + sampleFilename + ' */\n\
#navbar li a {\n\
font-weight: bold; }\n';
describe("compile file with source comments", function() {
it("should compile with render and comment outputs", function(done) {
describe('compile file with source comments', function() {
it('should compile with render and comment outputs', function(done) {
sass.render({
file: sampleFilename,
source_comments: 'normal',
......
/*jshint multistr:true */
var sass = require('../sass');
var assert = require('assert');
var sampleFilename = require('path').resolve(__dirname, 'sample.scss');
describe("compile source maps", function() {
it("should compile file with source map URL", function(done) {
describe('compile source maps', function() {
it('should compile file with source map URL', function(done) {
var mapFileName = 'sample.css.map';
sass.render({
file: sampleFilename,
......
/* global beforeEach, afterEach */
/*jshint multistr:true */
var sass = process.env.NODESASS_COVERAGE ? require('../sass-coverage') : require('../sass');
var assert = require('assert');
var path = require('path');
......@@ -39,18 +37,18 @@ var expectedRender = '#navbar {\n\
#navbar li a {\n\
font-weight: bold; }\n';
describe("DEPRECATED: compile scss", function() {
it("should compile with render", function(done) {
describe('DEPRECATED: compile scss', function() {
it('should compile with render', function(done) {
sass.render(scssStr, function(err) {
done(err);
});
});
it("should compile with renderSync", function(done) {
it('should compile with renderSync', function(done) {
done(assert.ok(sass.renderSync(scssStr)));
});
it("should match compiled string with render", function(done) {
it('should match compiled string with render', function(done) {
sass.render(scssStr, function(err, css) {
if (!err) {
done(assert.equal(css, expectedRender));
......@@ -60,19 +58,19 @@ describe("DEPRECATED: compile scss", function() {
});
});
it("should match compiled string with renderSync", function(done) {
it('should match compiled string with renderSync', function(done) {
done(assert.equal(sass.renderSync(scssStr), expectedRender));
});
it("should throw an exception for bad input", function(done) {
it('should throw an exception for bad input', function(done) {
done(assert.throws(function() {
sass.renderSync(badInput);
}));
});
});
describe("compile scss", function() {
it("should compile with render", function(done) {
describe('compile scss', function() {
it('should compile with render', function(done) {
sass.render({
data: scssStr,
success: function(css) {
......@@ -81,11 +79,11 @@ describe("compile scss", function() {
});
});
it("should compile with renderSync", function(done) {
it('should compile with renderSync', function(done) {
done(assert.ok(sass.renderSync({data: scssStr})));
});
it("should match compiled string with render", function(done) {
it('should match compiled string with render', function(done) {
sass.render({
data: scssStr,
success: function(css) {
......@@ -97,7 +95,7 @@ describe("compile scss", function() {
});
});
it("should have a error status of 1 for bad css", function(done) {
it('should have a error status of 1 for bad css', function(done) {
sass.render({
data: '{zzz}',
success: function(css) {
......@@ -110,24 +108,24 @@ describe("compile scss", function() {
});
});
it("should match compiled string with renderSync", function(done) {
it('should match compiled string with renderSync', function(done) {
done(assert.equal(sass.renderSync({data: scssStr}), expectedRender));
});
it("should throw an exception for bad input", function(done) {
it('should throw an exception for bad input', function(done) {
done(assert.throws(function() {
sass.renderSync({data: badInput});
}));
});
});
describe("compile file with include paths", function(){
it("should compile with render", function(done) {
describe('compile file with include paths', function(){
it('should compile with render', function(done) {
sass.render({
file: path.resolve(__dirname, "include_path.scss"),
includePaths: [path.resolve(__dirname, "lib"), path.resolve(__dirname, "functions")],
file: path.resolve(__dirname, 'include_path.scss'),
includePaths: [path.resolve(__dirname, 'lib'), path.resolve(__dirname, 'functions')],
success: function (css) {
done(assert.equal(css, "body {\n background: red;\n color: #0000fe; }\n"));
done(assert.equal(css, 'body {\n background: red;\n color: #0000fe; }\n'));
},
error: function (error) {
done(error);
......@@ -136,13 +134,13 @@ describe("compile file with include paths", function(){
});
});
describe("compile file with image path", function(){
it("should compile with render", function(done) {
describe('compile file with image path', function(){
it('should compile with render', function(done) {
sass.render({
file: path.resolve(__dirname, "image_path.scss"),
file: path.resolve(__dirname, 'image_path.scss'),
imagePath: '/path/to/images',
success: function (css) {
done(assert.equal(css, "body {\n background-image: url(\"/path/to/images/image.png\"); }\n"));
done(assert.equal(css, 'body {\n background-image: url(\"/path/to/images/image.png\"); }\n'));
},
error: function (error) {
done(error);
......@@ -151,8 +149,8 @@ describe("compile file with image path", function(){
});
});
describe("compile file", function() {
it("should compile with render", function(done) {
describe('compile file', function() {
it('should compile with render', function(done) {
sass.render({
file: sampleFilename,
success: function (css) {
......@@ -164,11 +162,11 @@ describe("compile file", function() {
});
});
it("should compile with renderSync", function(done) {
it('should compile with renderSync', function(done) {
done(assert.ok(sass.renderSync({file: sampleFilename})));
});
it("should match compiled string with render", function(done) {
it('should match compiled string with render', function(done) {
sass.render({
file: sampleFilename,
success: function(css) {
......@@ -180,18 +178,18 @@ describe("compile file", function() {
});
});
it("should match compiled string with renderSync", function(done) {
it('should match compiled string with renderSync', function(done) {
done(assert.equal(sass.renderSync({file: sampleFilename}), expectedRender));
});
it("should throw an exception for bad input", function(done) {
it('should throw an exception for bad input', function(done) {
done(assert.throws(function() {
sass.renderSync({file: badSampleFilename});
}));
});
});
describe("render to file", function() {
describe('render to file', function() {
var outFile = path.resolve(__dirname, 'out.css'),
filesWritten;
......@@ -205,7 +203,7 @@ describe("render to file", function() {
afterEach(function() {
fs.writeFile.restore();
});
it("should compile with renderFile", function(done) {
it('should compile with renderFile', function(done) {
sass.renderFile({
file: sampleFilename,
outFile: outFile,
......@@ -219,22 +217,22 @@ describe("render to file", function() {
});
});
it("should raise an error for bad input", function(done) {
it('should raise an error for bad input', function(done) {
sass.renderFile({
file: badSampleFilename,
outFile: outFile,
success: function() {
assert(false, "success() should not be called");
assert(false, 'success() should not be called');
done();
},
error: function() {
assert(true, "error() called");
assert(true, 'error() called');
done();
}
});
});
it("should save the sourceMap to the default file name", function(done) {
it('should save the sourceMap to the default file name', function(done) {
sass.renderFile({
file: sampleFilename,
outFile: outFile,
......@@ -254,7 +252,7 @@ describe("render to file", function() {
});
});
it("should save the sourceMap to a specified file name", function(done) {
it('should save the sourceMap to a specified file name', function(done) {
var mapFileName = 'foo.css.map';
sass.renderFile({
file: sampleFilename,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment