Skip to content

Commit 61f0102

Browse files
authored
Use base browsers variable in Firestore karma config (#8876)
1 parent 195d943 commit 61f0102

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

packages/firestore/karma.conf.js

-9
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const { argv } = require('yargs');
2121
module.exports = function (config) {
2222
const karmaConfig = {
2323
...karmaBase,
24-
browsers: getTestBrowsers(argv),
2524
// files to load into karma
2625
files: getTestFiles(argv),
2726

@@ -76,12 +75,4 @@ function getTestFiles(argv) {
7675
}
7776
}
7877

79-
function getTestBrowsers(argv) {
80-
let browsers = ['ChromeHeadless'];
81-
if (process.env?.BROWSERS && argv.unit) {
82-
browsers = process.env?.BROWSERS?.split(',');
83-
}
84-
return browsers;
85-
}
86-
8778
module.exports.files = getTestFiles(argv);

packages/firestore/test/unit/util/bundle.test.ts

+15-3
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,21 @@ function genericBundleReadingTests(bytesPerRead: number): void {
239239
'Reached the end of bundle when a length string is expected.'
240240
);
241241

242-
await expect(
243-
generateBundleAndParse('{metadata: "no length prefix"}', bytesPerRead)
244-
).to.be.rejectedWith(/(Unexpected end of )(?=.*JSON\b).*/gi);
242+
// The multiple "rejectedWith" checks below are an attempt to make the
243+
// test robust in the presence of various permutations of the error
244+
// message, which is produced by the JavaScript runtime.
245+
// Chrome produces: Unexpected end of JSON input
246+
// Webkit produces: JSON Parse error: Unexpected EOF
247+
const noLengthPrefixPromise = generateBundleAndParse(
248+
'{metadata: "no length prefix"}',
249+
bytesPerRead
250+
);
251+
await expect(noLengthPrefixPromise).to.be.rejectedWith(
252+
/(\b|^)unexpected ((end of)|(eof))(\b|$)/gi
253+
);
254+
await expect(noLengthPrefixPromise).to.be.rejectedWith(
255+
/(\b|^)JSON(\b|$)/g
256+
);
245257

246258
await expect(
247259
generateBundleAndParse(

0 commit comments

Comments
 (0)