Skip to content

Commit cb48b7f

Browse files
committed
in flux
1 parent f8e4236 commit cb48b7f

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

lib/event_processor/event_processor_factory.react_native.spec.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,15 @@ vi.mock('@react-native-community/netinfo', () => {
5555
});
5656
let isAsyncStorageAvailable = true;
5757

58-
await vi.hoisted(async () => {
59-
await mockRequireNetInfo();
58+
// Mock Node.js module loader to simulate missing @react-native-async-storage/async-storage
59+
vi.hoisted(() => {
60+
mockRequireNetInfo();
6061
});
6162

62-
async function mockRequireNetInfo() {
63-
const { Module } = await import('module');
63+
function mockRequireNetInfo() {
64+
// Dynamically import module synchronously in Node environment
65+
// eslint-disable-next-line @typescript-eslint/no-var-requires
66+
const { Module } = require('module');
6467
const M: any = Module;
6568

6669
M._load_original = M._load;

lib/project_config/config_manager_factory.react_native.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616

1717
import { describe, it, expect, beforeEach, vi } from 'vitest';
1818

19-
await vi.hoisted(async () => {
20-
await mockRequireAsyncStorage();
19+
vi.hoisted(async () => {
20+
mockRequireAsyncStorage();
2121
});
2222

2323
let isAsyncStorageAvailable = true;
2424

25-
async function mockRequireAsyncStorage() {
26-
const { Module } = await import('module');
25+
function mockRequireAsyncStorage() {
26+
const { Module } = require('module');
2727
const M: any = Module;
2828

2929
M._load_original = M._load;

tsconfig.spec.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"typeRoots": [
88
"./node_modules/@types"
99
],
10-
"target": "ESNext"
1110
},
1211
"exclude": [
1312
"./dist",

vitest.config.mts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
import path from 'path';
1716
import { defineConfig } from 'vitest/config'
1817
import tsconfigPaths from 'vite-tsconfig-paths'
1918

@@ -23,6 +22,10 @@ export default defineConfig({
2322
projects: ['./tsconfig.spec.json'],
2423
})
2524
],
25+
esbuild: {
26+
target: 'es6', // Match tsconfig.json target
27+
format: 'esm', // Match tsconfig.json module: ESNext
28+
},
2629
test: {
2730
onConsoleLog: () => true,
2831
environment: 'happy-dom',

0 commit comments

Comments
 (0)