Skip to content

Commit

Permalink
fix: compile error
Browse files Browse the repository at this point in the history
  • Loading branch information
zxch3n committed Mar 23, 2022
1 parent 6fa06f3 commit ad95334
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/discover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from "./TestData";
import { shouldIncludeFile } from "./vscodeUtils";

import minimatch = require("minimatch");
import minimatch from "minimatch";
import { getConfig } from "./config";
import { debounce } from "mighty-promise";
export function discoverTestFromDoc(
Expand Down
2 changes: 1 addition & 1 deletion src/runHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ async function runTest(
? (msg) => run.appendOutput(msg, undefined, items[0])
: (msg) => run.appendOutput(msg),
config.env || undefined,
config.commandLine?.trim().split(" ") || undefined
config.commandLine ? config.commandLine.trim().split(" ") : undefined
)
.catch((e) => {
run.appendOutput("Run test failed \r\n" + (e as Error) + "\r\n");
Expand Down
62 changes: 31 additions & 31 deletions src/test/suite/index.ts
Original file line number Diff line number Diff line change
@@ -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 Mocha from "mocha";
import 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);
}
});
});
}
2 changes: 1 addition & 1 deletion src/vscodeUtils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Uri, workspace } from "vscode";
import { TextDecoder } from "util";
import { getConfig } from "./config";
import minimatch = require("minimatch");
import minimatch from "minimatch";

const textDecoder = new TextDecoder("utf-8");

Expand Down
2 changes: 2 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
"lib": ["ES2020"],
"sourceMap": true,
"rootDir": "src",
"esModuleInterop": true,
"strict": true /* enable all strict type-checking options */
/* Additional Checks */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
},
"include": ["src/**/*.ts"],

"exclude": ["samples"]
}

0 comments on commit ad95334

Please sign in to comment.