Skip to content

Commit

Permalink
More v19 enhancements (#3586)
Browse files Browse the repository at this point in the history
* Pending tasks and data-connect
* Migrating to pendingUntilEvent
* Starting to refactor test suite
* Bumping eslint
* Disabiling compat/firestore tests for now
  • Loading branch information
jamesdaniels authored Dec 11, 2024
1 parent a58b329 commit e18d8da
Show file tree
Hide file tree
Showing 58 changed files with 6,940 additions and 824 deletions.
18 changes: 17 additions & 1 deletion firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,21 @@
"ui": {
"enabled": false
}
}
},
"functions": [
{
"source": "test/functions",
"codebase": "default",
"ignore": [
"node_modules",
".git",
"firebase-debug.log",
"firebase-debug.*.log",
"*.local"
],
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run build"
]
}
]
}
26 changes: 24 additions & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,22 @@ const dns = require('node:dns');
// The emulator suite fails in CI, only on Node 18.
// This apparently fixes it.
// https://github.com/firebase/firebase-tools/issues/5755#issuecomment-1535445383
dns.setDefaultResultOrder('ipv4first')
dns.setDefaultResultOrder('ipv4first');

let firestoreEmulatorPort, storageEmulatorPort, authEmulatorPort, databaseEmulatorPort, functionsEmulatorPort;
if (process.env.FIRESTORE_EMULATOR_HOST &&
process.env.STORAGE_EMULATOR_HOST &&
process.env.FIREBASE_AUTH_EMULATOR_HOST &&
process.env.FIREBASE_DATABASE_EMULATOR_HOST) {
firestoreEmulatorPort = parseInt(process.env.FIRESTORE_EMULATOR_HOST.split(":")[1], 10); // '127.0.0.1:9098'
storageEmulatorPort = parseInt(process.env.STORAGE_EMULATOR_HOST.split(":")[2], 10); // 'http://127.0.0.1:9199'
authEmulatorPort = parseInt(process.env.FIREBASE_AUTH_EMULATOR_HOST.split(":")[1], 10); // '127.0.0.1:9098'
databaseEmulatorPort = parseInt(process.env.FIREBASE_DATABASE_EMULATOR_HOST.split(":")[1], 10); // '127.0.0.1:9002'
functionsEmulatorPort = 5001; // TODO figure out why this env variable isn't present
} else {
console.error("Missing emulator environments variables");
process.exit(1);
}

// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
Expand All @@ -21,7 +36,14 @@ module.exports = function (config) {
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
clearContext: false, // leave Jasmine Spec Runner output visible in browser
args: [
["FIRESTORE_EMULATOR_PORT", firestoreEmulatorPort],
["DATABASE_EMULATOR_PORT", databaseEmulatorPort],
["STORAGE_EMULATOR_PORT", storageEmulatorPort],
["AUTH_EMULATOR_PORT", authEmulatorPort],
["FUNCTIONS_EMULATOR_PORT", functionsEmulatorPort],
],
},
coverageIstanbulReporter: {
dir: `${process.cwd()}/coverage`,
Expand Down
38 changes: 21 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"private": true,
"scripts": {
"test": "npm run build:jasmine && npm run test:node-esm && npm run test:chrome-headless",
"test:watch": "npx --yes firebase-tools@latest emulators:exec --project=demo123 \"ng test --watch=true --browsers=Chrome\"",
"test:chrome": "npx --yes firebase-tools@latest emulators:exec --project=demo123 \"ng test --watch=false --browsers=Chrome\"",
"test:firefox": "npx --yes firebase-tools@latest emulators:exec --project=demo123 \"ng test --watch=false --browsers=Firefox\"",
"test:safari": "npx --yes firebase-tools@latest emulators:exec --project=demo123 \"ng test --watch=false --browsers=SafariNative\"",
"test:chrome-headless": "npx --yes firebase-tools@latest emulators:exec --project=demo123 \"ng test --watch=false --browsers=ChromeHeadless\"",
"test:firefox-headless": "npx --yes firebase-tools@latest emulators:exec --project=demo123 \"ng test --watch=false --browsers=FirefoxHeadless\"",
"test:watch": "npx --yes firebase-tools@latest emulators:exec --project=demo-123 \"ng test --watch=true --browsers=Chrome\"",
"test:chrome": "npx --yes firebase-tools@latest emulators:exec --project=demo-123 \"ng test --watch=false --browsers=Chrome\"",
"test:firefox": "npx --yes firebase-tools@latest emulators:exec --project=demo-123 \"ng test --watch=false --browsers=Firefox\"",
"test:safari": "npx --yes firebase-tools@latest emulators:exec --project=demo-123 \"ng test --watch=false --browsers=SafariNative\"",
"test:chrome-headless": "npx --yes firebase-tools@latest emulators:exec --project=demo-123 \"ng test --watch=false --browsers=ChromeHeadless\"",
"test:firefox-headless": "npx --yes firebase-tools@latest emulators:exec --project=demo-123 \"ng test --watch=false --browsers=FirefoxHeadless\"",
"lint": "ng lint",
"test:node": "node -r tsconfig-paths/register ./dist/out-tsc/jasmine/tools/jasmine.mjs --input-type=commonjs",
"test:node-esm": "node -r tsconfig-paths/register ./dist/out-tsc/jasmine/tools/jasmine.mjs",
Expand Down Expand Up @@ -75,8 +75,8 @@
},
"devDependencies": {
"@angular-devkit/build-angular": "^19.0.0",
"@angular-eslint/builder": "19.0.0-alpha.0",
"@angular-eslint/eslint-plugin": "19.0.0-alpha.0",
"@angular-eslint/builder": "^19.0.0",
"@angular-eslint/eslint-plugin": "^19.0.0",
"@angular/animations": "^19.0.0",
"@angular/cli": "^19.0.0",
"@angular/compiler-cli": "^19.0.0",
Expand Down
4 changes: 2 additions & 2 deletions samples/advanced/src/app/app-check/app-check.component.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions samples/advanced/src/app/storage/storage.component.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions samples/advanced/src/app/upboats/lazyFirestore.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions samples/modular/src/app/app-check/app-check.component.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions samples/modular/src/app/storage/storage.component.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/auth/auth.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TestBed } from '@angular/core/testing';
import { FirebaseApp, getApp, initializeApp, provideFirebaseApp } from '@angular/fire/app';
import { Auth, connectAuthEmulator, getAuth, provideAuth } from '@angular/fire/auth';
import { COMMON_CONFIG } from '../test-config';
import { COMMON_CONFIG, authEmulatorPort } from '../test-config';
import { rando } from '../utils';

describe('Auth', () => {
Expand All @@ -19,7 +19,7 @@ describe('Auth', () => {
provideFirebaseApp(() => initializeApp(COMMON_CONFIG, appName)),
provideAuth(() => {
providedAuth = getAuth(getApp(appName));
connectAuthEmulator(providedAuth, 'http://localhost:9099');
connectAuthEmulator(providedAuth, `http://localhost:${authEmulatorPort}`);
return providedAuth;
}),
],
Expand Down
Loading

0 comments on commit e18d8da

Please sign in to comment.