Browse Source

Fix warn-on-top-level-this test

legacy-quote-reserved-properties
Daniel K 8 years ago
committed by GitHub
parent
commit
8cb47862a2
  1. 7
      test/function/warn-on-top-level-this/_config.js

7
test/function/warn-on-top-level-this/_config.js

@ -3,9 +3,10 @@ const assert = require( 'assert' );
module.exports = {
description: 'warns on top-level this (#770)',
warnings: warnings => {
assert.deepEqual( warnings, [
'The `this` keyword is equivalent to `undefined` at the top level of an ES module, and has been rewritten'
]);
const message = `The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten`;
assert.equal(warnings.length, 1);
assert.equal(warnings[0].indexOf(message), 0);
assert(warnings[0].match(/\(in.*warn-on-top-level-this.*\)/));
},
runtimeError: err => {
assert.equal( err.message, `Cannot set property 'foo' of undefined` );

Loading…
Cancel
Save