Skip to content

Commit

Permalink
Compile typescript to esnext.
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry-Hopkinson committed May 27, 2022
1 parent 9fab983 commit cb3d5e4
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 107 deletions.
2 changes: 1 addition & 1 deletion media/main-bundle.js

Large diffs are not rendered by default.

37 changes: 19 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/extension/test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "vscode-pets-test",
"type": "module"
}
78 changes: 15 additions & 63 deletions src/extension/test/runTest.js
Original file line number Diff line number Diff line change
@@ -1,66 +1,18 @@
"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 (_) 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 };
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 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);
}
};
exports.__esModule = true;
var path = require("path");
var vscode_test_1 = require("vscode-test");
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*/, vscode_test_1.runTests({ extensionDevelopmentPath: extensionDevelopmentPath, extensionTestsPath: extensionTestsPath })];
case 1:
// Download VS Code, unzip it and run the integration test
_a.sent();
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();
10 changes: 4 additions & 6 deletions src/extension/test/suite/extension.test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
"use strict";
exports.__esModule = true;
var assert = require("assert");
import * as assert from 'assert';
// You can import and use all API from the 'vscode' module
// as well as import your extension to test it
var vscode = require("vscode");
import * as vscode from 'vscode';
// import * as myExtension from '../../extension';
suite('Extension Test Suite', function () {
suite('Extension Test Suite', () => {
vscode.window.showInformationMessage('Start all tests.');
test('Sample test', function () {
test('Sample test', () => {
assert.equal(-1, [1, 2, 3].indexOf(5));
assert.equal(-1, [1, 2, 3].indexOf(0));
});
Expand Down
28 changes: 12 additions & 16 deletions src/extension/test/suite/index.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
"use strict";
exports.__esModule = true;
exports.run = void 0;
var path = require("path");
var Mocha = require("mocha");
var glob = require("glob");
function run() {
import * as path from 'path';
import * as Mocha from 'mocha';
import * as glob from 'glob';
export function run() {
// Create the mocha test
var mocha = new Mocha({
const mocha = new Mocha({
ui: 'tdd',
color: true
color: true,
});
var testsRoot = path.resolve(__dirname, '..');
return new Promise(function (c, e) {
glob('**/**.test.js', { cwd: testsRoot }, function (err, files) {
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(function (f) { return mocha.addFile(path.resolve(testsRoot, f)); });
files.forEach((f) => mocha.addFile(path.resolve(testsRoot, f)));
try {
// Run the mocha test
mocha.run(function (failures) {
mocha.run((failures) => {
if (failures > 0) {
e(new Error(failures + " tests failed."));
e(new Error(`${failures} tests failed.`));
}
else {
c();
Expand All @@ -36,4 +33,3 @@ function run() {
});
});
}
exports.run = run;
2 changes: 1 addition & 1 deletion tsconfig.extension.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"target": "esnext",
"outDir": "out",
"lib": [
"es6"
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"noImplicitAny": true,
"strictNullChecks": true,
"outDir": "./.build-out",
"lib": ["es2016", "dom"]
"lib": ["es2016", "dom"],
"target": "esnext"
},
"include": ["src"]
}
2 changes: 1 addition & 1 deletion tsconfig.panel.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"target": "esnext",
"outDir": "./build",
"lib": [
"es6", "DOM"
Expand Down

0 comments on commit cb3d5e4

Please sign in to comment.