-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alexander Rogalskiy
committed
Oct 20, 2021
1 parent
6c81bb3
commit 126e836
Showing
2 changed files
with
71 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import * as path from 'path'; | ||
import * as Mocha from 'mocha'; | ||
import * as glob from 'glob'; | ||
|
||
export function run(): Promise<void> { | ||
|
||
// Create the mocha test | ||
const mocha = new Mocha({ | ||
ui: 'tdd', | ||
color: true | ||
}); | ||
|
||
const testsRoot = path.resolve(__dirname, '..'); | ||
|
||
return new Promise((c, e) => { | ||
glob('**/**.test.js', { cwd: testsRoot }, (err, files) => { | ||
if (err) { | ||
return e(err); | ||
} | ||
|
||
// Add files to the test suite | ||
files.forEach(f => mocha.addFile(path.resolve(testsRoot, f))); | ||
|
||
try { | ||
// Run the mocha test | ||
mocha.run(failures => { | ||
if (failures > 0) { | ||
e(new Error(`${failures} tests failed.`)); | ||
} else { | ||
c(); | ||
} | ||
}); | ||
} catch (err) { | ||
e(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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import * as path from 'path'; | ||
|
||
import { cp } from 'shelljs'; | ||
|
||
import { runTests } from 'vscode-test'; | ||
|
||
async function main() { | ||
try { | ||
// The folder containing the Extension Manifest package.json | ||
// Passed to `--extensionDevelopmentPath` | ||
const extensionDevelopmentPath = path.resolve(__dirname, '../../'); | ||
|
||
// The path to test runner | ||
// Passed to --extensionTestsPath | ||
const extensionTestsPath = path.resolve(__dirname, './suite/index'); | ||
|
||
// Download VS Code, unzip it and run the integration test | ||
await runTests({ extensionDevelopmentPath, extensionTestsPath }); | ||
} catch (err) { | ||
process.exit(1); | ||
} | ||
} | ||
|
||
function copyTestFiles() { | ||
const src = path.resolve(__dirname, '../..', 'src', 'test', 'fixtures'); | ||
|
||
const dest = path.resolve(__dirname, 'fixtures'); | ||
|
||
cp('-R', src, dest); | ||
} | ||
|
||
copyTestFiles(); | ||
main(); |