mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
330f25ef82
Make changes so that tests will pass when the comma-dangle settings applied to the rest of the code base are also applied to tests. PR-URL: https://github.com/nodejs/node/pull/37930 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is>
28 lines
624 B
JavaScript
28 lines
624 B
JavaScript
/* eslint-disable strict */
|
|
require('../common');
|
|
|
|
// In Node.js 0.10, a bug existed that caused strict functions to not capture
|
|
// their environment when evaluated. When run in 0.10 `test()` fails with a
|
|
// `ReferenceError`. See https://github.com/nodejs/node/issues/2245 for details.
|
|
|
|
const assert = require('assert');
|
|
|
|
function test() {
|
|
|
|
const code = [
|
|
'var foo = {m: 1};',
|
|
'',
|
|
'function bar() {',
|
|
'\'use strict\';',
|
|
'return foo; // foo isn\'t captured in 0.10',
|
|
'};',
|
|
].join('\n');
|
|
|
|
eval(code);
|
|
|
|
return bar(); // eslint-disable-line no-undef
|
|
|
|
}
|
|
|
|
assert.deepStrictEqual(test(), { m: 1 });
|