Skip to content

Commit 12968ab

Browse files
authored
Fixing render test console.logs in browser (mapbox#10937)
Fixing console.log() not working on successful render tests when using watch-render.
1 parent 89dce15 commit 12968ab

File tree

5 files changed

+11736
-12209
lines changed

5 files changed

+11736
-12209
lines changed

build/test/build-tape.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
/* eslint-disable flowtype/require-valid-file-annotation */
22
import browserify from 'browserify';
3+
import envify from 'envify';
34
import fs from 'fs';
45
import {fileURLToPath} from 'url';
56

67
export default function() {
78
return new Promise((resolve, reject) => {
8-
browserify(fileURLToPath(new URL('../../test/util/tape_config.js', import.meta.url)), { standalone: 'tape' })
9+
browserify(fileURLToPath(new URL('../../test/util/tape_config.js', import.meta.url)), {standalone: 'tape'})
10+
.transform(envify) // Makes env available in tape_config.js
911
.bundle((err, buff) => {
1012
if (err) { throw err; }
1113

12-
fs.writeFile('test/integration/dist/tape.js', buff, { encoding: 'utf8'}, (err) => {
14+
fs.writeFile('test/integration/dist/tape.js', buff, {encoding: 'utf8'}, (err) => {
1315
if (err) { reject(err); }
1416
resolve();
1517
});
1618
});
1719
});
18-
};
20+
}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"diff": "^5.0.0",
6464
"documentation": "~13.1.1",
6565
"ejs": "^3.1.6",
66+
"envify": "^4.1.0",
6667
"eslint": "^7.30.0",
6768
"eslint-config-mourner": "^3.0.0",
6869
"eslint-plugin-flowtype": "^5.2.0",

test/integration/testem/testem.js

+1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ const ciTestemConfig = {
108108
"reporter": "xunit",
109109
"report_file": ciOutputFile,
110110
"xunit_intermediate_output": true,
111+
"tap_quiet_logs": true,
111112
"browser_args": {
112113
"Chrome": {
113114
"ci": [ "--disable-backgrounding-occluded-windows", "--ignore-gpu-blocklist", "--use-gl=desktop" ]

test/util/tape_config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ function getQueryVariable(variable) {
2929
Testem.handleConsoleMessage = function(msg) {
3030
// Send output over ws to testem server
3131
Testem.emit('tap', msg);
32-
33-
return false;
32+
// Return true and log output only when not in CI mode. (yarn run watch-render).
33+
return !process.env.CI;
3434
};
3535

3636
// Persist the current html on the page as an artifact once tests finish

0 commit comments

Comments
 (0)