Skip to content

Commit

Permalink
Yarn and code coverage (#475)
Browse files Browse the repository at this point in the history
* Fixes #421 (move from npm to yarn)
* Fixes #464 (code coverage of the extension code) 
* Fixes to some unit tests that were failing just on Windows
  • Loading branch information
DonJayamanne authored Jan 3, 2018
1 parent f82af7a commit 9853956
Show file tree
Hide file tree
Showing 36 changed files with 5,181 additions and 6,989 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ node_modules
__pycache__
npm-debug.log
**/.mypy_cache/**
!yarn.lock
coverage/
34 changes: 15 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
language: python
cache: pip

addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.9
- g++-4.9
- gcc-4.9-multilib
- g++-4.9-multilib
- libgtk2.0-0
- libx11-dev
- libxkbfile-dev
- libsecret-1-dev
- python-dev
matrix:
include:
# # Use the built in venv for linux builds
Expand Down Expand Up @@ -43,17 +29,27 @@ before_install: |
source ./.nvm/nvm.sh
nvm install 8.9.1
nvm use 8.9.1
npm i -g npm@5.5.1
npm config set python `which python`
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
pyenv install $PYTHON
pyenv global $PYTHON
fi
export TRAVIS_PYTHON_PATH=`which python`
install:
- pip install --upgrade -r requirements.txt
- npm install
- npm run vscode:prepublish
- yarn

script:
- npm test --silent
- yarn run clean
- yarn run vscode:prepublish
- yarn run cover:enable
- yarn run testSingleWorkspace --silent
- if [ $TRAVIS_UPLOAD_COVERAGE == "true" ]; then
bash <(curl -s https://codecov.io/bash);
fi
- yarn run clean
- yarn run vscode:prepublish
- yarn run cover:enable
- yarn run testMultiWorkspace --silent
- if [ $TRAVIS_UPLOAD_COVERAGE == "true" ]; then
bash <(curl -s https://codecov.io/bash);
fi
170 changes: 93 additions & 77 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,80 +1,96 @@
// A launch configuration that compiles the extension and then opens it inside a new window
{
"version": "0.1.0",
"configurations": [
{
"name": "Launch Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "Compile"
},
{
"name": "Launch Extension as debugServer", // https://code.visualstudio.com/docs/extensions/example-debuggers
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/out/client/debugger/Main.js",
"stopOnEntry": false,
"args": [
"--server=4711"
],
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/out/client/**/*.js"
],
"cwd": "${workspaceFolder}",
"preLaunchTask": "Compile"
},
{
"name": "Launch Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"${workspaceFolder}/src/test",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "Compile"
},
{
"name": "Launch Multiroot Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"${workspaceFolder}/src/testMultiRootWkspc/multi.code-workspace",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "Compile"
}
],
"compounds": [
{
"name": "Extension + Debugger",
"configurations": [
"Launch Extension",
"Launch Extension as debugServer"
]
}
]
"version": "0.1.0",
"configurations": [
{
"name": "Launch Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "Compile"
},
{
"name": "Launch Extension as debugServer", // https://code.visualstudio.com/docs/extensions/example-debuggers
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/out/client/debugger/Main.js",
"stopOnEntry": false,
"args": [
"--server=4711"
],
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/out/client/**/*.js"
],
"cwd": "${workspaceFolder}",
"preLaunchTask": "Compile"
},
{
"name": "Launch Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"${workspaceFolder}/src/test",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "Compile"
},
{
"name": "Launch Multiroot Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"${workspaceFolder}/src/testMultiRootWkspc/multi.code-workspace",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "Compile"
},
{
"name": "Launch Tests (with code coverage)",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"${workspaceFolder}/src/test",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/out/**/*.js"
]
}
],
"compounds": [
{
"name": "Extension + Debugger",
"configurations": [
"Launch Extension",
"Launch Extension as debugServer"
]
}
]
}
35 changes: 18 additions & 17 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": true, // set this to true to hide the "out" folder with the compiled JS files
"**/*.pyc": true,
"**/__pycache__": true,
"node_modules": true,
".vscode-test": true,
"**/.mypy_cache/**": true,
"**/.ropeproject/**": true
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
"typescript.tsdk": "./node_modules/typescript/lib", // we want to use the TS server from our node_modules folder to control its version
"tslint.enable": true,
"python.linting.enabled": false,
"python.unitTest.promptToConfigure": false,
"python.workspaceSymbols.enabled": false,
"files.exclude": {
"out": true, // set this to true to hide the "out" folder with the compiled JS files
"**/*.pyc": true,
"**/__pycache__": true,
"node_modules": true,
".vscode-test": true,
"**/.mypy_cache/**": true,
"**/.ropeproject/**": true
},
"search.exclude": {
"out": true, // set this to false to include "out" folder in search results
"coverage": true
},
"typescript.tsdk": "./node_modules/typescript/lib", // we want to use the TS server from our node_modules folder to control its version
"tslint.enable": true,
"python.linting.enabled": false,
"python.unitTest.promptToConfigure": false,
"python.workspaceSymbols.enabled": false,
"python.formatting.provider": "none",
"files.insertFinalNewline": true
}
15 changes: 15 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
.vscode/**
typings/**
out/test/**
out/src/**
out/pythonFiles/**
out/testMultiRootWkspc/**
test/**
src/**
scripts/**
**/*.map
.gitignore
.gitmodules
.editorconfig
.eslintrc
.gitattributes
images/**/*.gif
images/**/*.png
tsconfig.json
typings.json
coverconfig.json
tslint.json
tsfmt.json
gulpfile.js
pythonFiles/**/*.pyc
requirements.txt
vsc-extension-quickstart.md
.travis.yml
webpack.config.js
yarn.lock
coverage/**
CODE_OF_CONDUCT.md
CODING_STANDARDS.md
CONTRIBUTING.md
ISSUE_TEMPLATE.md
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
```shell
git clone https://github.com/microsoft/vscode-python
cd vscode-python
npm install
yarn install
```

### Incremental Build
Expand Down
17 changes: 17 additions & 0 deletions coverconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"enabled": false,
"relativeSourcePath": "../client",
"relativeCoverageDir": "../../coverage",
"ignorePatterns": [
"**/node_modules/**"
],
"reports": [
"text-summary",
"json-summary",
"json",
"html",
"lcov",
"lcovonly"
],
"verbose": false
}
25 changes: 25 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const colors = require('colors/safe');
const gitmodified = require('gulp-gitmodified');
const path = require('path');
const debounce = require('debounce');
const jeditor = require("gulp-json-editor");
const del = require('del');

/**
* Hygiene works by creating cascading subsets of all our files and
Expand Down Expand Up @@ -61,6 +63,29 @@ gulp.task('hygiene-watch', () => gulp.watch(all, debounce(() => run({ mode: 'cha

gulp.task('hygiene-modified', ['compile'], () => run({ mode: 'changes' }));

gulp.task('clean', ['output:clean', 'cover:clean'], () => { });

gulp.task('output:clean', () => del('coverage'));

gulp.task('cover:clean', () => del('coverage'));

gulp.task('cover:enable', () => {
return gulp.src("./coverconfig.json")
.pipe(jeditor((json) => {
json.enabled = true;
return json;
}))
.pipe(gulp.dest("./out", { 'overwrite': true }));
});

gulp.task('cover:disable', () => {
return gulp.src("./coverconfig.json")
.pipe(jeditor((json) => {
json.enabled = true;
return json;
}))
.pipe(gulp.dest("./out", { 'overwrite': true }));
});

/**
* @typedef {Object} hygieneOptions - creates a new type named 'SpecialType'
Expand Down
Loading

0 comments on commit 9853956

Please sign in to comment.