Initial commit

This commit is contained in:
jakergrossman
2021-09-25 16:18:41 -05:00
commit 214610340f
14 changed files with 2261 additions and 0 deletions

14
src/extension.ts Normal file
View 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
View 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();

View 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
View 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);
}
});
});
}