From 87b6936223e2df3bc946ac2da454c311b461fc19 Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Thu, 27 Mar 2025 14:38:45 -0400 Subject: [PATCH 1/2] Use base browsers variable in Firestore karma config --- packages/firestore/karma.conf.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/packages/firestore/karma.conf.js b/packages/firestore/karma.conf.js index 70c5ffef546..51a158b8c3a 100644 --- a/packages/firestore/karma.conf.js +++ b/packages/firestore/karma.conf.js @@ -21,7 +21,6 @@ const { argv } = require('yargs'); module.exports = function (config) { const karmaConfig = { ...karmaBase, - browsers: getTestBrowsers(argv), // files to load into karma files: getTestFiles(argv), @@ -76,12 +75,4 @@ function getTestFiles(argv) { } } -function getTestBrowsers(argv) { - let browsers = ['ChromeHeadless']; - if (process.env?.BROWSERS && argv.unit) { - browsers = process.env?.BROWSERS?.split(','); - } - return browsers; -} - module.exports.files = getTestFiles(argv); From b9b6aa9afe0ac4ba482556a046507d5711502ccb Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Thu, 27 Mar 2025 20:10:54 +0000 Subject: [PATCH 2/2] fix failing unit test "throws with ill-formatted bundle with bytesPerRead" which erroneously fails due to different webkit error message on json parse failure compared to chrome --- .../firestore/test/unit/util/bundle.test.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/firestore/test/unit/util/bundle.test.ts b/packages/firestore/test/unit/util/bundle.test.ts index 13647efa470..1cc4c05772e 100644 --- a/packages/firestore/test/unit/util/bundle.test.ts +++ b/packages/firestore/test/unit/util/bundle.test.ts @@ -239,9 +239,21 @@ function genericBundleReadingTests(bytesPerRead: number): void { 'Reached the end of bundle when a length string is expected.' ); - await expect( - generateBundleAndParse('{metadata: "no length prefix"}', bytesPerRead) - ).to.be.rejectedWith(/(Unexpected end of )(?=.*JSON\b).*/gi); + // The multiple "rejectedWith" checks below are an attempt to make the + // test robust in the presence of various permutations of the error + // message, which is produced by the JavaScript runtime. + // Chrome produces: Unexpected end of JSON input + // Webkit produces: JSON Parse error: Unexpected EOF + const noLengthPrefixPromise = generateBundleAndParse( + '{metadata: "no length prefix"}', + bytesPerRead + ); + await expect(noLengthPrefixPromise).to.be.rejectedWith( + /(\b|^)unexpected ((end of)|(eof))(\b|$)/gi + ); + await expect(noLengthPrefixPromise).to.be.rejectedWith( + /(\b|^)JSON(\b|$)/g + ); await expect( generateBundleAndParse(