Skip to content

Commit dceb32a

Browse files
committed
Setting up firestore integration tests
1 parent babdcfd commit dceb32a

File tree

5 files changed

+31
-22
lines changed

5 files changed

+31
-22
lines changed

config/karma.saucelabs.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ if (!testConfigFile) {
3131
*/
3232
const browserMap = {
3333
// Desktop
34-
Chrome_Windows: seleniumLauncher('chrome', 'Windows 10', 'latest'),
35-
Firefox_Windows: seleniumLauncher('firefox', 'Windows 10', 'latest'),
36-
Safari_macOS: seleniumLauncher('safari', 'macOS 10.13', 'latest'),
37-
Edge_Windows: seleniumLauncher('MicrosoftEdge', 'Windows 10', 'latest'),
34+
// Chrome_Windows: seleniumLauncher('chrome', 'Windows 10', 'latest'),
35+
// Firefox_Windows: seleniumLauncher('firefox', 'Windows 10', 'latest'),
36+
// Safari_macOS: seleniumLauncher('safari', 'macOS 10.13', 'latest'),
37+
// Edge_Windows: seleniumLauncher('MicrosoftEdge', 'Windows 10', 'latest'),
3838
IE_Windows: seleniumLauncher('internet explorer', 'Windows 10', 'latest')
3939

4040
// Mobile

integration/firestore/karma.conf.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ const path = require('path');
2020
const karmaBase = require('../../config/karma.base');
2121

2222
const files = [
23-
`${path.dirname(require.resolve('firebase'))}/firebase.js`,
24-
`${path.dirname(require.resolve('firebase'))}/firebase-firestore.js`,
23+
// `${path.dirname(require.resolve('firebase'))}/firebase.js`,
24+
// `${path.dirname(require.resolve('firebase'))}/firebase-firestore.js`,
2525
'./dist/test-harness.js'
2626
];
2727

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"test:changed": "node scripts/run_changed.js",
4141
"test:setup": "node tools/config.js",
4242
"test:saucelabs": "node scripts/run_saucelabs.js",
43-
"test:saucelabs:single": "karma start config/karma.saucelabs.js --single-run",
4443
"docgen:js": "node scripts/docgen/generate-docs.js --api js",
4544
"docgen:node": "node scripts/docgen/generate-docs.js --api node",
4645
"docgen": "yarn docgen:js; yarn docgen:node",

packages/firestore/karma.conf.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ module.exports = function(config) {
4242
* --unit and --integration command-line arguments.
4343
*/
4444
function getTestFiles(argv) {
45+
console.log(argv);
4546
const unitTests = 'test/unit/bootstrap.ts';
4647
const integrationTests = 'test/integration/bootstrap.ts';
4748
if (argv.unit) {

scripts/run_saucelabs.js

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,12 @@ const testFiles = configFiles.length
3939
: glob
4040
.sync(`{packages,integration}/*/karma.conf.js`)
4141
// Automated tests in integration/firestore are currently disabled.
42-
.filter(name => !name.includes('integration/firestore'));
42+
// .filter(name => !name.includes('integration/firestore'));
4343

4444
// Get CI build number or generate one if running locally.
4545
const buildNumber =
4646
process.env.TRAVIS_BUILD_NUMBER ||
47-
// GitHub Actions does not have a build number, but the feature has been requested.
48-
process.env.GITHUB_SHA ||
47+
process.env.GITHUB_RUN_ID ||
4948
`local_${process.env.USER}_${new Date().getTime()}`;
5049

5150
/**
@@ -67,26 +66,36 @@ async function runTest(testFile) {
6766
});
6867
}
6968
}
69+
if (testFile.includes('integration/firestore')) {
70+
let exitCode = 0;
71+
await spawn('yarn', ['--cwd', 'integration/firestore', 'build:memory'], { stdio: 'inherit' });
72+
await runKarma(testFile);
73+
await spawn('yarn', ['--cwd', 'integration/firestore', 'build:persistence'], { stdio: 'inherit' });
74+
return runKarma(testFile);
75+
}
76+
return runKarma(testFile);
77+
}
7078

71-
const promise = spawn('yarn', [
72-
'test:saucelabs:single',
79+
async function runKarma(testFile) {
80+
const karmaArgs = [
81+
'karma',
82+
'start',
83+
'config/karma.saucelabs.js',
84+
'--single-run',
7385
'--testConfigFile',
7486
testFile,
7587
'--buildNumber',
7688
buildNumber
77-
]);
89+
];
90+
91+
if (testFile.includes('packages/firestore')) {
92+
// Firestore requires this flag to run unit tests only.
93+
karmaArgs.push('--unit');
94+
}
95+
const promise = spawn('npx', karmaArgs, { stdio: 'inherit' });
7896
const childProcess = promise.childProcess;
7997
let exitCode = 0;
8098

81-
childProcess.stdout.on('data', data => {
82-
console.log(`[${testFile}]:`, data.toString());
83-
});
84-
85-
// Lerna's normal output goes to stderr for some reason.
86-
childProcess.stderr.on('data', data => {
87-
console.log(`[${testFile}]:`, data.toString());
88-
});
89-
9099
// Capture exit code of this single package test run
91100
childProcess.on('exit', code => {
92101
exitCode = code;

0 commit comments

Comments
 (0)