File tree Expand file tree Collapse file tree 4 files changed +22
-24
lines changed Expand file tree Collapse file tree 4 files changed +22
-24
lines changed Original file line number Diff line number Diff line change @@ -19,10 +19,11 @@ const path = require('path');
19
19
const webpack = require ( 'webpack' ) ;
20
20
21
21
/**
22
- * A regular expression used to replace Firestore's platform specific modules,
23
- * which are located under 'packages/firestore/src/platform/'.
22
+ * A regular expression used to replace Firestore's and Storage's platform-
23
+ * specific modules, which are located under
24
+ * 'packages/(component)/src/platform/'.
24
25
*/
25
- const FIRESTORE_PLATFORM_RE = / ^ ( .* ) \/ p l a t f o r m \/ ( [ ^ . \/ ] * ) ( \. t s ) ? $ / ;
26
+ const PLATFORM_RE = / ^ ( .* ) \/ p l a t f o r m \/ ( [ ^ . \/ ] * ) ( \. t s ) ? $ / ;
26
27
27
28
module . exports = {
28
29
mode : 'development' ,
@@ -100,16 +101,13 @@ module.exports = {
100
101
symlinks : false
101
102
} ,
102
103
plugins : [
103
- new webpack . NormalModuleReplacementPlugin (
104
- FIRESTORE_PLATFORM_RE ,
105
- resource => {
106
- const targetPlatform = process . env . TEST_PLATFORM || 'browser' ;
107
- resource . request = resource . request . replace (
108
- FIRESTORE_PLATFORM_RE ,
109
- `$1/platform/${ targetPlatform } /$2.ts`
110
- ) ;
111
- }
112
- ) ,
104
+ new webpack . NormalModuleReplacementPlugin ( PLATFORM_RE , resource => {
105
+ const targetPlatform = process . env . TEST_PLATFORM || 'browser' ;
106
+ resource . request = resource . request . replace (
107
+ PLATFORM_RE ,
108
+ `$1/platform/${ targetPlatform } /$2.ts`
109
+ ) ;
110
+ } ) ,
113
111
new webpack . EnvironmentPlugin ( [
114
112
'RTDB_EMULATOR_PORT' ,
115
113
'RTDB_EMULATOR_NAMESPACE'
Original file line number Diff line number Diff line change @@ -31,7 +31,6 @@ module.exports = function (config) {
31
31
} ;
32
32
33
33
function getTestFiles ( argv ) {
34
- process . env . TEST_PLATFORM = 'browser' ;
35
34
let unitTestFiles = [ 'test/unit/*' ] ;
36
35
let integrationTestFiles = [ ] ;
37
36
if ( argv . exp ) {
Original file line number Diff line number Diff line change 15
15
* limitations under the License.
16
16
*/
17
17
18
- // This file is only used under ts-node.
19
- // eslint-disable-next-line @typescript-eslint/no-require-imports
20
- const platform = require ( `./${ process . env . TEST_PLATFORM ?? 'node' } /base64` ) ;
18
+ import {
19
+ decodeUint8Array as nodeDecodeUint8Array ,
20
+ decodeBase64 as nodeDecodeBase64
21
+ } from './node/base64' ;
21
22
22
23
/** Converts a Base64 encoded string to a binary string. */
23
24
export function decodeBase64 ( encoded : string ) : string {
24
- return platform . decodeBase64 ( encoded ) ;
25
+ // This file is only used under ts-node.
26
+ return nodeDecodeBase64 ( encoded ) ;
25
27
}
26
28
27
29
/** Converts a Uint8Array to a string. */
28
30
export function decodeUint8Array ( data : Uint8Array ) : string {
29
- return platform . decodeUint8Array ( data ) ;
31
+ // This file is only used under ts-node.
32
+ return nodeDecodeUint8Array ( data ) ;
30
33
}
Original file line number Diff line number Diff line change 15
15
* limitations under the License.
16
16
*/
17
17
import { Connection } from '../implementation/connection' ;
18
-
19
- // This file is only used under ts-node.
20
- // eslint-disable-next-line @typescript-eslint/no-require-imports
21
- const platform = require ( `./${ process . env . TEST_PLATFORM ?? 'node' } /connection` ) ;
18
+ import { newConnection as nodeNewConnection } from './node/connection' ;
22
19
23
20
export function newConnection ( ) : Connection {
24
- return platform . newConnection ( ) ;
21
+ // This file is only used under ts-node.
22
+ return nodeNewConnection ( ) ;
25
23
}
You can’t perform that action at this time.
0 commit comments