Skip to content

Commit

Permalink
Add tagged template literals to test to improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastaegert committed Mar 31, 2020
1 parent ee5a4fe commit acf0777
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 13 deletions.
Expand Up @@ -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 (4:1) Cannot call a namespace ('foo')",
"main.js (8:1) Cannot call a namespace ('foo')"
]);
}
};
11 changes: 7 additions & 4 deletions 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) {}
@@ -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')"
]);
}
};
10 changes: 7 additions & 3 deletions 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 {}

0 comments on commit acf0777

Please sign in to comment.