Commit 7488f558 by xzyfer

Make binding tests less fragile

Use hardcoded process values rather than inspecting the current
environment.
parent 10f9a58c
...@@ -10,7 +10,8 @@ var assert = require('assert'), ...@@ -10,7 +10,8 @@ var assert = require('assert'),
describe('binding', function() { describe('binding', function() {
describe('missing error', function() { describe('missing error', function() {
it('should be useful', function() { it('should be useful', function() {
process.env.SASS_BINARY_NAME = 'Linux-x64-48'; process.env.SASS_BINARY_NAME = 'unknown-x64-48';
assert.throws( assert.throws(
function() { binding(etx); }, function() { binding(etx); },
function(err) { function(err) {
...@@ -42,11 +43,7 @@ describe('binding', function() { ...@@ -42,11 +43,7 @@ describe('binding', function() {
describe('on unsupported environment', function() { describe('on unsupported environment', function() {
describe('with an unsupported architecture', function() { describe('with an unsupported architecture', function() {
var prevValue;
beforeEach(function() { beforeEach(function() {
prevValue = process.arch;
Object.defineProperty(process, 'arch', { Object.defineProperty(process, 'arch', {
value: 'foo', value: 'foo',
}); });
...@@ -54,7 +51,7 @@ describe('binding', function() { ...@@ -54,7 +51,7 @@ describe('binding', function() {
afterEach(function() { afterEach(function() {
Object.defineProperty(process, 'arch', { Object.defineProperty(process, 'arch', {
value: prevValue, value: 'x64',
}); });
}); });
...@@ -74,11 +71,7 @@ describe('binding', function() { ...@@ -74,11 +71,7 @@ describe('binding', function() {
}); });
describe('with an unsupported platform', function() { describe('with an unsupported platform', function() {
var prevValue;
beforeEach(function() { beforeEach(function() {
prevValue = process.platform;
Object.defineProperty(process, 'platform', { Object.defineProperty(process, 'platform', {
value: 'bar', value: 'bar',
}); });
...@@ -86,7 +79,7 @@ describe('binding', function() { ...@@ -86,7 +79,7 @@ describe('binding', function() {
afterEach(function() { afterEach(function() {
Object.defineProperty(process, 'platform', { Object.defineProperty(process, 'platform', {
value: prevValue, value: 'darwin',
}); });
}); });
...@@ -106,11 +99,7 @@ describe('binding', function() { ...@@ -106,11 +99,7 @@ describe('binding', function() {
}); });
describe('with an unsupported runtime', function() { describe('with an unsupported runtime', function() {
var prevValue;
beforeEach(function() { beforeEach(function() {
prevValue = process.versions.modules;
Object.defineProperty(process.versions, 'modules', { Object.defineProperty(process.versions, 'modules', {
value: 'baz', value: 'baz',
}); });
...@@ -118,7 +107,7 @@ describe('binding', function() { ...@@ -118,7 +107,7 @@ describe('binding', function() {
afterEach(function() { afterEach(function() {
Object.defineProperty(process.versions, 'modules', { Object.defineProperty(process.versions, 'modules', {
value: prevValue, value: 51,
}); });
}); });
......
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