|
2 | 2 | /* eslint-disable @typescript-eslint/no-unsafe-assignment */ |
3 | 3 | /* eslint-disable @typescript-eslint/no-unsafe-call */ |
4 | 4 | /* eslint-disable @typescript-eslint/await-thenable */ |
| 5 | +import fs = require('fs'); |
| 6 | +import os = require('os'); |
| 7 | +import path = require('path'); |
5 | 8 | import { expect } from 'chai'; |
6 | 9 | import { |
7 | 10 | ActivityBar, |
@@ -37,12 +40,29 @@ function execShellCommand(cmd) { |
37 | 40 | export function extensionsUITest(clusterIsAvailable: boolean): void { |
38 | 41 | let driver: WebDriver; |
39 | 42 | let kubectlExists: boolean; |
| 43 | + const homeDir = os.homedir(); |
| 44 | + const vskn = path.join(homeDir, '.vs-kn'); |
| 45 | + const vsfunc = path.join(homeDir, '.vs-func'); |
| 46 | + const vskubectl = path.join(homeDir, '.vs-kubectl'); |
40 | 47 |
|
41 | 48 | before(async () => { |
42 | 49 | driver = VSBrowser.instance.driver; |
43 | 50 | // check existence of kubectl on the path or in the home folder |
44 | 51 | const kubectl = await execShellCommand('kubectl version --output json'); |
45 | 52 | kubectlExists = !(kubectl as string).includes('kubectl: command not found'); |
| 53 | + if (fs.existsSync(vsfunc)) { |
| 54 | + console.log(`.vs-func does exist - removing`); |
| 55 | + fs.rmSync(vsfunc, { recursive: true, force: true }); |
| 56 | + } |
| 57 | + if (fs.existsSync(vskn)) { |
| 58 | + console.log(`.vs-kn does exist - removing`); |
| 59 | + fs.rmSync(vskn, { recursive: true, force: true }); |
| 60 | + } |
| 61 | + if (fs.existsSync(vskubectl)) { |
| 62 | + console.log(`.vs-kubectl does exist - removing`); |
| 63 | + fs.rmSync(vskubectl, { recursive: true, force: true }); |
| 64 | + } |
| 65 | + console.log(`kubectl is on path: ${kubectlExists === true ? 'true' : 'false'}`); |
46 | 66 | }); |
47 | 67 |
|
48 | 68 | describe('Knative extension UI', () => { |
|
0 commit comments