-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy path.vscode-test.mjs
More file actions
77 lines (69 loc) · 2.42 KB
/
.vscode-test.mjs
File metadata and controls
77 lines (69 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//@ts-check
import fs from 'fs';
import { defineConfig } from '@vscode/test-cli';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
/**
* @param {string} label
* @param {Record<string, string | undefined>} env
*/
function generateConfig(label, env) {
const workspaceFolder = join(__dirname, 'src', 'test', 'datascience');
/** @type {import('@vscode/test-cli').TestConfiguration} */
let config = {
label,
files: ['out/**/*.vscode.test.js', 'out/**/*.vscode.common.test.js'],
version: 'insiders',
srcDir: 'src',
workspaceFolder,
launchArgs: [workspaceFolder, '--enable-proposed-api'],
env,
installExtensions: [
'ms-toolsai.jupyter-renderers',
'ms-python.vscode-python-envs',
'ms-python.python',
'ms-python.vscode-pylance@prerelease'
],
mocha: {
ui: 'tdd',
color: true,
timeout: 25000,
preload: [
`${__dirname}/out/platform/ioc/reflectMetadata.js`,
`${__dirname}/out/test/common.test.require.js`
]
}
};
return config;
}
function generateBasedEnvVariables() {
const venvFolder = `${__dirname}/.venv`;
const pythonPath = fs.existsSync(venvFolder)
? process.platform === 'win32'
? `${venvFolder}/Scripts/python.exe`
: `${venvFolder}/bin/python`
: '';
return {
CI_PYTHON_PATH: pythonPath,
// VSC_JUPYTER_FORCE_LOGGING: '1',
// VSC_JUPYTER_REMOTE_NATIVE_TEST: 'true',
// VSC_JUPYTER_NON_RAW_NATIVE_TEST: 'false',
// VSC_JUPYTER_CI_TEST_GREP: '@widgets',
XVSC_JUPYTER_INSTRUMENT_CODE_FOR_COVERAGE: '1',
XVSC_JUPYTER_INSTRUMENT_CODE_FOR_COVERAGE_HTML: '1', //Enable to get full coverage repor (in coverage folder).
VSC_JUPYTER_EXPOSE_SVC: '1'
};
}
function generateLocalTestConfig() {
return generateConfig('Local Tests', generateBasedEnvVariables());
}
function generateRemoteTestConfig() {
const env = Object.assign(generateBasedEnvVariables(), {
VSC_JUPYTER_REMOTE_NATIVE_TEST: 'true',
VSC_JUPYTER_NON_RAW_NATIVE_TEST: 'false'
});
return generateConfig('Remote Tests', env);
}
export default defineConfig([generateLocalTestConfig(), generateRemoteTestConfig()]);