Skip to content

Commit c5d703a

Browse files
authored
Merge pull request microsoft#90153 from microsoft/joh/continous-browser-tests
add browser tests to continous builds
2 parents 40d9559 + 2b73bcc commit c5d703a

5 files changed

Lines changed: 23 additions & 3 deletions

File tree

build/azure-pipelines/darwin/continuous-build-darwin.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ steps:
4141
- script: |
4242
./scripts/test.sh --tfs "Unit Tests"
4343
displayName: Run Unit Tests
44+
- script: |
45+
yarn test-browser --browser chromium --browser webkit
46+
displayName: Run Unit Tests (Browsers)
4447
- script: |
4548
./scripts/test-integration.sh --tfs "Integration Tests"
4649
displayName: Run Integration Tests

build/azure-pipelines/linux/continuous-build-linux.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ steps:
4949
- script: |
5050
DISPLAY=:10 ./scripts/test.sh --tfs "Unit Tests"
5151
displayName: Run Unit Tests
52+
- script: |
53+
DISPLAY=:10 yarn test-browser --browser chromium
54+
displayName: Run Unit Tests (Browser)
5255
- script: |
5356
DISPLAY=:10 ./scripts/test-integration.sh --tfs "Integration Tests"
5457
displayName: Run Integration Tests

build/azure-pipelines/win32/continuous-build-win32.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ steps:
4646
- powershell: |
4747
.\scripts\test.bat --tfs "Unit Tests"
4848
displayName: Run Unit Tests
49+
- powershell: |
50+
yarn test-browser --browser chromium --browser webkit
51+
displayName: Run Unit Tests (Browser)
4952
- powershell: |
5053
.\scripts\test-integration.bat --tfs "Integration Tests"
5154
displayName: Run Integration Tests

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"private": true,
1111
"scripts": {
1212
"test": "mocha",
13+
"test-browser": "node test/unit/browser/index.js",
1314
"preinstall": "node build/npm/preinstall.js",
1415
"postinstall": "node build/npm/postinstall.js",
1516
"compile": "gulp compile --max_old_space_size=4095",

test/unit/browser/index.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,22 @@ class EchoRunner extends events.EventEmitter {
210210

211211
testModules.then(async modules => {
212212

213-
const browserTypes = Array.isArray(argv.browser) ? argv.browser : [argv.browser];
214-
const promises = browserTypes.map(browserType => runTestsInBrowser(modules, browserType));
215-
const messages = await Promise.all(promises);
213+
// run tests in selected browsers
214+
const browserTypes = Array.isArray(argv.browser)
215+
? argv.browser : [argv.browser];
216+
217+
const promises = browserTypes.map(async browserType => {
218+
try {
219+
return await runTestsInBrowser(modules, browserType);
220+
} catch (err) {
221+
console.error(err);
222+
process.exit(1);
223+
}
224+
});
216225

217226
// aftermath
218227
let didFail = false;
228+
const messages = await Promise.all(promises);
219229
for (let msg of messages) {
220230
if (msg) {
221231
didFail = true;

0 commit comments

Comments
 (0)