mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 21:39:43 +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",
|
||||
"request": "launch",
|
||||
"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",
|
||||
"windows": {
|
||||
"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
|
||||
set ELECTRON_ENABLE_LOGGING=1
|
||||
%CODE% .\test\electron\index.js %*
|
||||
%CODE% .\test\unit\electron\index.js %*
|
||||
|
||||
popd
|
||||
|
||||
|
|
|
@ -29,10 +29,10 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
|
|||
cd $ROOT ; ulimit -n 4096 ; \
|
||||
ELECTRON_ENABLE_LOGGING=1 \
|
||||
"$CODE" \
|
||||
test/electron/index.js "$@"
|
||||
test/unit/electron/index.js "$@"
|
||||
else
|
||||
cd $ROOT ; \
|
||||
ELECTRON_ENABLE_LOGGING=1 \
|
||||
"$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
|
||||
|
|
|
@ -57,7 +57,7 @@ const withReporter = (function () {
|
|||
})()
|
||||
|
||||
const outdir = argv.build ? 'out-build' : 'out';
|
||||
const out = path.join(__dirname, `../../${outdir}`);
|
||||
const out = path.join(__dirname, `../../../${outdir}`);
|
||||
|
||||
const testModules = (async function () {
|
||||
|
|
@ -3,12 +3,12 @@
|
|||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>VSCode Tests</title>
|
||||
<link href="../../node_modules/mocha/mocha.css" rel="stylesheet" />
|
||||
<link href="../../../node_modules/mocha/mocha.css" rel="stylesheet" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="mocha"></div>
|
||||
<script src="../../node_modules/mocha/mocha.js"></script>
|
||||
<script src="../../../node_modules/mocha/mocha.js"></script>
|
||||
<script>
|
||||
// !!! DO NOT CHANGE !!!
|
||||
// Our unit tests may run in environments without
|
||||
|
@ -37,17 +37,17 @@
|
|||
});
|
||||
</script>
|
||||
|
||||
<script src="../../out/vs/loader.js"></script>
|
||||
<script src="../../../out/vs/loader.js"></script>
|
||||
<script>
|
||||
// configure loader
|
||||
const baseUrl = window.location.href;
|
||||
require.config({
|
||||
catchError: true,
|
||||
baseUrl: new URL('../../src', baseUrl).href,
|
||||
baseUrl: new URL('../../../src', baseUrl).href,
|
||||
paths: {
|
||||
'vs': new URL('../../out/vs', baseUrl).href,
|
||||
assert: new URL('../assert.js', baseUrl).href,
|
||||
sinon: new URL('../../node_modules/sinon/pkg/sinon-1.17.7.js', baseUrl).href
|
||||
'vs': new URL('../../../out/vs', baseUrl).href,
|
||||
assert: new URL('../../assert.js', baseUrl).href,
|
||||
sinon: new URL('../../../node_modules/sinon/pkg/sinon-1.17.7.js', baseUrl).href
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
@ -102,7 +102,7 @@
|
|||
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
|
||||
// await Promise.all(modules.map(module => new Promise((resolve, reject) =>{
|
||||
// require([module], resolve, err => {
|
||||
|
@ -120,7 +120,7 @@
|
|||
|
||||
// run
|
||||
return new Promise((resolve, reject) => {
|
||||
if(!manual) {
|
||||
if (!manual) {
|
||||
mocha.reporter(PlaywrightReporter);
|
||||
}
|
||||
mocha.run(failCount => resolve(failCount === 0));
|
||||
|
@ -129,7 +129,7 @@
|
|||
|
||||
|
||||
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);
|
||||
|
||||
loadAndRun(modules, true).then(() => console.log('done'), err => console.log(err));
|
|
@ -3,12 +3,12 @@
|
|||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>VSCode Tests</title>
|
||||
<link href="../../node_modules/mocha/mocha.css" rel="stylesheet" />
|
||||
<link href="../../../node_modules/mocha/mocha.css" rel="stylesheet" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="mocha"></div>
|
||||
<script src="../../node_modules/mocha/mocha.js"></script>
|
||||
<script src="../../../node_modules/mocha/mocha.js"></script>
|
||||
|
||||
<script>
|
||||
|
|
@ -10,8 +10,8 @@ const assert = require('assert');
|
|||
const path = require('path');
|
||||
const glob = require('glob');
|
||||
const util = require('util');
|
||||
const bootstrap = require('../../src/bootstrap');
|
||||
const coverage = require('../coverage');
|
||||
const bootstrap = require('../../../src/bootstrap');
|
||||
const coverage = require('../../coverage');
|
||||
|
||||
// Disabled custom inspect. See #38847
|
||||
if (util.inspect && util.inspect['defaultOptions']) {
|
||||
|
@ -24,7 +24,7 @@ let _out;
|
|||
|
||||
function initLoader(opts) {
|
||||
let outdir = opts.build ? 'out-build' : 'out';
|
||||
_out = path.join(__dirname, `../../${outdir}`);
|
||||
_out = path.join(__dirname, `../../../${outdir}`);
|
||||
|
||||
// setup loader
|
||||
loader = require(`${_out}/vs/loader`);
|
||||
|
@ -32,7 +32,7 @@ function initLoader(opts) {
|
|||
nodeRequire: require,
|
||||
nodeMain: __filename,
|
||||
catchError: true,
|
||||
baseUrl: bootstrap.uriFromPath(path.join(__dirname, '../../src')),
|
||||
baseUrl: bootstrap.uriFromPath(path.join(__dirname, '../../../src')),
|
||||
paths: {
|
||||
'vs': `../${outdir}/vs`,
|
||||
'lib': `../${outdir}/lib`,
|
Loading…
Reference in a new issue