Skip to content
Open
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
6,585 changes: 1,349 additions & 5,236 deletions package-lock.json

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"main": "./dist/extension.js",
"scripts": {
"vscode:prepublish": "npm run clean && npm run package",
"clean": "rimraf dist/",
"clean": "rimraf dist/ && rimraf out/",
"compile": "webpack",
"watch": "webpack --watch",
"package": "webpack --mode production --devtool hidden-source-map",
Expand All @@ -47,7 +47,7 @@
"pretest": "npm run test-compile && npm run lint",
"prettier:format": "prettier --write \"{,src/**/,test/**}*.{js,ts}\"",
"lint": "eslint src --ext ts",
"test": "ts-mocha test/**/*.spec.ts"
"test": "ts-mocha test/**/*.test.ts"
},
"dependencies": {
"@apidevtools/json-schema-ref-parser": "^9.0.7",
Expand All @@ -66,25 +66,28 @@
"parse-curl": "0.2.6",
"pluralize": "^8.0.0",
"rimraf": "^3.0.2",
"vsce": "^2.10.0"
"vsce": "^2.10.0",
"vscode": "^1.1.37"
},
"devDependencies": {
"@testdeck/mocha": "^0.3.3",
"@types/chai": "^4.2.14",
"@types/glob": "^7.1.1",
"@types/mocha": "^5.2.7",
"@types/mocha": "^10.0.1",
"@types/node": "^12.6.9",
"@types/vscode": "^1.61.0",
"@typescript-eslint/eslint-plugin": "^4.14.1",
"@typescript-eslint/parser": "^4.14.1",
"@vscode/test-electron": "^2.3.0",
"ansi-regex": "^6.0.1",
"chai": "^4.2.0",
"eslint": "^7.19.0",
"file-loader": "^6.2.0",
"glob": "^7.1.6",
"mocha": "^8.2.1",
"mocha": "^10.2.0",
"prettier": "^2.2.1",
"ts-loader": "^8.0.14",
"ts-mocha": "^8.0.0",
"ts-mocha": "^10.0.0",
"typescript": "^4.1.3",
"vscode-test": "^1.5.0",
"webpack": "^5.19.0",
Expand Down
69 changes: 69 additions & 0 deletions test/runTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
exports.__esModule = true;
var path = require("path");
// const path = require ('path');
// const runTests = require ('@vscode/test-electron');
var test_electron_1 = require("@vscode/test-electron");
function main() {
return __awaiter(this, void 0, void 0, function () {
var extensionDevelopmentPath, extensionTestsPath, err_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
extensionDevelopmentPath = path.resolve(__dirname, '../../');
extensionTestsPath = path.resolve(__dirname, './suite/index');
// Download VS Code, unzip it and run the integration test
return [4 /*yield*/, (0, test_electron_1.runTests)({ extensionDevelopmentPath: extensionDevelopmentPath, extensionTestsPath: extensionTestsPath })];
case 1:
// Download VS Code, unzip it and run the integration test
_a.sent();
console.error('End of run tests');
return [3 /*break*/, 3];
case 2:
err_1 = _a.sent();
console.error('Failed to run tests');
process.exit(1);
return [3 /*break*/, 3];
case 3: return [2 /*return*/];
}
});
});
}
main();
28 changes: 28 additions & 0 deletions test/runTest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import * as path from 'path';
// const path = require ('path');


// const runTests = require ('@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, '../../');

// 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 });
console.error('End of run tests');
} catch (err) {
console.error('Failed to run tests');
process.exit(1);
}
}

main();
12 changes: 12 additions & 0 deletions test/suite/extension.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use strict";
exports.__esModule = true;
var assert = require("assert");
var mocha = require("mocha");
// import * as myExtension from '../../extension';
mocha.suite('Extension Test Suite', function () {
// vscode.window.showInformationMessage('Start all tests.');
mocha.test('Sample test', function () {
assert.strictEqual([1, 2, 3].indexOf(5), -1);
assert.strictEqual([1, 2, 3].indexOf(0), -1);
});
});
20 changes: 20 additions & 0 deletions test/suite/extension.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import * as assert from 'assert';

import * as mocha from 'mocha';


// You can import and use all API from the 'vscode' module
// as well as import your extension to test it
// import * as vscode from 'vscode';
// import * as vscode from 'vscode/test-electron';
import * as vscode from '@vscode/test-electron';

// import * as myExtension from '../../extension';
mocha.suite('Extension Test Suite', () => {
// vscode.window.showInformationMessage('Start all tests.');

mocha.test('Sample test', () => {
assert.strictEqual([1, 2, 3].indexOf(5), -1);
assert.strictEqual([1, 2, 3].indexOf(0), -1);
});
});
38 changes: 38 additions & 0 deletions test/suite/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"use strict";
exports.__esModule = true;
exports.run = void 0;
var path = require("path");
var Mocha = require("mocha");
var glob = require("glob");
function run() {
// Create the mocha test
var mocha = new Mocha({
ui: 'tdd'
});
var testsRoot = path.resolve(__dirname, '..');
return new Promise(function (c, e) {
glob('**/**.test.js', { cwd: testsRoot }, function (err, files) {
if (err) {
return e(err);
}
// Add files to the test suite
files.forEach(function (f) { return mocha.addFile(path.resolve(testsRoot, f)); });
try {
// Run the mocha test
mocha.run(function (failures) {
if (failures > 0) {
e(new Error("".concat(failures, " tests failed.")));
}
else {
c();
}
});
}
catch (err) {
console.error(err);
e(err);
}
});
});
}
exports.run = run;
37 changes: 37 additions & 0 deletions test/suite/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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'
});

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

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

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);
}
});
});
}
22 changes: 22 additions & 0 deletions test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out",
"baseUrl": "./",
"module": "commonjs",
"experimentalDecorators": true,
"strictPropertyInitialization": false,
"isolatedModules": false,
"strict": false,
"noImplicitAny": false,
"typeRoots" : [
"../node_modules/@types"
]
},
"include": [
"./**/*.ts"
],
"exclude": [
"../node_modules"
]
}
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"outDir": "out",
"outDir": "dist",
"lib": [
"es2019"
],
Expand All @@ -18,6 +18,7 @@
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
},
"include": ["src/**/*"],
"exclude": [
"node_modules",
".vscode-test"
Expand Down