diff options
author | Aleksey Kladov <[email protected]> | 2019-12-30 10:49:04 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-12-30 10:49:04 +0000 |
commit | 0c371d2128a7efc8a82d905a97a7f7501098c441 (patch) | |
tree | baf1b4d8c81150ed494e89d0c49cdc7c7b41efd4 /editors/code/src | |
parent | be37c3369b4a2203ace1d65d65bf6ddb5c7faa45 (diff) | |
parent | 1f8719ee876ab6fb8b29cdf018815b03e000f197 (diff) |
Merge pull request #2684 from matklad/refactor-frontend
Refactor frontend
Diffstat (limited to 'editors/code/src')
-rw-r--r-- | editors/code/src/server.ts | 12 | ||||
-rw-r--r-- | editors/code/src/test/runTest.ts | 22 | ||||
-rw-r--r-- | editors/code/src/test/utils/index.ts | 49 |
3 files changed, 1 insertions, 82 deletions
diff --git a/editors/code/src/server.ts b/editors/code/src/server.ts index ae81af848..e1ad0520b 100644 --- a/editors/code/src/server.ts +++ b/editors/code/src/server.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { lookpath } from 'lookpath'; | 1 | import { homedir } from 'os'; |
2 | import { homedir, platform } from 'os'; | ||
3 | import * as lc from 'vscode-languageclient'; | 2 | import * as lc from 'vscode-languageclient'; |
4 | 3 | ||
5 | import { window, workspace } from 'vscode'; | 4 | import { window, workspace } from 'vscode'; |
@@ -29,15 +28,6 @@ export class Server { | |||
29 | } | 28 | } |
30 | 29 | ||
31 | const command = expandPathResolving(this.config.raLspServerPath); | 30 | const command = expandPathResolving(this.config.raLspServerPath); |
32 | // FIXME: remove check when the following issue is fixed: | ||
33 | // https://github.com/otiai10/lookpath/issues/4 | ||
34 | if (platform() !== 'win32') { | ||
35 | if (!(await lookpath(command))) { | ||
36 | throw new Error( | ||
37 | `Cannot find rust-analyzer server \`${command}\` in PATH.`, | ||
38 | ); | ||
39 | } | ||
40 | } | ||
41 | const run: lc.Executable = { | 31 | const run: lc.Executable = { |
42 | command, | 32 | command, |
43 | options: { cwd: folder }, | 33 | options: { cwd: folder }, |
diff --git a/editors/code/src/test/runTest.ts b/editors/code/src/test/runTest.ts deleted file mode 100644 index d880d47df..000000000 --- a/editors/code/src/test/runTest.ts +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | import * as path from 'path'; | ||
2 | |||
3 | import { runTests } from 'vscode-test'; | ||
4 | |||
5 | async function main() { | ||
6 | try { | ||
7 | // The folder containing the Extension Manifest package.json | ||
8 | // Passed to `--extensionDevelopmentPath` | ||
9 | const extensionDevelopmentPath = path.resolve(__dirname, '../../'); | ||
10 | |||
11 | // The path to the extension test runner script | ||
12 | // Passed to --extensionTestsPath | ||
13 | const extensionTestsPath = path.resolve(__dirname, './utils/index'); | ||
14 | |||
15 | // Download VS Code, unzip it and run the integration test | ||
16 | await runTests({ extensionDevelopmentPath, extensionTestsPath }); | ||
17 | } catch (err) { | ||
18 | process.exit(1); | ||
19 | } | ||
20 | } | ||
21 | |||
22 | main(); | ||
diff --git a/editors/code/src/test/utils/index.ts b/editors/code/src/test/utils/index.ts deleted file mode 100644 index 9927daaf6..000000000 --- a/editors/code/src/test/utils/index.ts +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | // | ||
2 | // PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING | ||
3 | // | ||
4 | // This file is providing the test runner to use when running extension tests. | ||
5 | // By default the test runner in use is Mocha based. | ||
6 | // | ||
7 | // You can provide your own test runner if you want to override it by exporting | ||
8 | // a function run(testRoot: string, clb: (error:Error) => void) that the extension | ||
9 | // host can call to run the tests. The test runner is expected to use console.log | ||
10 | // to report the results back to the caller. When the tests are finished, return | ||
11 | // a possible error to the callback or null if none. | ||
12 | |||
13 | import * as glob from 'glob'; | ||
14 | import * as Mocha from 'mocha'; | ||
15 | import * as path from 'path'; | ||
16 | |||
17 | export function run(): Promise<void> { | ||
18 | // Create the mocha test | ||
19 | const mocha = new Mocha({ | ||
20 | ui: 'bdd', | ||
21 | }); | ||
22 | mocha.useColors(true); | ||
23 | |||
24 | const testsRoot = __dirname; | ||
25 | |||
26 | return new Promise((c, e) => { | ||
27 | glob('**/**.test.js', { cwd: testsRoot }, (err, files) => { | ||
28 | if (err) { | ||
29 | return e(err); | ||
30 | } | ||
31 | |||
32 | // Add files to the test suite | ||
33 | files.forEach(f => mocha.addFile(path.resolve(testsRoot, f))); | ||
34 | |||
35 | try { | ||
36 | // Run the mocha test | ||
37 | mocha.run(failures => { | ||
38 | if (failures > 0) { | ||
39 | e(new Error(`${failures} tests failed.`)); | ||
40 | } else { | ||
41 | c(); | ||
42 | } | ||
43 | }); | ||
44 | } catch (err) { | ||
45 | e(err); | ||
46 | } | ||
47 | }); | ||
48 | }); | ||
49 | } | ||