Skip to content

Use base browsers variable in Firestore karma config #8876

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions packages/firestore/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),

Expand Down Expand Up @@ -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);
18 changes: 15 additions & 3 deletions packages/firestore/test/unit/util/bundle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading