Skip to content

Commit

Permalink
Add tests for ensuring top level awaits
Browse files Browse the repository at this point in the history
  • Loading branch information
voxpelli committed Jan 31, 2022
1 parent e777256 commit 73eb1e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .eslintrc.json
@@ -1,6 +1,6 @@
{
"parserOptions": {
"ecmaVersion": 2021,
"ecmaVersion": 2022,
"ecmaFeatures": {
"jsx": true
},
Expand Down
8 changes: 8 additions & 0 deletions test/validate-config.js
Expand Up @@ -8,3 +8,11 @@ test('load config in eslint to validate all rule syntax is correct', async funct
t.equal(lintResult.errorCount, 0)
t.end()
})

test('ensure we allow top level await', async function (t) {
const eslint = new ESLint()
const code = 'const foo = await 1\nconst bar = function () {}\nawait bar(foo)\n'
const [lintResult] = await eslint.lintText(code)
t.equal(lintResult.errorCount, 0)
t.end()
})

0 comments on commit 73eb1e6

Please sign in to comment.