Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamically change main entry point in package.json when running tests #185

Closed
mike-lischke opened this issue Jan 20, 2023 · 4 comments
Closed

Comments

@mike-lischke
Copy link

My extension is bundled using esbuild and I set the produced out/main.js file as main entry point in package.json.

For testing I do not use esbuild, but tsc, which produces different files and I have to change the main entry point to out/extension/extension.js. Doing this manually is obviously not a good solution, so I wonder if and how I can override this when starting the tests with @vscode/test-electron?

@connor4312
Copy link
Member

We don't support this, and it's unlikely that we would do it in this way. Some extensions compile their package.json into a subdirectory and launch out of there.

That said I understand the pain of testing when using a bundler to produce the extension. I want to find a homogenous solution to this case, but this approach is not complete. #186

@zm-cttae-archive
Copy link

zm-cttae-archive commented Mar 8, 2023

Testability would be severely impacted by changing the main entry point. What if the test entry point meets the functional requirement of your test suite, but main doesn't? (E.g. does not error out on running activate... or returned API interface has specific behaviour)

@mike-lischke
Copy link
Author

I'm all ears @M00TSDNS for a better solution, but changing the main entry point was the only way I could get both variations to work.

@zm-cttae-archive
Copy link

I used webpack-cli to bundle the main entrypoint of my library as UMD and it worked:

#186 (comment)

esbuild targeting node should work for node-only. Can you link your solution so we could feedforward?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants