Skip to content

Commit

Permalink
use xvfb action to execute integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Schober committed Jul 13, 2022
1 parent c3860eb commit 5821e8c
Show file tree
Hide file tree
Showing 4 changed files with 205 additions and 192 deletions.
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
28 changes: 19 additions & 9 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ 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');
const gulpWebpack = require('webpack-stream');
const gulpTs = require("gulp-typescript");
const webpack = require('webpack');
const vsce = require('vsce');
const argv = require('yargs').argv;
Expand Down Expand Up @@ -165,7 +165,10 @@ function testUnitTests() {
);
}

function compileDebuggerTests() {
/**
* 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.
Expand All @@ -175,7 +178,10 @@ function compileDebuggerTests() {
return gulp.src(["src/**/*.ts"]).pipe(tsProject()).pipe(gulp.dest("out"));
}

const testDebugger = gulp.series(compileDebuggerTests, async () => {
/**
* 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();
});
Expand All @@ -189,15 +195,20 @@ function testWeb() {
);
}

const test = gulp.series(testUnitTests, testWeb, testDebugger);
// 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 @@ -288,7 +299,6 @@ const dist = gulp.series(
lint,
test
);

const translationExtensionName = "vscode-powerplatform";

// Extract all the localizable strings from TS and package.nls.json, and package into
Expand Down Expand Up @@ -316,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 @@ -366,7 +376,6 @@ function translationsGenerateSrcLocBundles() {
.pipe(gulp.dest(path.join('dist', 'src')));
}


exports.clean = clean;
exports.compile = compile;
exports.compileWeb = compileWeb;
Expand All @@ -375,7 +384,8 @@ exports.snapshot = snapshot;
exports.lint = lint;
exports.test = test;
exports.testWeb = testWeb;
exports.testDebugger = testDebugger;
exports.compileIntegrationTests = compileIntegrationTests;
exports.testInt = testInt;
exports.package = packageVsix;
exports.ci = dist;
exports.dist = dist;
Expand Down
31 changes: 0 additions & 31 deletions package-lock.json

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

Loading

0 comments on commit 5821e8c

Please sign in to comment.