From 8ee40ccbe963a0a5e3e998c1652378e1035dc40d Mon Sep 17 00:00:00 2001 From: vsrs Date: Wed, 20 May 2020 21:03:49 +0300 Subject: vscode client side tests --- editors/code/tests/runTests.ts | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 editors/code/tests/runTests.ts (limited to 'editors/code/tests/runTests.ts') diff --git a/editors/code/tests/runTests.ts b/editors/code/tests/runTests.ts new file mode 100644 index 000000000..81600f6a8 --- /dev/null +++ b/editors/code/tests/runTests.ts @@ -0,0 +1,46 @@ +import * as path from 'path'; +import * as fs from 'fs'; + +import { runTests } from 'vscode-test'; + +async function main() { + try { + // The folder containing the Extension Manifest package.json + // Passed to `--extensionDevelopmentPath` + const extensionDevelopmentPath = path.resolve(__dirname, '../../'); + + // Minimum supported version. + const jsonData = fs.readFileSync(path.join(extensionDevelopmentPath, 'package.json')); + const json = JSON.parse(jsonData.toString()); + let minimalVersion: string = json.engines.vscode; + if (minimalVersion.startsWith('^')) minimalVersion = minimalVersion.slice(1); + + const launchArgs = ["--disable-extensions"]; + + // All test suites (either unit tests or integration tests) should be in subfolders. + const extensionTestsPath = path.resolve(__dirname, './unit/index'); + + // Run tests using the minimal supported version. + await runTests({ + version: minimalVersion, + launchArgs, + extensionDevelopmentPath, + extensionTestsPath + }); + + // and the latest one + await runTests({ + version: 'stable', + launchArgs, + extensionDevelopmentPath, + extensionTestsPath + }); + + } catch (err) { + // eslint-disable-next-line no-console + console.error('Failed to run tests', err); + process.exit(1); + } +} + +main(); -- cgit v1.2.3 From c41a10c29331127ee830badddae55f3e27c9a6ea Mon Sep 17 00:00:00 2001 From: vsrs Date: Thu, 21 May 2020 11:34:34 +0300 Subject: Apply suggestions from @Veetaha code review --- editors/code/tests/runTests.ts | 73 ++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 38 deletions(-) (limited to 'editors/code/tests/runTests.ts') diff --git a/editors/code/tests/runTests.ts b/editors/code/tests/runTests.ts index 81600f6a8..22df80ad3 100644 --- a/editors/code/tests/runTests.ts +++ b/editors/code/tests/runTests.ts @@ -4,43 +4,40 @@ import * as fs from 'fs'; import { runTests } from 'vscode-test'; async function main() { - try { - // The folder containing the Extension Manifest package.json - // Passed to `--extensionDevelopmentPath` - const extensionDevelopmentPath = path.resolve(__dirname, '../../'); - - // Minimum supported version. - const jsonData = fs.readFileSync(path.join(extensionDevelopmentPath, 'package.json')); - const json = JSON.parse(jsonData.toString()); - let minimalVersion: string = json.engines.vscode; - if (minimalVersion.startsWith('^')) minimalVersion = minimalVersion.slice(1); - - const launchArgs = ["--disable-extensions"]; - - // All test suites (either unit tests or integration tests) should be in subfolders. - const extensionTestsPath = path.resolve(__dirname, './unit/index'); - - // Run tests using the minimal supported version. - await runTests({ - version: minimalVersion, - launchArgs, - extensionDevelopmentPath, - extensionTestsPath - }); - - // and the latest one - await runTests({ - version: 'stable', - launchArgs, - extensionDevelopmentPath, - extensionTestsPath - }); - - } catch (err) { - // eslint-disable-next-line no-console - console.error('Failed to run tests', err); - process.exit(1); - } + // The folder containing the Extension Manifest package.json + // Passed to `--extensionDevelopmentPath` + const extensionDevelopmentPath = path.resolve(__dirname, '../../'); + + // Minimum supported version. + const jsonData = fs.readFileSync(path.join(extensionDevelopmentPath, 'package.json')); + const json = JSON.parse(jsonData.toString()); + let minimalVersion: string = json.engines.vscode; + if (minimalVersion.startsWith('^')) minimalVersion = minimalVersion.slice(1); + + const launchArgs = ["--disable-extensions"]; + + // All test suites (either unit tests or integration tests) should be in subfolders. + const extensionTestsPath = path.resolve(__dirname, './unit/index'); + + // Run tests using the minimal supported version. + await runTests({ + version: minimalVersion, + launchArgs, + extensionDevelopmentPath, + extensionTestsPath + }); + + // and the latest one + await runTests({ + version: 'stable', + launchArgs, + extensionDevelopmentPath, + extensionTestsPath + }); } -main(); +main().catch(err => { + // eslint-disable-next-line no-console + console.error('Failed to run tests', err); + process.exit(1); +}); -- cgit v1.2.3