I'm attempting to download and register a TypeScript-stub before running my tests. I'm using a custom ProjectDescriptor and the LightCodeInsightFixtureTestCase-class.
After much trial and error I got the following code to work when debugging the plugin:
DownloadableFileSetDescriptionWithUrl configLibrary = TypeScriptAllStubsFile.INSTANCE.getDownloadableFileSetDescription("config");
TypeScriptDefinitionFilesRootsProvider.LibraryCreator.downloadTypesLibrary(project, configLibrary, null, null);
I've two theories as to why the library remains unavailable within my tests:
1. The code-path for "downloadTypesLibrary" is littered with invokeLater(...) and the like. I'm thus unable to make the test-setup-method wait until the library has been installed.
2. The virtual-filesystem doesn't pick up the new library files and the library thus remains unavailable.
5 hours of reverse-engineering and code-decompiling later, I'm none the wiser. Much of the code is Kotlin which effectively kills my step-through-debugging.
Please help! :)