diff --git a/test/function/samples/cannot-call-external-namespace/_config.js b/test/function/samples/cannot-call-external-namespace/_config.js index 4774f7de44b..6db47aaaf17 100644 --- a/test/function/samples/cannot-call-external-namespace/_config.js +++ b/test/function/samples/cannot-call-external-namespace/_config.js @@ -3,9 +3,12 @@ const assert = require('assert'); module.exports = { description: 'warns if code calls an external namespace', options: { - external: ['fs'], + external: ['fs'] }, warnings(warnings) { - assert.deepStrictEqual(warnings.map(String), ["main.js (3:2) Cannot call a namespace ('foo')"]); - }, + assert.deepStrictEqual(warnings.map(String), [ + "main.js (3:1) Cannot call a namespace ('foo')", + "main.js (7:1) Cannot call a namespace ('foo')" + ]); + } }; diff --git a/test/function/samples/cannot-call-external-namespace/main.js b/test/function/samples/cannot-call-external-namespace/main.js index 7f58e3c0da6..3c5998d3518 100644 --- a/test/function/samples/cannot-call-external-namespace/main.js +++ b/test/function/samples/cannot-call-external-namespace/main.js @@ -1,6 +1,9 @@ import * as foo from 'fs'; + try { - foo(); -} -catch (e) { -} + foo(); +} catch (e) {} + +try { + foo``; +} catch (e) {} diff --git a/test/function/samples/cannot-call-internal-namespace/_config.js b/test/function/samples/cannot-call-internal-namespace/_config.js index c96cd50f57d..b61157e6158 100644 --- a/test/function/samples/cannot-call-internal-namespace/_config.js +++ b/test/function/samples/cannot-call-internal-namespace/_config.js @@ -1,8 +1,11 @@ const assert = require('assert'); module.exports = { - description: 'errors if code calls an internal namespace', + description: 'warns if code calls an internal namespace', warnings(warnings) { - assert.deepStrictEqual(warnings.map(String), ["main.js (3:2) Cannot call a namespace ('foo')"]); - }, + assert.deepStrictEqual(warnings.map(String), [ + "main.js (4:1) Cannot call a namespace ('foo')", + "main.js (8:1) Cannot call a namespace ('foo')" + ]); + } }; diff --git a/test/function/samples/cannot-call-internal-namespace/main.js b/test/function/samples/cannot-call-internal-namespace/main.js index 745e43f541c..dcb5f372c44 100644 --- a/test/function/samples/cannot-call-internal-namespace/main.js +++ b/test/function/samples/cannot-call-internal-namespace/main.js @@ -1,5 +1,9 @@ import * as foo from './foo.js'; + try { - foo(); -} -catch {} + foo(); +} catch {} + +try { + foo``; +} catch {}