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

PCF Debugger: Add initial debugger code #231

Merged
merged 31 commits into from
Jul 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
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
11 changes: 9 additions & 2 deletions .github/workflows/PullRequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,17 @@ jobs:
with:
node-version: 14.x

- name: Build and test
- name: Install dependencies
run: npm i -g npm

- name: Build and unit test
run: |
npm i -g npm
npm ci
npm run dist
env:
AZ_DevOps_Read_PAT: ${{ secrets.AZ_DevOps_Read_PAT }}

- name: Run integration tests
uses: GabrielBB/[email protected]
with:
run: npm run test-integration
99 changes: 52 additions & 47 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,65 @@
"version": "0.2.0",
"configurations": [
{
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"name": "Launch VSCode Extension",
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"sourceMaps": true,
"runtimeExecutable": "${execPath}",
"preLaunchTask": "gulp: compile",
"request": "launch",
"type": "pwa-extensionHost",
"trace": true
},
{
"type": "node",
"request": "attach",
"name": "Attach to Server",
"port": 6009,
"restart": true,
"outFiles": ["${workspaceFolder}/dist/**/*.js"]
},
{
"type": "node",
"request": "attach",
"name": "Attach to Server",
"port": 6009,
"restart": true,
"outFiles": ["${workspaceFolder}/dist/**/*.js"]
},
{
"type": "node",
"request": "launch",
"name": "Mocha All Unit tests",
"program": "${workspaceFolder}/node_modules/mocha/bin/mocha",
"cwd": "${workspaceFolder}",
"args": [
"--require", "ts-node/register",
"-u", "bdd",
"--timeout", "999999",
"--require",
"ts-node/register",
"-u",
"bdd",
"--timeout",
"999999",
"src/client/test/unit/**/*.ts"
],
"internalConsoleOptions": "neverOpen"
},
{
"name": "Integration Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/debugger/test/unit/index"
],
"outFiles": ["${workspaceFolder}/out/debugger/test/**/*.js"]
},
{
"type": "node",
"request": "launch",
"name": "Mocha Current File",
"program": "${workspaceFolder}/node_modules/mocha/bin/mocha",
"cwd": "${workspaceFolder}",
"args": [
"--require", "ts-node/register",
"-u", "bdd",
"--timeout", "999999",
"--require",
"ts-node/register",
"-u",
"bdd",
"--timeout",
"999999",
"${file}"
],
"internalConsoleOptions": "neverOpen"
Expand All @@ -58,9 +71,7 @@
"name": "Launch current TypeScript src",
"program": "${file}",
"cwd": "${workspaceFolder}",
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"preLaunchTask": "gulp: compile",
"sourceMaps": true
},
Expand All @@ -70,32 +81,26 @@
"name": "Gulp task",
"program": "${workspaceFolder}/node_modules/gulp/bin/gulp.js",
"cwd": "${workspaceFolder}",
"args": [
"recompile"
],
"skipFiles": [
"<node_internals>/**"
]
"args": ["recompile"],
"skipFiles": ["<node_internals>/**"]
},
{
"name": "Run Web Extension in VS Code",
"type": "pwa-extensionHost",
"debugWebWorkerHost": true,
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionDevelopmentKind=web"
],
"outFiles": [
"${workspaceFolder}/dist/web/**/*.js"
],
"preLaunchTask": "gulp: compileWeb"
}
"name": "Run Web Extension in VS Code",
"type": "pwa-extensionHost",
"debugWebWorkerHost": true,
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionDevelopmentKind=web"
],
"outFiles": ["${workspaceFolder}/dist/web/**/*.js"],
"preLaunchTask": "gulp: compileWeb"
}
],
"compounds": [
{
"name": "Client + Server",
"configurations": ["Launch VSCode Extension", "Attach to Server"]
}
]
{
"name": "Client + Server",
"configurations": ["Launch VSCode Extension", "Attach to Server"]
}
]
}
74 changes: 57 additions & 17 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const exec = util.promisify(require('child_process').exec);
const gulp = require('gulp');
const filter = require('gulp-filter');
const eslint = require('gulp-eslint');
const gulpTs = require("gulp-typescript");
const replace = require('gulp-replace');
const mocha = require('gulp-mocha');
const moment = require('moment');
Expand Down Expand Up @@ -144,31 +145,70 @@ function lint() {
.pipe(eslint.failAfterError());
}

function test() {
function testUnitTests() {
return gulp
.src(['src/server/test/unit/**/*.ts','src/client/test/unit/**/*.ts'], { read: false })
.pipe(mocha({
require: [ "ts-node/register" ],
ui: 'bdd'
}));
.src(
[
"src/server/test/unit/**/*.ts",
"src/client/test/unit/**/*.ts",
"src/debugger/test/unit/**/*.ts",
],
{
read: false,
}
)
.pipe(
mocha({
require: ["ts-node/register"],
ui: "bdd",
})
);
}

/**
* Compiles the integration tests and transpiles the results to /out
*/
function compileIntegrationTests() {
const tsProject = gulpTs.createProject("tsconfig.json", {
// to test puppeteer we need "dom".
// since "dom" overlaps with "webworker" we need to overwrite the lib property.
// This is a known ts issue (bot being able to have both webworker and dom): https://github.com/microsoft/TypeScript/issues/20595
lib: ["es2019", "dom", "dom.iterable"],
});
return gulp.src(["src/**/*.ts"]).pipe(tsProject()).pipe(gulp.dest("out"));
}

/**
* Tests the debugger integration tests after transpiling the source files to /out
*/
const testDebugger = gulp.series(compileIntegrationTests, async () => {
const testRunner = require("./out/debugger/test/runTest");
await testRunner.main();
});

function testWeb() {
return gulp
.src(['src/web/client/test/unit/**/*.ts'], { read: false })
.pipe(mocha({
require: [ "ts-node/register" ],
ui: 'bdd'
}));
return gulp.src(["src/web/client/test/unit/**/*.ts"], { read: false }).pipe(
mocha({
require: ["ts-node/register"],
ui: "bdd",
})
);
}

// unit tests without special test runner
const test = gulp.series(testUnitTests, testWeb);

// tests that require vscode-electron (which requires a display or xvfb)
const testInt = gulp.series(testDebugger);

async function packageVsix() {
fs.emptyDirSync(packagedir);
return vsce.createVSIX({
packagePath: packagedir,
})
});
}


async function git(args) {
args.unshift('git');
const {stdout, stderr } = await exec(args.join(' '));
Expand Down Expand Up @@ -257,10 +297,8 @@ const dist = gulp.series(
recompile,
packageVsix,
lint,
test,
testWeb
test
);

const translationExtensionName = "vscode-powerplatform";

// Extract all the localizable strings from TS and package.nls.json, and package into
Expand Down Expand Up @@ -288,7 +326,7 @@ const languages = [
{ id: "it", folderName: "ita" },
{ id: "ja", folderName: "jpn" },
{ id: "ko", folderName: "kor" },
{ id: "pt-BR", folderName: "ptb"},
{ id: "pt-BR", folderName: "ptb" },
{ id: "ru", folderName: "rus" },
{ id: "tr", folderName: "trk" },
{ id: "zh-CN", folderName: "chs" },
Expand Down Expand Up @@ -346,6 +384,8 @@ exports.snapshot = snapshot;
exports.lint = lint;
exports.test = test;
exports.testWeb = testWeb;
exports.compileIntegrationTests = compileIntegrationTests;
exports.testInt = testInt;
exports.package = packageVsix;
exports.ci = dist;
exports.dist = dist;
Expand Down
Loading