You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* disposableFiles: fix edge cases again
PROBLEM:
some tests implicitly depend on the global `ExtensionDisposableFiles.INSTANCE`,
other tests clear it, but it is not correctly re-initialized.
SOLUTION:
use `clearInstance()`, and rearrange its logic to avoid a race
condition. Hoist `TestExtensionDisposableFiles` into
`FakeExtensionContext` so it can use `clearInstance()`.
ANALYSIS:
Previous attempt to fix this in f143bad was incomplete, and only
"worked" by accident. Problem resurfaces in `feature/debugconfig`
because it has more tests that depend on `ExtensionDisposableFiles.INSTANCE`.
Rearrange `clearInstance()` so that
ExtensionDisposableFiles.INSTANCE = undefined
is the first step. Because `del.sync()` does file IO, node may switch to
another context while it waits on the file IO.
Fixes this error (among others):
1) localLambdaRunner
"before all" hook in "localLambdaRunner":
Error: ExtensionDisposableFiles already initialized
at Function.<anonymous> (/Volumes/workplace/aws-toolkit-vscode/src/shared/utilities/disposableFiles.ts:78:19)
at Generator.next (<anonymous>)
at /Volumes/workplace/aws-toolkit-vscode/dist/src/shared/utilities/disposableFiles.js:12:71
at new Promise (<anonymous>)
at /Volumes/workplace/aws-toolkit-vscode/dist/src/shared/utilities/disposableFiles.js:8:12
at Function.initialize (/Volumes/workplace/aws-toolkit-vscode/dist/src/shared/utilities/disposableFiles.js:79:16)
at Function.<anonymous> (/Volumes/workplace/aws-toolkit-vscode/src/test/fakeExtensionContext.ts:72:44)
at Generator.next (<anonymous>)
at /Volumes/workplace/aws-toolkit-vscode/dist/src/test/fakeExtensionContext.js:12:71
at new Promise (<anonymous>)
at /Volumes/workplace/aws-toolkit-vscode/dist/src/test/fakeExtensionContext.js:8:12
at Function.getNew (/Volumes/workplace/aws-toolkit-vscode/dist/src/test/fakeExtensionContext.js:54:16)
at /Volumes/workplace/aws-toolkit-vscode/src/test/shared/codelens/localLambdaRunner.test.ts:22:36
at Generator.next (<anonymous>)
at /Volumes/workplace/aws-toolkit-vscode/dist/src/test/shared/codelens/localLambdaRunner.test.js:12:71
at new Promise (<anonymous>)
at /Volumes/workplace/aws-toolkit-vscode/dist/src/test/shared/codelens/localLambdaRunner.test.js:8:12
at Context.<anonymous> (/Volumes/workplace/aws-toolkit-vscode/src/test/shared/codelens/localLambdaRunner.test.ts:21:23)
at processImmediate (internal/timers.js:439:21)
at process.topLevelDomainCallback (domain.js:131:23)
* fixup! disposableFiles: fix edge cases again
0 commit comments