Skip to content

Commit d934f74

Browse files
Remove now duplicate firestore-exp test run (#4073)
1 parent 0c4f794 commit d934f74

File tree

5 files changed

+20
-185
lines changed

5 files changed

+20
-185
lines changed

packages/firestore/exp/test/bootstrap.ts

Lines changed: 0 additions & 35 deletions
This file was deleted.

packages/firestore/exp/test/shim.ts

Lines changed: 0 additions & 67 deletions
This file was deleted.

packages/firestore/package.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,9 @@
2929
"test:lite:prod": "node ./scripts/run-tests.js --platform node_lite --main=lite/index.ts 'lite/test/**/*.test.ts'",
3030
"test:lite:browser": "karma start --single-run --lite",
3131
"test:lite:browser:debug": "karma start --browsers=Chrome --lite --auto-watch",
32-
"test:exp": "node ./scripts/run-tests.js --emulator --main=exp/index.ts test/integration/api/*.test.ts",
33-
"test:exp:prod": "node ./scripts/run-tests.js --main=exp/index.ts test/integration/api/*.test.ts",
34-
"test:exp:persistence": "node ./scripts/run-tests.js --emulator --persistence --main=exp/index.ts test/integration/api/*.test.ts",
35-
"test:exp:persistence:prod": "node ./scripts/run-tests.js --persistence --main=exp/index.ts test/integration/api/*.test.ts",
36-
"test:exp:browser": "karma start --single-run --exp",
37-
"test:exp:browser:debug": "karma start --browsers=Chrome --exp --auto-watch",
3832
"test": "run-s lint test:all",
3933
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all",
40-
"test:all": "run-p test:browser test:lite:browser test:exp:browser test:travis test:minified",
34+
"test:all": "run-p test:browser test:lite:browser test:travis test:minified",
4135
"test:browser": "karma start --single-run",
4236
"test:browser:debug": "karma start --browsers=Chrome --auto-watch",
4337
"test:node": "node ./scripts/run-tests.js --main=index.node.ts --emulator 'test/{,!(browser)/**/}*.test.ts'",

packages/firestore/test/integration/util/firebase_export.ts

Lines changed: 19 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -15,43 +15,22 @@
1515
* limitations under the License.
1616
*/
1717

18-
// Imports firebase via the raw sources and re-exports it.
19-
// This file exists for two reasons:
20-
// - It serves as a single entry point to all Firebase types and can return
21-
// the leagcy SDK types directly (if `firebase.firestore` exists), or wrapping
22-
// types that use the firebase-exp SDK.
23-
// - It can be replaced by the "<repo-root>/integration/firestore" test suite
24-
// with a reference to the minified sources.
25-
//
26-
// If you change any exports in this file, you need to also adjust
27-
// "integration/firestore/firebase_export.ts".
18+
// Imports firebase via the raw sources and re-exports it. The
19+
// "<repo-root>/integration/firestore" test suite replaces this file with a
20+
// reference to the minified sources. If you change any exports in this file,
21+
// you need to also adjust "integration/firestore/firebase_export.ts".
2822

2923
import * as firestore from '@firebase/firestore-types';
3024

3125
import firebase from '@firebase/app';
32-
// eslint-disable-next-line import/no-extraneous-dependencies
33-
import firebaseAppCompat from '@firebase/app-compat';
3426

35-
import * as exp from '../../../exp/test/shim';
3627
import { FieldValue } from '../../../src/compat/field_value';
3728
import { FieldPath } from '../../../src/api/field_path';
29+
import { Timestamp } from '../../../src/api/timestamp';
30+
import { Blob } from '../../../src/api/blob';
31+
import { GeoPoint } from '../../../src/api/geo_point';
3832
import { FirebaseApp } from '@firebase/app-types';
39-
import {
40-
Firestore,
41-
IndexedDbPersistenceProvider
42-
} from '../../../src/api/database';
43-
import { getFirestore } from '../../../exp/src/api/database';
44-
45-
/**
46-
* Detects whether we are running against the functionial (tree-shakeable)
47-
* Firestore API. Used to exclude some tests, e.g. those that validate invalid
48-
* TypeScript input.
49-
*/
50-
function usesFunctionalApi(): boolean {
51-
// Use the firebase namespace to detect if `firebase.firestore` has been
52-
// registered, which is only registered in the classic version of Firestore.
53-
return !('firestore' in firebase);
54-
}
33+
import { Firestore } from '../../../src/api/database';
5534

5635
// TODO(dimond): Right now we create a new app and Firestore instance for
5736
// every test and never clean them up. We may need to revisit.
@@ -70,56 +49,22 @@ export function newTestFirestore(
7049
nameOrApp = 'test-app-' + appCount++;
7150
}
7251

73-
let firestore: firestore.FirebaseFirestore;
74-
if (usesFunctionalApi()) {
75-
const app =
76-
typeof nameOrApp === 'string'
77-
? firebaseAppCompat.initializeApp(
78-
{
79-
apiKey: 'fake-api-key',
80-
projectId
81-
},
82-
nameOrApp
83-
)
84-
: nameOrApp;
85-
86-
firestore = new Firestore(
87-
app,
88-
getFirestore(app),
89-
new IndexedDbPersistenceProvider()
90-
);
91-
} else {
92-
const app =
93-
typeof nameOrApp === 'string'
94-
? firebase.initializeApp(
95-
{
96-
apiKey: 'fake-api-key',
97-
projectId
98-
},
99-
nameOrApp
100-
)
101-
: nameOrApp;
102-
103-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
104-
firestore = (firebase as any).firestore(app);
105-
}
52+
const app =
53+
typeof nameOrApp === 'string'
54+
? firebase.initializeApp(
55+
{
56+
apiKey: 'fake-api-key',
57+
projectId
58+
},
59+
nameOrApp
60+
)
61+
: nameOrApp;
62+
const firestore = firebase.firestore(app);
10663

10764
if (settings) {
10865
firestore.settings(settings);
10966
}
11067
return firestore;
11168
}
11269

113-
// We only register firebase.firestore if the tests are run against the
114-
// legacy SDK. To prevent a compile-time error with the firestore-exp
115-
// SDK, we cast to `any`.
116-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
117-
const legacyNamespace = (firebase as any).firestore;
118-
119-
const Timestamp = usesFunctionalApi()
120-
? exp.Timestamp
121-
: legacyNamespace.Timestamp;
122-
const GeoPoint = usesFunctionalApi() ? exp.GeoPoint : legacyNamespace.GeoPoint;
123-
const Blob = usesFunctionalApi() ? exp.Blob : legacyNamespace.Blob;
124-
12570
export { Firestore, FieldValue, FieldPath, Timestamp, Blob, GeoPoint };

scripts/emulator-testing/firestore-test-runner.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,11 @@ function runTest(port: number, projectId: string, withPersistence: boolean) {
4343
if (withPersistence) {
4444
childProcesses.push(
4545
spawn('yarn', ['test:node:persistence:prod'], options),
46-
spawn('yarn', ['test:exp:persistence:prod'], options),
4746
spawn('yarn', ['test:lite:prod'], options)
4847
);
4948
} else {
5049
childProcesses.push(
5150
spawn('yarn', ['test:node:prod'], options),
52-
spawn('yarn', ['test:exp:prod'], options),
5351
spawn('yarn', ['test:lite:prod'], options)
5452
);
5553
}

0 commit comments

Comments
 (0)