diff --git a/package.json b/package.json index 153ed7dc02e..45beb98b7b1 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "compile": "gulp compile --max_old_space_size=4095", "watch": "gulp watch --max_old_space_size=4095", "watch-client": "gulp watch-client --max_old_space_size=4095", - "monaco-editor-test": "mocha --only-monaco-editor", + "mocha": "mocha test/unit/node/all.js --delay", "precommit": "node build/gulpfile.hygiene.js", "gulp": "gulp --max_old_space_size=8192", "electron": "node build/lib/electron", diff --git a/src/vs/workbench/browser/parts/views/customView.ts b/src/vs/workbench/browser/parts/views/customView.ts index 4967df2099e..35c3572b11a 100644 --- a/src/vs/workbench/browser/parts/views/customView.ts +++ b/src/vs/workbench/browser/parts/views/customView.ts @@ -767,6 +767,7 @@ class TreeRenderer extends Disposable implements ITreeRenderer{ $treeViewId: this.treeViewId, $treeItemHandle: node.handle }; diff --git a/test/README.md b/test/README.md index bccc0fa5c18..b2b3aad12ea 100644 --- a/test/README.md +++ b/test/README.md @@ -1,32 +1,9 @@ -# Tests +# VSCode Tests -## Run +## Contents -The best way to run the Code tests is from the terminal. To make development changes to unit tests you need to be running `yarn run watch`. See [Development Workflow](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#incremental-build) for more details. From the `vscode` folder run: - -**OS X and Linux** - - ./scripts/test.sh - -**Windows** - - scripts\test - - -## Debug - -To debug tests use `--debug` when running the test script. Also, the set of tests can be reduced with the `--run` and `--runGlob` flags. Both require a file path/pattern. Like so: - - ./scripts/test.sh --debug --runGrep **/extHost*.test.js - -## Coverage - -The following command will create a `coverage` folder at the root of the workspace: - -**OS X and Linux** - - ./scripts/test.sh --coverage - -**Windows** - - scripts\test --coverage +This folder contains the various test runners for VSCode. Please refer to the documentation within for how to run them: +* `unit`: our suite of unit tests +* `integration`: our suite of API tests +* `smoke`: our suite of automated UI tests +* `ui`: our suite of manual UI tests diff --git a/test/automation/package.json b/test/automation/package.json index 744778d5785..a3f3baf2f40 100644 --- a/test/automation/package.json +++ b/test/automation/package.json @@ -20,9 +20,9 @@ "prepublishOnly": "npm run copy-package-version" }, "devDependencies": { + "@types/debug": "4.1.5", "@types/mkdirp": "0.5.1", "@types/ncp": "2.0.1", - "@types/debug": "4.1.5", "@types/node": "^12.11.7", "@types/tmp": "0.1.0", "concurrently": "^3.5.1", @@ -33,7 +33,6 @@ "dependencies": { "mkdirp": "^0.5.1", "ncp": "^2.0.0", - "playwright": "0.10.0", "tmp": "0.1.0", "vscode-uri": "^2.0.3" } diff --git a/test/automation/yarn.lock b/test/automation/yarn.lock index 65be684bc57..98c63c91e0d 100644 --- a/test/automation/yarn.lock +++ b/test/automation/yarn.lock @@ -41,13 +41,6 @@ abbrev@1: resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== -agent-base@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee" - integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg== - dependencies: - es6-promisify "^5.0.0" - ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" @@ -128,11 +121,6 @@ async-each@^1.0.0: resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.3.tgz#b727dbf87d7651602f06f4d4ac387f47d91b0cbf" integrity sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ== -async-limiter@~1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" - integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== - atob@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" @@ -202,11 +190,6 @@ braces@^2.3.1: split-string "^3.0.2" to-regex "^3.0.1" -buffer-from@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" - integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== - cache-base@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" @@ -302,16 +285,6 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= -concat-stream@1.6.2: - version "1.6.2" - resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" - integrity sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw== - dependencies: - buffer-from "^1.0.0" - inherits "^2.0.3" - readable-stream "^2.2.2" - typedarray "^0.0.6" - concurrently@^3.5.1: version "3.6.1" resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-3.6.1.tgz#2f95baec5c4051294dfbb55b57a3b98a3e2b45ec" @@ -369,27 +342,20 @@ date-fns@^1.23.0: resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c" integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw== -debug@2.6.9, debug@^2.2.0, debug@^2.3.3: +debug@^2.2.0, debug@^2.3.3: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== dependencies: ms "2.0.0" -debug@^3.1.0, debug@^3.2.6: +debug@^3.2.6: version "3.2.6" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== dependencies: ms "^2.1.1" -debug@^4.1.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" - integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== - dependencies: - ms "^2.1.1" - decode-uri-component@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" @@ -444,18 +410,6 @@ error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" -es6-promise@^4.0.3: - version "4.2.8" - resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" - integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== - -es6-promisify@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203" - integrity sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM= - dependencies: - es6-promise "^4.0.3" - escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -531,23 +485,6 @@ extglob@^2.0.4: snapdragon "^0.8.1" to-regex "^3.0.1" -extract-zip@^1.6.6: - version "1.6.7" - resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-1.6.7.tgz#a840b4b8af6403264c8db57f4f1a74333ef81fe9" - integrity sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k= - dependencies: - concat-stream "1.6.2" - debug "2.6.9" - mkdirp "0.5.1" - yauzl "2.4.1" - -fd-slicer@~1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/fd-slicer/-/fd-slicer-1.0.1.tgz#8b5bcbd9ec327c5041bf9ab023fd6750f1177e65" - integrity sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU= - dependencies: - pend "~1.2.0" - filename-regex@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" @@ -727,14 +664,6 @@ hosted-git-info@^2.1.4: resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.4.tgz#44119abaf4bc64692a16ace34700fed9c03e2546" integrity sha512-pzXIvANXEFrc5oFFXRMkbLPQ2rXRoDERwDLyrcUxGhaZhgP54BBSl9Oheh7Vv0T090cszWBxPjkQQ5Sq1PbBRQ== -https-proxy-agent@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-3.0.1.tgz#b8c286433e87602311b01c8ea34413d856a4af81" - integrity sha512-+ML2Rbh6DAuee7d07tYGEKOEi2voWPUGan+ExdPbPW6Z3svq+JCqr0v8WmKPOkz1vOVykPCBSuobe7G8GJUtVg== - dependencies: - agent-base "^4.3.0" - debug "^3.1.0" - iconv-lite@^0.4.4: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" @@ -757,7 +686,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.3: +inherits@2, inherits@^2.0.1, inherits@~2.0.3: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -936,11 +865,6 @@ isobject@^3.0.0, isobject@^3.0.1: resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= -jpeg-js@^0.3.6: - version "0.3.6" - resolved "https://registry.yarnpkg.com/jpeg-js/-/jpeg-js-0.3.6.tgz#c40382aac9506e7d1f2d856eb02f6c7b2a98b37c" - integrity sha512-MUj2XlMB8kpe+8DJUGH/3UJm4XpI8XEgZQ+CiHDeyrGoKPdW/8FJv6ku+3UiYm5Fz3CWaL+iXmD8Q4Ap6aC1Jw== - json-parse-better-errors@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" @@ -1045,11 +969,6 @@ micromatch@^3.1.10: snapdragon "^0.8.1" to-regex "^3.0.2" -mime@^2.0.3: - version "2.4.4" - resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.4.tgz#bd7b91135fc6b01cde3e9bae33d659b63d8857e5" - integrity sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA== - minimatch@^3.0.2, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" @@ -1090,7 +1009,7 @@ mixin-deep@^1.2.0: for-in "^1.0.2" is-extendable "^1.0.1" -mkdirp@0.5.1, mkdirp@^0.5.0, mkdirp@^0.5.1: +mkdirp@^0.5.0, mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= @@ -1313,45 +1232,11 @@ path-type@^3.0.0: dependencies: pify "^3.0.0" -pend@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50" - integrity sha1-elfrVQpng/kRUzH89GY9XI4AelA= - pify@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY= -playwright-core@=0.10.0: - version "0.10.0" - resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-0.10.0.tgz#86699c9cc3e613d733e6635a54aceea1993013d5" - integrity sha512-yernA6yrrBhmb8M5eO6GZsJOrBKWOZszlu65Luz8LP7ryaDExN1sE9XjQBNbiwJ5Gfs8cehtAO7GfTDJt+Z2cQ== - dependencies: - debug "^4.1.0" - extract-zip "^1.6.6" - https-proxy-agent "^3.0.0" - jpeg-js "^0.3.6" - mime "^2.0.3" - pngjs "^3.4.0" - progress "^2.0.3" - proxy-from-env "^1.0.0" - rimraf "^2.6.1" - uuid "^3.4.0" - ws "^6.1.0" - -playwright@0.10.0: - version "0.10.0" - resolved "https://registry.yarnpkg.com/playwright/-/playwright-0.10.0.tgz#d37f7e42e0e868dcc4ec35cb0a8dbc6248457642" - integrity sha512-f3VRME/PIO5NbcWnlCDfXwPC0DAZJ7ETkcAdE+sensLCOkfDtLh97E71ZuxNCaPYsUA6FIPi5syD8pHJW/4hQQ== - dependencies: - playwright-core "=0.10.0" - -pngjs@^3.4.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-3.4.0.tgz#99ca7d725965fb655814eaf65f38f12bbdbf555f" - integrity sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w== - posix-character-classes@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" @@ -1367,16 +1252,6 @@ process-nextick-args@~2.0.0: resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== -progress@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" - integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== - -proxy-from-env@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.0.0.tgz#33c50398f70ea7eb96d21f7b817630a55791c7ee" - integrity sha1-M8UDmPcOp+uW0h97gXYwpVeRx+4= - randomatic@^3.0.0: version "3.1.1" resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-3.1.1.tgz#b776efc59375984e36c537b2f51a1f0aff0da1ed" @@ -1405,7 +1280,7 @@ read-pkg@^3.0.0: normalize-package-data "^2.3.2" path-type "^3.0.0" -readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.2.2: +readable-stream@^2.0.2, readable-stream@^2.0.6: version "2.3.6" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" integrity sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw== @@ -1764,11 +1639,6 @@ tree-kill@^1.1.0: resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.1.tgz#5398f374e2f292b9dcc7b2e71e30a5c3bb6c743a" integrity sha512-4hjqbObwlh2dLyW4tcz0Ymw0ggoaVDMveUB9w8kFSQScdRLo0gxO9J7WFcUBo+W3C1TLdFIEwNOWebgZZ0RH9Q== -typedarray@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" - integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= - typescript@3.7.5: version "3.7.5" resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.5.tgz#0692e21f65fd4108b9330238aac11dd2e177a1ae" @@ -1807,11 +1677,6 @@ util-deprecate@~1.0.1: resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= -uuid@^3.4.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" - integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== - validate-npm-package-license@^3.0.1: version "3.0.4" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" @@ -1845,21 +1710,7 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -ws@^6.1.0: - version "6.2.1" - resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.1.tgz#442fdf0a47ed64f59b6a5d8ff130f4748ed524fb" - integrity sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA== - dependencies: - async-limiter "~1.0.0" - yallist@^3.0.0, yallist@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.3.tgz#b4b049e314be545e3ce802236d6cd22cd91c3de9" integrity sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A== - -yauzl@2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.4.1.tgz#9528f442dab1b2284e58b4379bb194e22e0c4005" - integrity sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU= - dependencies: - fd-slicer "~1.0.1" diff --git a/test/splitview/package.json b/test/ui/splitview/package.json similarity index 100% rename from test/splitview/package.json rename to test/ui/splitview/package.json diff --git a/test/splitview/public/index.html b/test/ui/splitview/public/index.html similarity index 100% rename from test/splitview/public/index.html rename to test/ui/splitview/public/index.html diff --git a/test/splitview/server.js b/test/ui/splitview/server.js similarity index 100% rename from test/splitview/server.js rename to test/ui/splitview/server.js diff --git a/test/splitview/yarn.lock b/test/ui/splitview/yarn.lock similarity index 100% rename from test/splitview/yarn.lock rename to test/ui/splitview/yarn.lock diff --git a/test/tree/package.json b/test/ui/tree/package.json similarity index 100% rename from test/tree/package.json rename to test/ui/tree/package.json diff --git a/test/tree/public/compressed.json b/test/ui/tree/public/compressed.json similarity index 100% rename from test/tree/public/compressed.json rename to test/ui/tree/public/compressed.json diff --git a/test/tree/public/index.html b/test/ui/tree/public/index.html similarity index 100% rename from test/tree/public/index.html rename to test/ui/tree/public/index.html diff --git a/test/tree/server.js b/test/ui/tree/server.js similarity index 100% rename from test/tree/server.js rename to test/ui/tree/server.js diff --git a/test/tree/tree.js b/test/ui/tree/tree.js similarity index 100% rename from test/tree/tree.js rename to test/ui/tree/tree.js diff --git a/test/tree/yarn.lock b/test/ui/tree/yarn.lock similarity index 100% rename from test/tree/yarn.lock rename to test/ui/tree/yarn.lock diff --git a/test/unit/README.md b/test/unit/README.md new file mode 100644 index 00000000000..96d866fe6ad --- /dev/null +++ b/test/unit/README.md @@ -0,0 +1,45 @@ +# Unit Tests + +## Run (inside Electron) + +The best way to run the unit tests is from the terminal. To make development changes to unit tests you need to be running `yarn watch`. See [Development Workflow](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#incremental-build) for more details. From the `vscode` folder run: + +**OS X and Linux** + + ./scripts/test.sh + +**Windows** + + scripts\test + + +## Run (inside browser) + +You can run tests inside a browser instance too: + +**OS X and Linux** + + node test/unit/browser/index.js + +**Windows** + + node test\unit\browser\index.js + + +## Debug + +To debug tests use `--debug` when running the test script. Also, the set of tests can be reduced with the `--run` and `--runGlob` flags. Both require a file path/pattern. Like so: + + ./scripts/test.sh --debug --runGrep **/extHost*.test.js + +## Coverage + +The following command will create a `coverage` folder at the root of the workspace: + +**OS X and Linux** + + ./scripts/test.sh --coverage + +**Windows** + + scripts\test --coverage diff --git a/test/all.js b/test/unit/node/all.js similarity index 71% rename from test/all.js rename to test/unit/node/all.js index 834d63250bb..6f1fb97a875 100644 --- a/test/all.js +++ b/test/unit/node/all.js @@ -11,38 +11,38 @@ const path = require('path'); const glob = require('glob'); const jsdom = require('jsdom-no-contextify'); const TEST_GLOB = '**/test/**/*.test.js'; -const coverage = require('./coverage'); +const coverage = require('../../coverage'); -var optimist = require('optimist') +const optimist = require('optimist') .usage('Run the Code tests. All mocha options apply.') .describe('build', 'Run from out-build').boolean('build') .describe('run', 'Run a single file').string('run') .describe('coverage', 'Generate a coverage report').boolean('coverage') - .describe('only-monaco-editor', 'Run only monaco editor tests').boolean('only-monaco-editor') .describe('browser', 'Run tests in a browser').boolean('browser') .alias('h', 'help').boolean('h') .describe('h', 'Show help'); -var argv = optimist.argv; +const argv = optimist.argv; if (argv.help) { optimist.showHelp(); process.exit(1); } -var out = argv.build ? 'out-build' : 'out'; -var loader = require('../' + out + '/vs/loader'); -var src = path.join(path.dirname(__dirname), out); +const REPO_ROOT = path.join(__dirname, '../../../'); +const out = argv.build ? 'out-build' : 'out'; +const loader = require(`../../../${out}/vs/loader`); +const src = path.join(REPO_ROOT, out); function main() { process.on('uncaughtException', function (e) { console.error(e.stack || e); }); - var loaderConfig = { + const loaderConfig = { nodeRequire: require, nodeMain: __filename, - baseUrl: path.join(path.dirname(__dirname), 'src'), + baseUrl: path.join(REPO_ROOT, 'src'), paths: { 'vs/css': '../test/css.mock', 'vs': `../${out}/vs`, @@ -75,17 +75,17 @@ function main() { global.navigator = global.window.navigator; global.XMLHttpRequest = global.window.XMLHttpRequest; - var didErr = false; - var write = process.stderr.write; + let didErr = false; + const write = process.stderr.write; process.stderr.write = function (data) { didErr = didErr || !!data; write.apply(process.stderr, arguments); }; - var loadFunc = null; + let loadFunc = null; if (argv.runGlob) { - loadFunc = cb => { + loadFunc = (cb) => { const doRun = tests => { const modulesToLoad = tests.map(test => { if (path.isAbsolute(test)) { @@ -100,41 +100,19 @@ function main() { glob(argv.runGlob, { cwd: src }, function (err, files) { doRun(files); }); }; } else if (argv.run) { - var tests = (typeof argv.run === 'string') ? [argv.run] : argv.run; - var modulesToLoad = tests.map(function (test) { + const tests = (typeof argv.run === 'string') ? [argv.run] : argv.run; + const modulesToLoad = tests.map(function (test) { test = test.replace(/^src/, 'out'); test = test.replace(/\.ts$/, '.js'); return path.relative(src, path.resolve(test)).replace(/(\.js)|(\.js\.map)$/, '').replace(/\\/g, '/'); }); - loadFunc = cb => { + loadFunc = (cb) => { define(modulesToLoad, () => cb(null), cb); }; - } else if (argv['only-monaco-editor']) { - loadFunc = function (cb) { - glob(TEST_GLOB, { cwd: src }, function (err, files) { - var modulesToLoad = files.map(function (file) { - return file.replace(/\.js$/, ''); - }); - modulesToLoad = modulesToLoad.filter(function (module) { - if (/^vs\/workbench\//.test(module)) { - return false; - } - // platform tests drag in the workbench. - // see https://github.com/Microsoft/vscode/commit/12eaba2f64c69247de105c3d9c47308ac6e44bc9 - // and cry a little - if (/^vs\/platform\//.test(module)) { - return false; - } - return !/(\/|\\)node(\/|\\)/.test(module); - }); - console.log(JSON.stringify(modulesToLoad, null, '\t')); - define(modulesToLoad, function () { cb(null); }, cb); - }); - }; } else { - loadFunc = function (cb) { + loadFunc = (cb) => { glob(TEST_GLOB, { cwd: src }, function (err, files) { - var modulesToLoad = files.map(function (file) { + const modulesToLoad = files.map(function (file) { return file.replace(/\.js$/, ''); }); define(modulesToLoad, function () { cb(null); }, cb); @@ -160,7 +138,7 @@ function main() { } // report failing test for every unexpected error during any of the tests - var unexpectedErrors = []; + let unexpectedErrors = []; suite('Errors', function () { test('should not have unexpected errors in tests', function () { if (unexpectedErrors.length) { @@ -177,7 +155,7 @@ function main() { // replace the default unexpected error handler to be useful during tests loader(['vs/base/common/errors'], function (errors) { errors.setUnexpectedErrorHandler(function (err) { - let stack = (err && err.stack) || (new Error().stack); + const stack = (err && err.stack) || (new Error().stack); unexpectedErrors.push((err && err.message ? err.message : err) + '\n' + stack); }); @@ -188,7 +166,7 @@ function main() { } if (process.argv.some(function (a) { return /^--browser/.test(a); })) { - require('./browser'); + require('../../browser'); } else { main(); }