diff --git a/lib/6to5/transformation/transformers/other/use-strict.js b/lib/6to5/transformation/transformers/other/use-strict.js index 2b8251a41b..3965a463de 100644 --- a/lib/6to5/transformation/transformers/other/use-strict.js +++ b/lib/6to5/transformation/transformers/other/use-strict.js @@ -17,5 +17,5 @@ exports.FunctionExpression = function (node, parent, scope, context) { }; exports.ThisExpression = function (node, parent, scope, context, file) { - throw file.errorWithNode(node, "Top level `this` is not allowed", ReferenceError); + throw file.errorWithNode(node, "Top level `this` is `undefined` in strict mode", ReferenceError); }; diff --git a/test/fixtures/transformation/use-strict/illegal-this-arrow-function/options.json b/test/fixtures/transformation/use-strict/illegal-this-arrow-function/options.json index c1e1e00456..3137168db6 100644 --- a/test/fixtures/transformation/use-strict/illegal-this-arrow-function/options.json +++ b/test/fixtures/transformation/use-strict/illegal-this-arrow-function/options.json @@ -1,3 +1,3 @@ { - "throws": "Top level `this` is not allowed" + "throws": "Top level `this` is `undefined` in strict mode" } diff --git a/test/fixtures/transformation/use-strict/illegal-this-root-call/options.json b/test/fixtures/transformation/use-strict/illegal-this-root-call/options.json index c1e1e00456..3137168db6 100644 --- a/test/fixtures/transformation/use-strict/illegal-this-root-call/options.json +++ b/test/fixtures/transformation/use-strict/illegal-this-root-call/options.json @@ -1,3 +1,3 @@ { - "throws": "Top level `this` is not allowed" + "throws": "Top level `this` is `undefined` in strict mode" } diff --git a/test/fixtures/transformation/use-strict/illegal-this-root-declaration/options.json b/test/fixtures/transformation/use-strict/illegal-this-root-declaration/options.json index c1e1e00456..3137168db6 100644 --- a/test/fixtures/transformation/use-strict/illegal-this-root-declaration/options.json +++ b/test/fixtures/transformation/use-strict/illegal-this-root-declaration/options.json @@ -1,3 +1,3 @@ { - "throws": "Top level `this` is not allowed" + "throws": "Top level `this` is `undefined` in strict mode" } diff --git a/test/fixtures/transformation/use-strict/illegal-this-root-reference/options.json b/test/fixtures/transformation/use-strict/illegal-this-root-reference/options.json index c1e1e00456..3137168db6 100644 --- a/test/fixtures/transformation/use-strict/illegal-this-root-reference/options.json +++ b/test/fixtures/transformation/use-strict/illegal-this-root-reference/options.json @@ -1,3 +1,3 @@ { - "throws": "Top level `this` is not allowed" + "throws": "Top level `this` is `undefined` in strict mode" }