Skip to content

Commit

Permalink
test: be explicit about polluting of global
Browse files Browse the repository at this point in the history
There was a comment in `test-domain-crypto.js` indicating that the
pollution of the `global` object with a `domain` property was
intentional. Provide more information in the comment so someone may
easily determine why. Use `global.domain` rather than declaring `domain`
without the `var` keyword to more clearly signal that the pollution is
intentional.

PR-URL: #6017
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
Trott authored and Myles Borins committed Apr 5, 2016
1 parent 7db7a82 commit cc8fcc5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/parallel/test-domain-crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ try {
return;
}

// the missing var keyword is intentional
domain = require('domain');
// Pollution of global is intentional as part of test.
// See https://github.com/nodejs/node/commit/d1eff9ab
global.domain = require('domain');

// should not throw a 'TypeError: undefined is not a function' exception
crypto.randomBytes(8);
Expand Down

0 comments on commit cc8fcc5

Please sign in to comment.