Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 7488f55

Browse files
committed
Make binding tests less fragile
Use hardcoded process values rather than inspecting the current environment.
1 parent 10f9a58 commit 7488f55

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

test/binding.js

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ var assert = require('assert'),
1010
describe('binding', function() {
1111
describe('missing error', function() {
1212
it('should be useful', function() {
13-
process.env.SASS_BINARY_NAME = 'Linux-x64-48';
13+
process.env.SASS_BINARY_NAME = 'unknown-x64-48';
14+
1415
assert.throws(
1516
function() { binding(etx); },
1617
function(err) {
@@ -42,19 +43,15 @@ describe('binding', function() {
4243

4344
describe('on unsupported environment', function() {
4445
describe('with an unsupported architecture', function() {
45-
var prevValue;
46-
4746
beforeEach(function() {
48-
prevValue = process.arch;
49-
5047
Object.defineProperty(process, 'arch', {
5148
value: 'foo',
5249
});
5350
});
5451

5552
afterEach(function() {
5653
Object.defineProperty(process, 'arch', {
57-
value: prevValue,
54+
value: 'x64',
5855
});
5956
});
6057

@@ -74,19 +71,15 @@ describe('binding', function() {
7471
});
7572

7673
describe('with an unsupported platform', function() {
77-
var prevValue;
78-
7974
beforeEach(function() {
80-
prevValue = process.platform;
81-
8275
Object.defineProperty(process, 'platform', {
8376
value: 'bar',
8477
});
8578
});
8679

8780
afterEach(function() {
8881
Object.defineProperty(process, 'platform', {
89-
value: prevValue,
82+
value: 'darwin',
9083
});
9184
});
9285

@@ -106,19 +99,15 @@ describe('binding', function() {
10699
});
107100

108101
describe('with an unsupported runtime', function() {
109-
var prevValue;
110-
111102
beforeEach(function() {
112-
prevValue = process.versions.modules;
113-
114103
Object.defineProperty(process.versions, 'modules', {
115104
value: 'baz',
116105
});
117106
});
118107

119108
afterEach(function() {
120109
Object.defineProperty(process.versions, 'modules', {
121-
value: prevValue,
110+
value: 51,
122111
});
123112
});
124113

0 commit comments

Comments
 (0)