File tree Expand file tree Collapse file tree 3 files changed +53
-5
lines changed Expand file tree Collapse file tree 3 files changed +53
-5
lines changed Original file line number Diff line number Diff line change
1
+ import * as assert from 'assert' ;
2
+
3
+ // You can import and use all API from the 'vscode' module
4
+ // as well as import your extension to test it
5
+ import * as vscode from 'vscode' ;
6
+ // import * as haskell from '../../extension';
7
+
8
+ function getExtension ( extId : string ) {
9
+ return vscode . extensions . getExtension ( extId ) ;
10
+ }
11
+
12
+ suite ( 'Extension Test Suite' , ( ) => {
13
+ vscode . window . showInformationMessage ( 'Start all tests.' ) ;
14
+
15
+ test ( 'Extension should be present' , ( ) => {
16
+ assert . ok ( getExtension ( 'haskell.haskell' ) ) ;
17
+ } ) ;
18
+
19
+ test ( 'should activate' , ( ) => {
20
+ getExtension ( 'justusadam.language-haskell' )
21
+ ?. activate ( )
22
+ . then ( ( ) => {
23
+ getExtension ( 'haskell.haskell' )
24
+ ?. activate ( )
25
+ . then ( ( ) => {
26
+ assert . ok ( true ) ;
27
+ } ) ;
28
+ } ) ;
29
+ } ) ;
30
+ } ) ;
Original file line number Diff line number Diff line change
1
+ import * as cp from 'child_process' ;
1
2
import * as path from 'path' ;
2
3
3
- import { runTests } from '@vscode/test-electron' ;
4
+ import { downloadAndUnzipVSCode , resolveCliPathFromVSCodeExecutablePath , runTests } from '@vscode/test-electron' ;
5
+
6
+ function installExtension ( vscodeExePath : string , extId : string ) {
7
+ const cliPath = resolveCliPathFromVSCodeExecutablePath ( vscodeExePath ) ;
8
+ cp . spawnSync ( cliPath , [ '--install-extension' , extId ] , {
9
+ encoding : 'utf-8' ,
10
+ stdio : 'inherit' ,
11
+ } ) ;
12
+ }
4
13
5
14
async function main ( ) {
6
15
try {
16
+ const vscodeExecutablePath = await downloadAndUnzipVSCode ( 'stable' ) ;
17
+
18
+ // We have to install this dependant extension
19
+ installExtension ( vscodeExecutablePath , 'justusadam.language-haskell' ) ;
20
+
7
21
// The folder containing the Extension Manifest package.json
8
22
// Passed to `--extensionDevelopmentPath`
9
23
const extensionDevelopmentPath = path . resolve ( __dirname , '../../' ) ;
@@ -14,8 +28,12 @@ async function main() {
14
28
15
29
// Download VS Code, unzip it and run the integration test
16
30
await runTests ( {
31
+ vscodeExecutablePath,
17
32
extensionDevelopmentPath,
18
33
extensionTestsPath,
34
+ launchArgs : [
35
+ // '--disable-extensions'
36
+ ] ,
19
37
} ) ;
20
38
} catch ( err ) {
21
39
console . error ( err ) ;
Original file line number Diff line number Diff line change @@ -5,19 +5,19 @@ import * as assert from 'assert';
5
5
import * as vscode from 'vscode' ;
6
6
// import * as haskell from '../../extension';
7
7
8
- function getExtension ( ) {
9
- return vscode . extensions . getExtension ( 'haskell.haskell' ) ;
8
+ function getExtension ( extId : string ) {
9
+ return vscode . extensions . getExtension ( extId ) ;
10
10
}
11
11
12
12
suite ( 'Extension Test Suite' , ( ) => {
13
13
vscode . window . showInformationMessage ( 'Start all tests.' ) ;
14
14
15
15
test ( 'Extension should be present' , ( ) => {
16
- assert . ok ( getExtension ( ) ) ;
16
+ assert . ok ( getExtension ( 'haskell.haskell' ) ) ;
17
17
} ) ;
18
18
19
19
test ( 'should activate' , ( ) => {
20
- return getExtension ( )
20
+ return getExtension ( 'haskell.haskell' )
21
21
?. activate ( )
22
22
. then ( ( ) => {
23
23
assert . ok ( true ) ;
You can’t perform that action at this time.
0 commit comments