mirror of
https://github.com/We-Dont-Byte/Mind_Reader.git
synced 2025-02-04 10:38:42 +00:00
Initial commit
This commit is contained in:
14
src/extension.ts
Normal file
14
src/extension.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
console.log('Congratulations, your extension "mind-reader" is now active!');
|
||||
vscode.window.showInformationMessage('Mind_Reader is loaded!')
|
||||
|
||||
let disposable = vscode.commands.registerCommand('mind-reader.helloWorld', () => {
|
||||
vscode.window.showInformationMessage('Hello World from Mind_Reader!');
|
||||
});
|
||||
|
||||
context.subscriptions.push(disposable);
|
||||
}
|
||||
|
||||
export function deactivate() {}
|
||||
22
src/test/runTest.ts
Normal file
22
src/test/runTest.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import * as path from 'path';
|
||||
|
||||
import { runTests } from '@vscode/test-electron';
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
// The folder containing package.json
|
||||
const extensionDevelopmentPath: string = path.resolve(__dirname, '../../');
|
||||
|
||||
// The path to the test runner script
|
||||
const extensionTestsPath: string = path.resolve(__dirname, './suite/index');
|
||||
|
||||
// Download VS Code, unzip it and run the integration test
|
||||
await runTests({ extensionDevelopmentPath, extensionTestsPath });
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
console.error('Failed to run tests');
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
13
src/test/suite/extension.test.ts
Normal file
13
src/test/suite/extension.test.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import * as assert from 'assert';
|
||||
import * as vscode from 'vscode';
|
||||
import { after } from 'mocha';
|
||||
|
||||
suite('Dummy Test Suite', () => {
|
||||
after(() => {
|
||||
vscode.window.showInformationMessage('All tests passed!');
|
||||
});
|
||||
|
||||
test('Dummy Test', () => {
|
||||
assert.strictEqual(0 === 0, true);
|
||||
});
|
||||
});
|
||||
38
src/test/suite/index.ts
Normal file
38
src/test/suite/index.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import * as path from 'path';
|
||||
import * as glob from 'glob';
|
||||
import * as Mocha from 'mocha';
|
||||
|
||||
export function run(): Promise<void> {
|
||||
// Create the mocha test
|
||||
const mocha: Mocha = new Mocha({
|
||||
ui: 'tdd',
|
||||
color: true
|
||||
});
|
||||
|
||||
const testsRoot: string = path.resolve(__dirname, '..');
|
||||
|
||||
return new Promise((c, e) => {
|
||||
// Find files
|
||||
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);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user