node-sass
Advanced tools
Comparing version 3.11.2 to 3.11.3
@@ -7,14 +7,5 @@ /*! | ||
clonedeep = require('lodash.clonedeep'), | ||
errors = require('./errors'), | ||
assign = require('lodash.assign'), | ||
sass = require('./extensions'); | ||
if (!sass.hasBinary(sass.getBinaryPath())) { | ||
if (!sass.isSupportedEnvironment()) { | ||
throw new Error(errors.unsupportedEnvironment()); | ||
} else { | ||
throw new Error(errors.missingBinary()); | ||
} | ||
} | ||
/** | ||
@@ -24,3 +15,3 @@ * Require binding | ||
var binding = require(sass.getBinaryPath()); | ||
var binding = require('./binding')(sass); | ||
@@ -27,0 +18,0 @@ /** |
{ | ||
"name": "node-sass", | ||
"version": "3.11.2", | ||
"version": "3.11.3", | ||
"libsass": "3.3.6", | ||
@@ -77,3 +77,3 @@ "description": "Wrapper around libsass", | ||
"istanbul": "^0.4.2", | ||
"mocha": "^2.4.5", | ||
"mocha": "^3.1.2", | ||
"mocha-lcov-reporter": "^1.2.0", | ||
@@ -80,0 +80,0 @@ "object-merge": "^2.5.1", |
@@ -51,3 +51,3 @@ /*! | ||
console.log('Start downloading binary at', url); | ||
log.http('node-sass install', 'Start downloading binary at' + url); | ||
@@ -102,3 +102,3 @@ try { | ||
if (err) { | ||
console.error(err); | ||
log.error('node-sass install', err); | ||
return; | ||
@@ -109,7 +109,7 @@ } | ||
if (err) { | ||
console.error(err); | ||
log.error('node-sass install', err); | ||
return; | ||
} | ||
console.log('Binary downloaded and installed at', sass.getBinaryPath()); | ||
log.info('node-sass install', 'Binary downloaded and installed at' + sass.getBinaryPath()); | ||
}); | ||
@@ -124,3 +124,3 @@ }); | ||
if (process.env.SKIP_SASS_BINARY_DOWNLOAD_FOR_CI) { | ||
console.log('Skipping downloading binaries on CI builds'); | ||
log.info('node-sass install', 'Skipping downloading binaries on CI builds'); | ||
return; | ||
@@ -127,0 +127,0 @@ } |
129
test/api.js
@@ -1842,131 +1842,2 @@ /*eslint new-cap: ["error", {"capIsNewExceptions": ["Color"]}]*/ | ||
}); | ||
describe('binding', function() { | ||
beforeEach(function() { | ||
delete require.cache[sassPath]; | ||
}); | ||
afterEach(function() { | ||
delete require.cache[sassPath]; | ||
}); | ||
describe('missing error', function() { | ||
it('should be useful', function() { | ||
process.env.SASS_BINARY_NAME = 'Linux-x64-48'; | ||
assert.throws( | ||
function() { require(sassPath); }, | ||
new RegExp('Missing binding.*?\\' + path.sep + 'vendor\\' + path.sep) | ||
); | ||
}); | ||
it('should list currently installed bindings', function() { | ||
assert.throws( | ||
function() { require(sassPath); }, | ||
function(err) { | ||
var etx = require('../lib/extensions'); | ||
delete process.env.SASS_BINARY_NAME; | ||
if ((err instanceof Error)) { | ||
return err.message.indexOf( | ||
etx.getHumanEnvironment(etx.getBinaryName()) | ||
) !== -1; | ||
} | ||
} | ||
); | ||
}); | ||
}); | ||
describe('on unsupported environment', function() { | ||
describe('with an unsupported architecture', function() { | ||
var prevValue; | ||
beforeEach(function() { | ||
prevValue = process.arch; | ||
Object.defineProperty(process, 'arch', { | ||
get: function () { return 'foo'; } | ||
}); | ||
}); | ||
afterEach(function() { | ||
process.arch = prevValue; | ||
}); | ||
it('should error', function() { | ||
assert.throws( | ||
function() { require(sassPath); }, | ||
'Node Sass does not yet support your current environment' | ||
); | ||
}); | ||
it('should inform the user the architecture is unsupported', function() { | ||
assert.throws( | ||
function() { require(sassPath); }, | ||
'Unsupported architecture (foo)' | ||
); | ||
}); | ||
}); | ||
describe('with an unsupported platform', function() { | ||
var prevValue; | ||
beforeEach(function() { | ||
prevValue = process.platform; | ||
Object.defineProperty(process, 'platform', { | ||
get: function () { return 'bar'; } | ||
}); | ||
}); | ||
afterEach(function() { | ||
process.platform = prevValue; | ||
}); | ||
it('should error', function() { | ||
assert.throws( | ||
function() { require(sassPath); }, | ||
'Node Sass does not yet support your current environment' | ||
); | ||
}); | ||
it('should inform the user the platform is unsupported', function() { | ||
assert.throws( | ||
function() { require(sassPath); }, | ||
'Unsupported platform (bar)' | ||
); | ||
}); | ||
}); | ||
describe('with an unsupported platform', function() { | ||
var prevValue; | ||
beforeEach(function() { | ||
prevValue = process.versions.modules; | ||
Object.defineProperty(process.versions, 'modules', { | ||
get: function () { return 'baz'; } | ||
}); | ||
}); | ||
afterEach(function() { | ||
process.versions.modules = prevValue; | ||
}); | ||
it('should error', function() { | ||
assert.throws( | ||
function() { require(sassPath); }, | ||
'Node Sass does not yet support your current environment' | ||
); | ||
}); | ||
it('should inform the user the runtime is unsupported', function() { | ||
assert.throws( | ||
function() { require(sassPath); }, | ||
'Unsupported runtime (baz)' | ||
); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
var assert = require('assert'), | ||
extensionsPath = process.env.NODESASS_COV | ||
? require.resolve('../lib-cov/extensions') | ||
: require.resolve('../lib/extensions'); | ||
sass = process.env.NODESASS_COV | ||
? require('../lib-cov/extensions') | ||
: require('../lib/extensions'); | ||
describe('runtime parameters', function() { | ||
var packagePath = require.resolve('../package'), | ||
var pkg = require('../package'), | ||
// Let's use JSON to fake a deep copy | ||
@@ -12,13 +12,6 @@ savedArgv = JSON.stringify(process.argv), | ||
beforeEach(function() { | ||
require(packagePath); | ||
delete require.cache[extensionsPath]; | ||
}); | ||
afterEach(function() { | ||
delete require.cache[packagePath]; | ||
delete require.cache[extensionsPath]; | ||
process.argv = JSON.parse(savedArgv); | ||
process.env = JSON.parse(savedEnv); | ||
require(packagePath); | ||
delete pkg.nodeSassConfig; | ||
}); | ||
@@ -33,7 +26,6 @@ | ||
process.env.npm_config_sass_binary_name = 'ccc'; | ||
require.cache[packagePath].exports.nodeSassConfig = { binaryName: 'ddd' }; | ||
pkg.nodeSassConfig = { binaryName: 'ddd' }; | ||
}); | ||
it('command line argument', function() { | ||
var sass = require(extensionsPath); | ||
assert.equal(sass.getBinaryName(), 'aaa_binding.node'); | ||
@@ -44,3 +36,2 @@ }); | ||
process.argv = []; | ||
var sass = require(extensionsPath); | ||
assert.equal(sass.getBinaryName(), 'bbb_binding.node'); | ||
@@ -52,3 +43,2 @@ }); | ||
process.env.SASS_BINARY_NAME = null; | ||
var sass = require(extensionsPath); | ||
assert.equal(sass.getBinaryName(), 'ccc_binding.node'); | ||
@@ -61,3 +51,2 @@ }); | ||
process.env.npm_config_sass_binary_name = null; | ||
var sass = require(extensionsPath); | ||
assert.equal(sass.getBinaryName(), 'ddd_binding.node'); | ||
@@ -72,7 +61,6 @@ }); | ||
process.env.npm_config_sass_binary_site = 'http://ccc.example.com:7777'; | ||
require.cache[packagePath].exports.nodeSassConfig = { binarySite: 'http://ddd.example.com:6666' }; | ||
pkg.nodeSassConfig = { binarySite: 'http://ddd.example.com:6666' }; | ||
}); | ||
it('command line argument', function() { | ||
var sass = require(extensionsPath); | ||
var URL = 'http://aaa.example.com:9999'; | ||
@@ -84,3 +72,2 @@ assert.equal(sass.getBinaryUrl().substr(0, URL.length), URL); | ||
process.argv = []; | ||
var sass = require(extensionsPath); | ||
var URL = 'http://bbb.example.com:8888'; | ||
@@ -93,3 +80,2 @@ assert.equal(sass.getBinaryUrl().substr(0, URL.length), URL); | ||
process.env.SASS_BINARY_SITE = null; | ||
var sass = require(extensionsPath); | ||
var URL = 'http://ccc.example.com:7777'; | ||
@@ -103,3 +89,2 @@ assert.equal(sass.getBinaryUrl().substr(0, URL.length), URL); | ||
process.env.npm_config_sass_binary_site = null; | ||
var sass = require(extensionsPath); | ||
var URL = 'http://ddd.example.com:6666'; | ||
@@ -115,7 +100,6 @@ assert.equal(sass.getBinaryUrl().substr(0, URL.length), URL); | ||
process.env.npm_config_sass_binary_path = 'ccc_binding.node'; | ||
require.cache[packagePath].exports.nodeSassConfig = { binaryPath: 'ddd_binding.node' }; | ||
pkg.nodeSassConfig = { binaryPath: 'ddd_binding.node' }; | ||
}); | ||
it('command line argument', function() { | ||
var sass = require(extensionsPath); | ||
assert.equal(sass.getBinaryPath(), 'aaa_binding.node'); | ||
@@ -126,3 +110,2 @@ }); | ||
process.argv = []; | ||
var sass = require(extensionsPath); | ||
assert.equal(sass.getBinaryPath(), 'bbb_binding.node'); | ||
@@ -134,3 +117,2 @@ }); | ||
process.env.SASS_BINARY_PATH = null; | ||
var sass = require(extensionsPath); | ||
assert.equal(sass.getBinaryPath(), 'ccc_binding.node'); | ||
@@ -143,3 +125,2 @@ }); | ||
process.env.npm_config_sass_binary_path = null; | ||
var sass = require(extensionsPath); | ||
assert.equal(sass.getBinaryPath(), 'ddd_binding.node'); | ||
@@ -146,0 +127,0 @@ }); |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
310
87
1634383
4484