-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'topic/mocha-tests' into 'master'
Migrate vscode testing to a newer framework See merge request eng/ide/ada_language_server!1516
- Loading branch information
Showing
19 changed files
with
111 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import { defineConfig } from '@vscode/test-cli'; | ||
import { mkdtempSync } from 'fs'; | ||
import * as os from 'os'; | ||
import { join } from 'path'; | ||
|
||
let baseMochaOptions = { | ||
ui: 'tdd', | ||
color: true, | ||
}; | ||
|
||
if (process.env.MOCHA_REPORTER) { | ||
// If a reporter was specified externally, use it. For example, the CI | ||
// environment could set this to 'mocha-junit-reporter' to produce JUnit | ||
// results. | ||
baseMochaOptions.reporter = process.env.MOCHA_REPORTER; | ||
} | ||
|
||
if (!baseMochaOptions.reporterOptions) { | ||
baseMochaOptions.reporterOptions = { | ||
maxDiffSize: 0, | ||
}; | ||
} | ||
|
||
if (process.env['MOCHA_TIMEOUT']) { | ||
baseMochaOptions.timeout = process.env['MOCHA_TIMEOUT']; | ||
} else { | ||
/** | ||
* Some tests involve calling gprbuild which takes time. So we disable test | ||
* timeouts altogether. | ||
*/ | ||
baseMochaOptions.timeout = '0'; | ||
} | ||
|
||
if (process.env['MOCHA_GREP']) { | ||
baseMochaOptions.grep = process.env['MOCHA_GREP']; | ||
} | ||
|
||
const testsuites = ['general', 'gnattest', 'workspace_missing_dirs']; | ||
|
||
export default defineConfig( | ||
testsuites.map((suiteName) => { | ||
// --user-data-dir is set to a unique directory under the OS | ||
// default tmp directory for temporary files to avoid | ||
// warnings related to longs paths in IPC sockets created by | ||
// VSCode. The directory is made unique to avoid | ||
// interference between successive runs. | ||
// | ||
// It also allows multiple testsuites to run concurrently with each VS | ||
// Code instance using a different User data directory. This can happen | ||
// when tests are launched from the VS Code UI. | ||
const tmpdir = mkdtempSync(`${os.tmpdir()}/vsc-ada-test-`); | ||
|
||
// Create a mocha options objects by copying the base one | ||
let mochaOptions = { ...baseMochaOptions }; | ||
|
||
if (process.env.MOCHA_REPORTER) { | ||
/** | ||
* Produce results for each testsuite separately | ||
*/ | ||
const mochaFile = process.env.MOCHA_RESULTS_DIR | ||
? join(process.env.MOCHA_RESULTS_DIR, `${suiteName}.xml`) | ||
: `${suiteName}.xml`; | ||
mochaOptions.reporterOptions = { mochaFile: mochaFile }; | ||
} | ||
|
||
return { | ||
label: `Ada extension testsuite: ${suiteName}`, | ||
files: `out/test/suite/${suiteName}/**/*.test.js`, | ||
workspaceFolder: `./test/workspaces/${suiteName}`, | ||
mocha: mochaOptions, | ||
env: { | ||
// When working remotely on Linux, it is necessary to have "Xvfb | ||
// :99" running in the background, and this env variable set for | ||
// the VS Code instances spawned for testing. | ||
// | ||
// This may prevent running locally on Linux and having the test | ||
// windows visible, but we consider this a minor use case for | ||
// now. A workaround is to remove this line. | ||
DISPLAY: ':99', | ||
}, | ||
launchArgs: ['--user-data-dir', tmpdir], | ||
// Use external installation if provided in the VSCODE env variable | ||
useInstallation: process.env.VSCODE ? { fromPath: process.env.VSCODE } : undefined, | ||
}; | ||
}) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
integration/vscode/ada/test/suite/workspace_missing_dirs/index.ts
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
integration/vscode/ada/test/suite/workspace_missing_dirs/workspace_missing_dirs.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters