File tree Expand file tree Collapse file tree 4 files changed +31
-8
lines changed Expand file tree Collapse file tree 4 files changed +31
-8
lines changed Original file line number Diff line number Diff line change 1
1
import * as vscode from 'vscode' ;
2
+
2
3
import { APP_COMPONENT } from '../test_constants' ;
3
- import { activate } from './helper' ;
4
4
5
- const DEFINITION_COMMAND = 'vscode.executeDefinitionProvider' ;
6
- const APP_COMPONENT_URI = vscode . Uri . file ( APP_COMPONENT ) ;
5
+ import { activate , APP_COMPONENT_URI , DEFINITION_COMMAND } from './helper' ;
7
6
8
7
describe ( 'Angular Ivy LS' , ( ) => {
9
8
beforeAll ( async ( ) => {
10
9
await activate ( APP_COMPONENT_URI ) ;
11
- } , 25000 /* 25 seconds */ ) ;
10
+ } ) ;
12
11
13
12
it ( `returns definition for variable in template` , async ( ) => {
14
13
// vscode Position is zero-based
Original file line number Diff line number Diff line change 1
1
import * as vscode from 'vscode' ;
2
+ import { APP_COMPONENT } from '../test_constants' ;
3
+
4
+ export const DEFINITION_COMMAND = 'vscode.executeDefinitionProvider' ;
5
+ export const APP_COMPONENT_URI = vscode . Uri . file ( APP_COMPONENT ) ;
2
6
3
7
function sleep ( ms : number ) {
4
8
return new Promise ( resolve => setTimeout ( resolve , ms ) ) ;
5
9
}
6
10
7
- export async function activate ( uri : vscode . Uri ) {
11
+ export async function activate ( uri : vscode . Uri , timeoutSeconds = 20 ) {
12
+ await waitForAngularDefinitions ( timeoutSeconds ) ;
8
13
await vscode . window . showTextDocument ( uri ) ;
9
- await sleep ( 20 * 1000 ) ; // Wait for server activation, including ngcc run
14
+ }
15
+
16
+ async function waitForAngularDefinitions ( timeoutSeconds : number ) {
17
+ await vscode . window . showTextDocument ( APP_COMPONENT_URI ) ;
18
+ // template: `<h1>Hello {{name}}</h1>`,
19
+ // ^-------- here
20
+ const position = new vscode . Position ( 4 , 25 ) ;
21
+ let tries = 0 ;
22
+ let definitions : vscode . LocationLink [ ] | undefined ;
23
+ while ( ( definitions ?. length ?? 0 ) < 1 && tries < timeoutSeconds ) {
24
+ definitions = await vscode . commands . executeCommand < vscode . LocationLink [ ] > (
25
+ DEFINITION_COMMAND , APP_COMPONENT_URI , position ) ;
26
+ await sleep ( 1000 ) ;
27
+ tries ++ ;
28
+ }
29
+ if ( definitions === undefined || definitions . length === 0 ) {
30
+ fail ( 'Waiting for Angular definitions to be available timed out.' ) ;
31
+ }
10
32
}
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ async function main() {
9
9
try {
10
10
await runTests ( {
11
11
// Keep version in sync with vscode engine version in package.json
12
- version : '1.56.0 ' ,
12
+ version : '1.56.2 ' ,
13
13
extensionDevelopmentPath : EXT_DEVELOPMENT_PATH ,
14
14
extensionTestsPath : EXT_TESTS_PATH ,
15
15
launchArgs : [
Original file line number Diff line number Diff line change @@ -4,12 +4,14 @@ export async function run(): Promise<void> {
4
4
const jasmine = new Jasmine ( { } ) ;
5
5
6
6
jasmine . loadConfig ( {
7
- spec_dir : 'dist/integration/e2e' ,
7
+ spec_dir : __dirname ,
8
8
spec_files : [
9
9
'*_spec.js' ,
10
10
] ,
11
11
} ) ;
12
12
13
+ console . log ( `Expecting to run ${ jasmine . specFiles . length } specs.` ) ;
14
+
13
15
if ( jasmine . specFiles . length === 0 ) {
14
16
throw new Error ( 'No specs found' ) ;
15
17
}
You can’t perform that action at this time.
0 commit comments