From 60a3d4411af2625441a3e84069041ca64dfbae7d Mon Sep 17 00:00:00 2001 From: Peter Bomber Date: Thu, 2 Nov 2023 16:40:35 +1300 Subject: [PATCH] improve test error logging --- src/tests/runTests.ts | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/tests/runTests.ts b/src/tests/runTests.ts index 0976f6724..b50d51b04 100644 --- a/src/tests/runTests.ts +++ b/src/tests/runTests.ts @@ -1,22 +1,26 @@ import * as path from 'path'; import { runTests } from '@vscode/test-electron'; - async function main() { - try { - // The folder containing the Extension Manifest package.json - // Passed to `--extensionDevelopmentPath` - const extensionDevelopmentPath = path.resolve(__dirname, '../../'); +async function main() { + try { + // The folder containing the Extension Manifest package.json + // Passed to `--extensionDevelopmentPath` + const extensionDevelopmentPath = path.resolve(__dirname, '../../'); - // The path to test runner - // Passed to --extensionTestsPath - const extensionTestsPath = path.resolve(__dirname, './suite/index'); + // The path to test runner + // Passed to --extensionTestsPath + const extensionTestsPath = path.resolve(__dirname, './suite/index'); - // Download VS Code, unzip it and run the integration test - await runTests({ extensionDevelopmentPath, extensionTestsPath }); - } catch (err) { - console.error('Failed to run tests'); - process.exit(1); - } - } + // Download VS Code, unzip it and run the integration test + await runTests({ extensionDevelopmentPath, extensionTestsPath }); + } catch (err) { + console.error(`Failed to run tests:\n${err}`); + console.log(`message: ${(err as any)?.message}`); + console.log(`name: ${(err as any)?.name}`); + console.log(`stack: ${(err as any)?.stack}`); + console.log(`cause: ${(err as any)?.cause}`); + process.exit(1); + } +} - main(); \ No newline at end of file +main(); \ No newline at end of file