Skip to content

Add launch tests to launch.json#320

Merged
renkun-ken merged 6 commits intoREditorSupport:masterfrom
renkun-ken:launch-tests
May 16, 2020
Merged

Add launch tests to launch.json#320
renkun-ken merged 6 commits intoREditorSupport:masterfrom
renkun-ken:launch-tests

Conversation

@renkun-ken
Copy link
Copy Markdown
Member

This PR adds a launch configuration to run extension tests according to https://code.visualstudio.com/api/working-with-extensions/testing-extension#debugging-the-tests.

@andycraig
Copy link
Copy Markdown
Collaborator

Thank you for trying to solve this! I tried it but I get the same error I was getting with my earlier attempt:

Error: Error: Cannot find module '/home/ac/projects/r/vscode-R-2/vscode-R/out/test/suite/index'
Require stack:
- /usr/share/code/resources/app/out/vs/loader.js
- /usr/share/code/resources/app/out/bootstrap-amd.js
- /usr/share/code/resources/app/out/bootstrap-fork.js
	at h._doHandleExtensionTests (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:827:661)
	at processTicksAndRejections (internal/process/task_queues.js:85:5)
extensionHostProcess.js:826

The problem I have is that it doesn't do TypeScript to JavaScript compilation step. If the out directory already exists (e.g., from running npm run test in the terminal) it looks like it works, but it's running the tests from the existing version of out without creating it/updating it. Does it work for you if you delete out before running Extension Tests?

@renkun-ken
Copy link
Copy Markdown
Member Author

@andycraig Thanks for testing!

I update the tasks.json to the latest format and add a pretest task to generate out folder. The Extension Tests runs pretest before launching so that the out folder is generated before running tests. The tasks should work normally now.

@andycraig
Copy link
Copy Markdown
Collaborator

So that's what was needed! This works for me on Ubuntu. I tested 'Launch Extension' and 'Extension Tests' in Ubuntu and confirmed that both use the current code. I will test on Windows a little bit later and will post the results.

@renkun-ken
Copy link
Copy Markdown
Member Author

renkun-ken commented May 10, 2020

The tasks.json and launch.json are edited to be consistent with the hello-world example introduced at https://code.visualstudio.com/api/get-started/your-first-extension or https://github.com/Microsoft/vscode-extension-samples/tree/master/helloworld-sample.

However, the breakpoints do not work for some reason. I'm trying to figure out why. It used to be working a few weeks ago.

Do breakpoints work for you?

@andycraig
Copy link
Copy Markdown
Collaborator

On Windows, 6c80773 (previous commit) works for me but the current commit gives me the 'Cannot find module' error. On Ubuntu, both work.

Breakpoints don't work for me but they haven't been working for me for a while now.

@renkun-ken
Copy link
Copy Markdown
Member Author

@andycraig Does the latest commit work for you on Windows?

It works for me on both Ubuntu and macOS. The breakpoints also work well on Ubuntu but not on macOS. No clue at the moment.

@andycraig
Copy link
Copy Markdown
Collaborator

The latest commit works for me on Windows. And breakpoints work now too! Thank you!

@renkun-ken
Copy link
Copy Markdown
Member Author

Thanks for testing!

@renkun-ken renkun-ken merged commit b27399c into REditorSupport:master May 16, 2020
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

Successfully merging this pull request may close these issues.

2 participants