@@ -16,11 +16,12 @@ import {
1616} from 'vscode-test-adapter-api' ;
1717import { TestAdapterRegistrar } from 'vscode-test-adapter-util' ;
1818import { QLTestFile , QLTestNode , QLTestDirectory , QLTestDiscovery } from './qltest-discovery' ;
19- import { Event , EventEmitter , window , Diagnostic , Uri , Range , DiagnosticSeverity , OutputChannel , CancellationToken , workspace , Disposable , CancellationTokenSource } from 'vscode' ;
19+ import { Event , EventEmitter , window , Diagnostic , Uri , Range , DiagnosticSeverity , OutputChannel , CancellationToken , workspace , Disposable , CancellationTokenSource , commands } from 'vscode' ;
2020import { DisposableObject } from 'semmle-vscode-utils' ;
21- import { QLTestOptions , QLTestHandler , QLOptions , qlTest } from './odasa' ;
21+ import { QLTestOptions , QLTestHandler , QLOptions , qlTest , isOdasaAvailable } from './odasa' ;
2222import { QLPackDiscovery } from './qlpack-discovery' ;
2323import { CodeQLCliServer } from './cli' ;
24+ import { showAndLogErrorMessage } from './helpers' ;
2425
2526/**
2627 * Get the full path of the `.expected` file for the specified QL test.
@@ -324,6 +325,19 @@ export class QLTestAdapter extends DisposableObject implements TestAdapter {
324325 }
325326
326327 try {
328+ if ( ! await isOdasaAvailable ( qlOptions ) ) {
329+ const action = showAndLogErrorMessage ( "'codeQL.tests.odasaDistributionPath' does not " +
330+ "point to a distribution of Semmle Core. Semmle Core is required in order to run " +
331+ "CodeQL tests. This requirement will be removed as soon as the CodeQL CLI supports " +
332+ "running tests." ,
333+ 'Edit Settings' ) ;
334+ action . then ( response => {
335+ if ( response !== undefined ) {
336+ commands . executeCommand ( 'workbench.action.openSettings2' ) ;
337+ }
338+ } ) ;
339+ // Attempt to invoke `odasa` anyway, just to get a more precise error in the log.
340+ }
327341 await qlTest ( qlOptions , qlTestOptions , handler ) ;
328342 }
329343 finally {
0 commit comments