Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Fixing debug environment #59

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
language: node_js
node_js:
- "7.9"
- "14.14"
sudo: false
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
install:
- ps: Install-Product node 7.9 x64
- ps: Install-Product node 14.14 x64

build_script:
- npm install
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"watch": "webpack --watch --devtool nosources-source-map --info-verbosity verbose --config ./build/extension.webpack.config.js",
"watch2": "tsc -watch -p ./",
"pretest": "yarn run compile && yarn run lint",
"test": "node ./out/test/runTest.js",
"test": "node ./out/tests/runTest.js",
"package": "vsce package",
"publish": "vsce publish",
"package-ext": "webpack --mode production --config ./build/extension.webpack.config.js",
Expand All @@ -57,6 +57,7 @@
"glob": "^7.1.7",
"mocha": "^9.1.0",
"typescript": "^4.3.5",
"vscode-test": "1.6.1",
"vscode-debugadapter-testsupport": "^1.49.0",
"vsce": "^1.96.1",
"ts-loader": "^8.1.0",
Expand Down
23 changes: 23 additions & 0 deletions src/tests/runTest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import * as path from 'path';

import { runTests } from 'vscode-test';

async function main() {
try {
// The folder containing the Extension Manifest package.json
// Passed to `--extensionDevelopmentPath`
const extensionDevelopmentPath = path.resolve(__dirname, '../../');

// The path to the extension test script
// 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);
}
}

main();
4 changes: 2 additions & 2 deletions src/tests/adapter.test.ts → src/tests/suite/adapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import assert = require('assert');
import * as assert from 'assert';
import * as Path from 'path';
import {DebugClient} from 'vscode-debugadapter-testsupport';
import {DebugProtocol} from 'vscode-debugprotocol';
Expand Down Expand Up @@ -42,7 +42,7 @@ suite('Node Debug Adapter', () => {
test('should return supported features', () => {
return dc.initializeRequest().then(response => {
response.body = response.body || {};
assert.equal(response.body.supportsConfigurationDoneRequest, true);
assert.strictEqual(response.body.supportsConfigurationDoneRequest, true);
});
});

Expand Down
File renamed without changes.
39 changes: 39 additions & 0 deletions src/tests/suite/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
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
});
mocha.timeout(100000);

const testsRoot = __dirname;

return new Promise((resolve, reject) => {
glob('**.test.js', { cwd: testsRoot }, (err, files) => {
if (err) {
return reject(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) {
reject(new Error(`${failures} tests failed.`));
} else {
resolve();
}
});
} catch (err) {
console.error(err);
reject(err);
}
});
});
}
Loading