Reputation: 83
I have been working on a extension for Visual Studio Code (v1.15.0). It contains commands (functions) to change HTML code in the VSCode editor window, for code conversion purposes.
I decided to extend my unit test code with an test-data.html file. So the test are running on a prepared HTML document, to test the commands and results.
My launch.json file, contains something like
... "args": ["${workspaceRoot}/test/test-data.html", "--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ], ...
Everything works fine, except for the fact that after the test (with tested code changes), the test file is saved. Ruin the original test data set.
I would like to disable the auto save in the 'Extension Development Host' environment, when my test are run. Can we do that or maybe, introduce a couple of undoes?
Or create a copy in the ./out folder and use that? Then how to do that.
Aug. 18, additional note It's a strange problem. I'm working on this project at home and at work. Different machines. VSC is same version, maybe different extensions. This problem of compromising my original test data, occurs only when working at Home. On the work PC everything works as expected, test data stays as it is.
Maybe something like 'auto save', I need to investigate.
Sep. 8, additional note Nailed it, it was the 'Auto Save' option turned on. Not sure why it was set. Problem solved (I also implemented a copy function, which solved the problem also).
Upvotes: 1
Views: 1053
Reputation: 53532
Use fs-extra to copy your test-data.html file to the out
folder and then use the same command you used to load it, just change /test
to /out
.
Upvotes: 0