This repository has been archived by the owner on Nov 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use vscode-test rather than vscode module for extension testing
- Loading branch information
Showing
10 changed files
with
816 additions
and
1,781 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
.vscode/** | ||
.vscode-test/** | ||
fixtures/** | ||
test/** | ||
out/test/** | ||
src/** | ||
.gitignore | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING | ||
// | ||
// This file is providing the test runner to use when running extension tests. | ||
// By default the test runner in use is Mocha based. | ||
// | ||
// You can provide your own test runner if you want to override it by exporting | ||
// a function run(testsRoot: string, clb: (error: Error, failures?: number) => void): void | ||
// that the extension host can call to run the tests. The test runner is expected to use console.log | ||
// to report the results back to the caller. When the tests are finished, return | ||
// a possible error to the callback or null if none. | ||
|
||
// tslint:disable-next-line: no-submodule-imports | ||
// import * as testRunner from 'vscode/lib/testrunner'; | ||
|
||
import * as path from 'path'; | ||
import { runTests } from 'vscode-test'; | ||
|
||
(async () => { | ||
const extensionPath = path.resolve(__dirname, '../../'); | ||
const testRunnerPath = path.resolve(__dirname, './suite'); | ||
|
||
await runTests({ | ||
extensionPath, | ||
testRunnerPath, | ||
}); | ||
})(); | ||
|
||
// // You can directly control Mocha options by configuring the test runner below | ||
// // See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options | ||
// // for more info | ||
// testRunner.configure({ | ||
// ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.) | ||
// useColors: true, // colored output from test results | ||
// }); | ||
// module.exports = run; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import * as glob from 'glob'; | ||
import * as Mocha from 'mocha'; | ||
import * as path from 'path'; | ||
|
||
export function run( | ||
testsRoot: string, | ||
// tslint:disable-next-line: no-any | ||
cb: (error: any, failures?: number) => void, | ||
): void { | ||
// Create the mocha test | ||
const mocha = new Mocha({ | ||
ui: 'tdd', | ||
}).useColors(true); | ||
|
||
glob('**/**.test.js', { cwd: testsRoot }, (err, files) => { | ||
if (err) { | ||
return cb(err); | ||
} | ||
|
||
// Add files to the test suite | ||
files.forEach(f => mocha.addFile(path.resolve(testsRoot, f))); | ||
|
||
try { | ||
// Run the mocha test | ||
mocha.run(failures => { | ||
cb(null, failures); | ||
}); | ||
} catch (err) { | ||
cb(err); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/test/utils/wslpath.test.ts → test/suite/utils/wslpath.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters