Skip to content

Commit 5bbfcb0

Browse files
committed
fix failing browser test
1 parent d790954 commit 5bbfcb0

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

test/debug_spec.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,18 @@ if (typeof module !== 'undefined') {
1515
sinon = require('sinon');
1616
sinonChai = require('sinon-chai');
1717
chai.use(sinonChai);
18+
debug = require('../src/index');
1819
}
1920

2021
describe('debug', function () {
2122
function withDebug(cb) {
2223
function requireDebug() {
23-
delete require.cache[require.resolve('../src/index')];
24-
delete require.cache[require.resolve('../src/node.js')];
25-
return require('../src/index');
24+
if (typeof module !== 'undefined') {
25+
delete require.cache[require.resolve('../src/index')];
26+
delete require.cache[require.resolve('../src/node.js')];
27+
return require('../src/index');
28+
}
29+
return debug;
2630
}
2731

2832
cb(requireDebug());
@@ -86,6 +90,11 @@ describe('debug', function () {
8690
});
8791

8892
context('toggle namespace in logs', function () {
93+
// namespace hiding relies on environment variable and does not apply to browser
94+
if (typeof process === 'undefined') {
95+
return;
96+
}
97+
8998
it('produces the log with namespace (default behavior)', function () {
9099
process.env.DEBUG_HIDE_DATE = true;
91100
withDebug(function(debugInstance) {

0 commit comments

Comments
 (0)