mirror of
https://github.com/Microsoft/vscode
synced 2024-09-18 01:58:27 +00:00
tests - have a test/unit folder
This commit is contained in:
parent
d8b2334122
commit
5393954877
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
|
@ -302,7 +302,7 @@
|
||||||
"type": "node",
|
"type": "node",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "Run Unit Tests",
|
"name": "Run Unit Tests",
|
||||||
"program": "${workspaceFolder}/test/electron/index.js",
|
"program": "${workspaceFolder}/test/unit/electron/index.js",
|
||||||
"runtimeExecutable": "${workspaceFolder}/.build/electron/Code - OSS.app/Contents/MacOS/Electron",
|
"runtimeExecutable": "${workspaceFolder}/.build/electron/Code - OSS.app/Contents/MacOS/Electron",
|
||||||
"windows": {
|
"windows": {
|
||||||
"runtimeExecutable": "${workspaceFolder}/.build/electron/Code - OSS.exe"
|
"runtimeExecutable": "${workspaceFolder}/.build/electron/Code - OSS.exe"
|
||||||
|
|
|
@ -17,7 +17,7 @@ if %errorlevel% neq 0 node .\node_modules\gulp\bin\gulp.js electron
|
||||||
|
|
||||||
:: Run tests
|
:: Run tests
|
||||||
set ELECTRON_ENABLE_LOGGING=1
|
set ELECTRON_ENABLE_LOGGING=1
|
||||||
%CODE% .\test\electron\index.js %*
|
%CODE% .\test\unit\electron\index.js %*
|
||||||
|
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
|
|
@ -29,10 +29,10 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
cd $ROOT ; ulimit -n 4096 ; \
|
cd $ROOT ; ulimit -n 4096 ; \
|
||||||
ELECTRON_ENABLE_LOGGING=1 \
|
ELECTRON_ENABLE_LOGGING=1 \
|
||||||
"$CODE" \
|
"$CODE" \
|
||||||
test/electron/index.js "$@"
|
test/unit/electron/index.js "$@"
|
||||||
else
|
else
|
||||||
cd $ROOT ; \
|
cd $ROOT ; \
|
||||||
ELECTRON_ENABLE_LOGGING=1 \
|
ELECTRON_ENABLE_LOGGING=1 \
|
||||||
"$CODE" \
|
"$CODE" \
|
||||||
test/electron/index.js --no-sandbox "$@" # Electron 6 introduces a chrome-sandbox that requires root to run. This can fail. Disable sandbox via --no-sandbox.
|
test/unit/electron/index.js --no-sandbox "$@" # Electron 6 introduces a chrome-sandbox that requires root to run. This can fail. Disable sandbox via --no-sandbox.
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -57,7 +57,7 @@ const withReporter = (function () {
|
||||||
})()
|
})()
|
||||||
|
|
||||||
const outdir = argv.build ? 'out-build' : 'out';
|
const outdir = argv.build ? 'out-build' : 'out';
|
||||||
const out = path.join(__dirname, `../../${outdir}`);
|
const out = path.join(__dirname, `../../../${outdir}`);
|
||||||
|
|
||||||
const testModules = (async function () {
|
const testModules = (async function () {
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>VSCode Tests</title>
|
<title>VSCode Tests</title>
|
||||||
<link href="../../node_modules/mocha/mocha.css" rel="stylesheet" />
|
<link href="../../../node_modules/mocha/mocha.css" rel="stylesheet" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="mocha"></div>
|
<div id="mocha"></div>
|
||||||
<script src="../../node_modules/mocha/mocha.js"></script>
|
<script src="../../../node_modules/mocha/mocha.js"></script>
|
||||||
<script>
|
<script>
|
||||||
// !!! DO NOT CHANGE !!!
|
// !!! DO NOT CHANGE !!!
|
||||||
// Our unit tests may run in environments without
|
// Our unit tests may run in environments without
|
||||||
|
@ -37,17 +37,17 @@
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="../../out/vs/loader.js"></script>
|
<script src="../../../out/vs/loader.js"></script>
|
||||||
<script>
|
<script>
|
||||||
// configure loader
|
// configure loader
|
||||||
const baseUrl = window.location.href;
|
const baseUrl = window.location.href;
|
||||||
require.config({
|
require.config({
|
||||||
catchError: true,
|
catchError: true,
|
||||||
baseUrl: new URL('../../src', baseUrl).href,
|
baseUrl: new URL('../../../src', baseUrl).href,
|
||||||
paths: {
|
paths: {
|
||||||
'vs': new URL('../../out/vs', baseUrl).href,
|
'vs': new URL('../../../out/vs', baseUrl).href,
|
||||||
assert: new URL('../assert.js', baseUrl).href,
|
assert: new URL('../../assert.js', baseUrl).href,
|
||||||
sinon: new URL('../../node_modules/sinon/pkg/sinon-1.17.7.js', baseUrl).href
|
sinon: new URL('../../../node_modules/sinon/pkg/sinon-1.17.7.js', baseUrl).href
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -102,7 +102,7 @@
|
||||||
runner.on('pending', test => window.mocha_report('pending', serializeRunnable(test)));
|
runner.on('pending', test => window.mocha_report('pending', serializeRunnable(test)));
|
||||||
};
|
};
|
||||||
|
|
||||||
window.loadAndRun = async function loadAndRun (modules, manual = false) {
|
window.loadAndRun = async function loadAndRun(modules, manual = false) {
|
||||||
// load
|
// load
|
||||||
// await Promise.all(modules.map(module => new Promise((resolve, reject) =>{
|
// await Promise.all(modules.map(module => new Promise((resolve, reject) =>{
|
||||||
// require([module], resolve, err => {
|
// require([module], resolve, err => {
|
||||||
|
@ -120,7 +120,7 @@
|
||||||
|
|
||||||
// run
|
// run
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if(!manual) {
|
if (!manual) {
|
||||||
mocha.reporter(PlaywrightReporter);
|
mocha.reporter(PlaywrightReporter);
|
||||||
}
|
}
|
||||||
mocha.run(failCount => resolve(failCount === 0));
|
mocha.run(failCount => resolve(failCount === 0));
|
||||||
|
@ -129,7 +129,7 @@
|
||||||
|
|
||||||
|
|
||||||
const modules = new URL(window.location.href).searchParams.getAll('m');
|
const modules = new URL(window.location.href).searchParams.getAll('m');
|
||||||
if(Array.isArray(modules) && modules.length > 0){
|
if (Array.isArray(modules) && modules.length > 0) {
|
||||||
console.log('MANUALLY running tests', modules);
|
console.log('MANUALLY running tests', modules);
|
||||||
|
|
||||||
loadAndRun(modules, true).then(() => console.log('done'), err => console.log(err));
|
loadAndRun(modules, true).then(() => console.log('done'), err => console.log(err));
|
|
@ -3,12 +3,12 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>VSCode Tests</title>
|
<title>VSCode Tests</title>
|
||||||
<link href="../../node_modules/mocha/mocha.css" rel="stylesheet" />
|
<link href="../../../node_modules/mocha/mocha.css" rel="stylesheet" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="mocha"></div>
|
<div id="mocha"></div>
|
||||||
<script src="../../node_modules/mocha/mocha.js"></script>
|
<script src="../../../node_modules/mocha/mocha.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -10,8 +10,8 @@ const assert = require('assert');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const glob = require('glob');
|
const glob = require('glob');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const bootstrap = require('../../src/bootstrap');
|
const bootstrap = require('../../../src/bootstrap');
|
||||||
const coverage = require('../coverage');
|
const coverage = require('../../coverage');
|
||||||
|
|
||||||
// Disabled custom inspect. See #38847
|
// Disabled custom inspect. See #38847
|
||||||
if (util.inspect && util.inspect['defaultOptions']) {
|
if (util.inspect && util.inspect['defaultOptions']) {
|
||||||
|
@ -24,7 +24,7 @@ let _out;
|
||||||
|
|
||||||
function initLoader(opts) {
|
function initLoader(opts) {
|
||||||
let outdir = opts.build ? 'out-build' : 'out';
|
let outdir = opts.build ? 'out-build' : 'out';
|
||||||
_out = path.join(__dirname, `../../${outdir}`);
|
_out = path.join(__dirname, `../../../${outdir}`);
|
||||||
|
|
||||||
// setup loader
|
// setup loader
|
||||||
loader = require(`${_out}/vs/loader`);
|
loader = require(`${_out}/vs/loader`);
|
||||||
|
@ -32,7 +32,7 @@ function initLoader(opts) {
|
||||||
nodeRequire: require,
|
nodeRequire: require,
|
||||||
nodeMain: __filename,
|
nodeMain: __filename,
|
||||||
catchError: true,
|
catchError: true,
|
||||||
baseUrl: bootstrap.uriFromPath(path.join(__dirname, '../../src')),
|
baseUrl: bootstrap.uriFromPath(path.join(__dirname, '../../../src')),
|
||||||
paths: {
|
paths: {
|
||||||
'vs': `../${outdir}/vs`,
|
'vs': `../${outdir}/vs`,
|
||||||
'lib': `../${outdir}/lib`,
|
'lib': `../${outdir}/lib`,
|
Loading…
Reference in a new issue