Skip to content

Commit

Permalink
fix: make tests pass again
Browse files Browse the repository at this point in the history
remove `glob` and update packages
  • Loading branch information
senyai committed Mar 23, 2024
1 parent bb34155 commit 77ce5bb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1085,18 +1085,17 @@
},
"devDependencies": {
"@microsoft/eslint-formatter-sarif": "^3.0.0",
"@types/glob": "~8.1.0",
"@types/mocha": "~10.0.1",
"@types/node": "^16.18.32",
"@types/sinon": "~10.0.20",
"@types/sinon": "~17.0.3",
"@types/vscode": "^1.36.0",
"@types/vscode-webview": "^1.57.0",
"@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.7.3",
"@vscode/test-electron": "~2.3.4",
"@vscode/vsce": "~2.21.1",
"@vscode/test-electron": "~2.3.9",
"@vscode/vsce": "~2.24.0",
"c8": "^8.0.1",
"esbuild": "~0.19.5",
"esbuild": "~0.20.2",
"eslint": "^8.52.0",
"eslint-config-standard": "~17.0.0",
"eslint-plugin-import": "~2.27.5",
Expand All @@ -1105,7 +1104,7 @@
"eslint-plugin-promise": "~6.1.1",
"mocha": "~10.2.0",
"prettier": "~2.8.8",
"sinon": "~17.0.0",
"sinon": "~17.0.1",
"typescript": "^5.2.2"
},
"__metadata": {
Expand Down
4 changes: 2 additions & 2 deletions src/test/runTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async function main() {

// The path to the extension test runner script
// Passed to --extensionTestsPath
const extensionTestsPath = path.resolve(__dirname, './suite/index');
const extensionTestsPath = path.resolve(__dirname, './suite');

const testWorkspace = path.resolve(os.tmpdir(), './test_repo');
await fs.mkdir(testWorkspace, { recursive: true });
Expand All @@ -23,7 +23,7 @@ async function main() {
await runTests({
extensionDevelopmentPath,
extensionTestsPath,
launchArgs: [testWorkspace, '--disable-extensions'],
launchArgs: [testWorkspace, '--disable-extensions', '--no-sandbox'],
// Fix version to stop tests failing as time goes by. See:
// https://github.com/microsoft/vscode-test/issues/221
version: '1.79.2',
Expand Down
12 changes: 6 additions & 6 deletions src/test/suite/index.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import * as path from 'path';
import * as Mocha from 'mocha';
import * as glob from 'glob';
import * as fs from 'fs';

export function run(): Promise<void> {
export function run(testsRoot: string): Promise<void> {
// Create the mocha test
const mocha = new Mocha({
ui: 'tdd',
});

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

return new Promise((c, e) => {
glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
fs.readdir(testsRoot, { withFileTypes: true }, (err, files) => {
/* c8 ignore next 3 */
if (err) {
return e(err);
}

// Add files to the test suite
files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
files
.filter(f => f.isFile() && f.name.endsWith('.test.js'))
.forEach(f => mocha.addFile(path.resolve(testsRoot, f.name)));

try {
// Run the mocha test
Expand Down

0 comments on commit 77ce5bb

Please sign in to comment.