The VSCode C# Extension build process follows the VS Code docs and runs tests directly inside of its repo root. This unfortunately gives a false sense of security because bugs can be introduced during VSIX packaging [particularly due to missing content in node_modules or excluded via .vscodeignore].
This change addresses this problem by moving our CI tests to execute the VSIX instead of the build's intermediate artifacts. Specifically:
build the vsix
unpackage the vsix
instrument the unpackaged vsix
run tests with VS Code Host pointing to the unpackaged vsix
This makes our CI tests ~= to the user's runtime experience and will greatly help us with size reduction efforts.
To support this change, I also moved our build system from package.json to Gulp. This makes the build scripts significantly easier to understand, provides intellisense for build scripts, and build-time type checking for their contents.
I also strengthened the repo's use of .vscodeignore by creating a copy of the file for each scenario [online packages and offline packages]. The new gulp packaging scripts take advantage of these files to produce packages with predictable contents regardless of when packaging occurs. [small caveat, @akshita31 will be adding a test that validates that net-new content does not start sneaking into the vsix package].
Add product-wide code coverage + codecov.io integration
Several new scripts were added:
npm run cov:instrument: rebuilds your sources, then instruments them for coverage. Subsequent
npm run test will generate coverage data into the .nyc_output directory
npm run cov:merge-html: merges all reports from .nyc_output and puts a locally viewable coverage report into coverage directory
Update to tslint better enforces linter rules during build. I had to clean up some source content to permit this update.
I don't have sufficient confidence in existing tests to update runtime dependencies. This is still a todo.
This commit updates task configuration to use current
configuration keys and to limit number of warnings displayed in
VSCode itself.
Similar one:
Microsoft/vscode-generator-code#59
Thanks!
Since we use VS Code's infrastructure for running tests (allowing us to access VS Code objects inside tests), the right way to run tests inside VS Code is to launch the debugger with the 'Launch Tests' configuration. At the command-line, the 'npm test' command runs tests. However, that downloads a build of VS Code to run the tests, which doesn't support being launched while other instances of VS Code or open.
This uses the new tasks.json support in VS Code 1.9 to allow tasks to run different commands. So, now you should be able to build with <kbd>Cmd+Shift+B</kbd> in VS Code.
Since the repo started, we've had a single NPM script that ran on postinstall. All this did was run the VS Code install
script and then launch tsc. Now, postinstall just runs the VS Code install script. The idea here is that install should
really just lay down dependencies, not compile code. Compilation is split off into a separate script.
Here are the new npm scripts:
* `postinstall`: As described above, this now just runs the VS Code install script after `npm install`.
* `compile`: Runs the VS Code compile script to transpile TypeScript to JavaScript. Run this with `npm run compile`.
* `watch`: Runs the VS Code compile script with the '-watch' flag to transpile TypeScript to JavaScript, and then
watch for file changes and incrementally compile. Run this with `npm run watch`.
* `test`: Runs the tests with Mocha. Note: This will only run tests that are already transpiled to JavaScript. Run with
`npm test`.
* Unit tests can be written in the 'test' folder. See 'test/sanity.tests.ts' for an example.
* The launch.json has been updated to allow debugging of unit tests with the "Launch Tests" configuration.
* The "test" task is now configured so that you can use the "Tasks: Run Test Task" command in VS Code.
* Whitespace is a bit out of control. I've made an executable decision that the repo should have spaces with an indent
size of 4. This is now added to the settings.json.
* The 'out' folder is now excluded in settings.json so you won't see it show up in your directory tree.
* The 'node_modules' folder is now excluded from search. This has been bothering me for awhile.