orta / TypeScript-TSServer-Plugin-Template

51 stars 15 forks source link

Testing #1

Open rictic opened 2 years ago

rictic commented 2 years ago

Any advice on how to write an integration test of a ts plugin?

Currently considering using ttypescript, or just manually hooking up a typescript compiler using the API

orta commented 2 years ago

II'd probably try using the compiler API 👍🏻

rictic commented 2 years ago

I ended up going with just integration testing it inside of VS Code, which is working well, and gives assurance that the entire thing is working end to end. See https://github.com/runem/lit-analyzer/pull/229 and https://github.com/runem/lit-analyzer/pull/232

The only hacky part is that I haven't figured out a clean way to wait for the TS server to come online and begin responding to editor requests, and have resorted to polling until the results look right. Any ideas?

rictic commented 2 years ago

Update on that: in order to test that the plugin works after packaging, I've added a step to build a vsix file, unzip it outside of the repo dir, and then point @vscode/electron at that. This caught a tricky bug, where due to a dep erroneously being put into developmentDependencies, our plugin was working fine in development but would not boot after packaging. See: https://github.com/runem/lit-analyzer/pull/233