From 3bed2ec17758a2112cbebe2f2639e007e7f0d535 Mon Sep 17 00:00:00 2001 From: Leonardo Venturini Date: Mon, 27 May 2024 09:31:44 -0400 Subject: [PATCH] add test --- test/tla/exported-declaration-deep.js | 1 + test/top-level-await-tests.js | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 test/tla/exported-declaration-deep.js diff --git a/test/tla/exported-declaration-deep.js b/test/tla/exported-declaration-deep.js new file mode 100644 index 0000000..73a1f61 --- /dev/null +++ b/test/tla/exported-declaration-deep.js @@ -0,0 +1 @@ +export const value = Math.max(false ? 777 : await Promise.resolve(12), 2); \ No newline at end of file diff --git a/test/top-level-await-tests.js b/test/top-level-await-tests.js index e566766..735c8ce 100644 --- a/test/top-level-await-tests.js +++ b/test/top-level-await-tests.js @@ -95,6 +95,11 @@ import { importSync, importAsync, importAsyncEvaluated } from './tla/nested/pare assert(exports.redirected === 'value'); }) + it('should detect tla on exported declarations (deep)', async () => { + const exports = await require('./tla/exported-declaration-deep.js'); + assert(exports.value === 12); + }); + it('should not detect tla if they are inside any function type', async () => { const exports = require('./tla/await-inside-function.js'); assert(!(exports instanceof Promise))