Skip to content

Commit 3616cf8

Browse files
committed
Only run browserify tests if eval is available
1 parent 51f1ef8 commit 3616cf8

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

test/browserify.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ var captureStderr = require('./support/capture-stderr')
55
var depd = null
66
var mylib = null
77
var path = require('path')
8-
var run = browserify ? describe : describe.skip
8+
var canEval = true
9+
try { eval('1') } catch (e) { canEval = false }
10+
var run = (browserify && canEval) ? describe : describe.skip
911

1012
run('when browserified', function () {
1113
before(function (done) {

test/test.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ var script = path.join(__dirname, 'fixtures', 'script.js')
1010
var spawn = require('child_process').spawn
1111
var strictlib = libs.strict
1212

13+
var canEval = true
14+
try { eval('1') } catch (e) { canEval = false }
15+
1316
describe('depd(namespace)', function () {
1417
it('creates deprecated function', function () {
1518
assert.strictEqual(typeof depd('test'), 'function')
@@ -64,17 +67,12 @@ describe('deprecate(message)', function () {
6467
})
6568

6669
it('should log call site within eval', function () {
67-
function callold () { eval('mylib.old()') } // eslint-disable-line no-eval
68-
var stderr;
69-
try {
70-
stderr = captureStderr(callold)
71-
} catch (e) {
72-
if (!(e instanceof EvalError)) {
73-
throw e;
74-
}
70+
if (!canEval) {
7571
// unable to test eval stack trace because eval is blocked in this test environment
7672
this.skip();
7773
}
74+
function callold () { eval('mylib.old()') } // eslint-disable-line no-eval
75+
var stderr = captureStderr(callold)
7876
assert.ok(stderr.indexOf(basename(__filename)) !== -1)
7977
assert.ok(stderr.indexOf('<anonymous>:1:') !== -1)
8078
assert.ok(/\.js:[0-9]+:[0-9]+/.test(stderr))

0 commit comments

Comments
 (0)