Skip to content

Commit

Permalink
Prettify the whole project
Browse files Browse the repository at this point in the history
  • Loading branch information
yoavbls committed Jul 29, 2023
1 parent 814fce4 commit 3cdf91c
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 49 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -3,3 +3,4 @@ dist
node_modules
.vscode-test/
*.vsix
.idea
2 changes: 1 addition & 1 deletion src/components/unStyledCodeBlock.ts
@@ -1,5 +1,5 @@
import { inlineCodeBlock, multiLineCodeBlock } from "./codeBlock";
import {d} from "../utils";
import { d } from "../utils";

/**
* Code block without syntax highlighting like.
Expand Down
5 changes: 3 additions & 2 deletions src/extension.ts
Expand Up @@ -38,7 +38,8 @@ export function activate(context: ExtensionContext) {
diagnostic.source
? has(["ts", "deno-ts", "js"], diagnostic.source)
: false
).forEach(async (diagnostic) => {
)
.forEach(async (diagnostic) => {
// formatDiagnostic converts message based on LSP Diagnostic type, not VSCode Diagnostic type, so it can be used in other IDEs.
// Here we convert VSCode Diagnostic to LSP Diagnostic to make formatDiagnostic recognize it.
let formattedMessage = cache.get(diagnostic.message);
Expand All @@ -62,7 +63,7 @@ export function activate(context: ExtensionContext) {

items.push({
range: diagnostic.range,
contents: [formattedMessage]
contents: [formattedMessage],
});

hasTsDiagnostic = true;
Expand Down
30 changes: 15 additions & 15 deletions src/test/runTest.ts
@@ -1,23 +1,23 @@
import * as path from 'path';
import * as path from "path";

import { runTests } from '@vscode/test-electron';
import { runTests } from "@vscode/test-electron";

async function main() {
try {
// The folder containing the Extension Manifest package.json
// Passed to `--extensionDevelopmentPath`
const extensionDevelopmentPath = path.resolve(__dirname, '../../');
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');
// 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) {
console.error('Failed to run tests');
process.exit(1);
}
// Download VS Code, unzip it and run the integration test
await runTests({ extensionDevelopmentPath, extensionTestsPath });
} catch (err) {
console.error("Failed to run tests");
process.exit(1);
}
}

main();
62 changes: 31 additions & 31 deletions src/test/suite/index.ts
@@ -1,38 +1,38 @@
import * as path from 'path';
import * as Mocha from 'mocha';
import * as glob from 'glob';
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
});
// Create the mocha test
const mocha = new Mocha({
ui: "tdd",
color: true,
});

const testsRoot = path.resolve(__dirname, '..');
const testsRoot = path.resolve(__dirname, "..");

return new Promise((c, e) => {
glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
if (err) {
return e(err);
}
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)));
// 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) {
console.error(err);
e(err);
}
});
});
try {
// Run the mocha test
mocha.run((failures) => {
if (failures > 0) {
e(new Error(`${failures} tests failed.`));
} else {
c();
}
});
} catch (err) {
console.error(err);
e(err);
}
});
});
}

0 comments on commit 3cdf91c

Please sign in to comment.