How to use the mocha-remote-server.MochaRemoteServer.DEFAULT_CONFIG function in mocha-remote-server

To help you get started, weโ€™ve selected a few mocha-remote-server examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github realm / realm-js / integration-tests / environments / react-native / harness / runner.js View on Github external
// Close the runner if metro closes unexpectedly
    metro.on("close", (code) => {
        if (code !== 0) {
            console.error(`Metro server unexpectedly closed (code = ${code})`);
            process.exit(code);
        }
    });

    if (platform === "android") {
        const devices = android.adb.devices();
        const activeDevices = devices.filter(({ state }) => state === "device");
        if (activeDevices.length === 0) {
            throw new Error("Missing an active device: Attach a device via USB or start an emulator");
        } else {
            // Ensure the device can access the mocha remote server
            android.adb.reverseServerPort(MochaRemoteServer.DEFAULT_CONFIG.port);
        }
        // Ask React Native to run the android app
        rn.sync("run-android", "--no-packager");
    } else if (platform === "ios") {
        const deviceName = "realm-js-integration-tests";
        ensureSimulator(deviceName, 'com.apple.CoreSimulator.SimDeviceType.iPhone-11');
        console.log("Simulator is ready ๐Ÿš€");
        // Ask React Native to run the ios app
        rn.sync("run-ios", "--no-packager", "--simulator", deviceName);
    } else {
        throw new Error(`Unexpected platform: '${platform}'`);
    }

    // Run tests with a 5 minute timeout
    return timeout(new Promise((resolve) => {
        console.log("Running tests ๐Ÿƒโ€โ™‚๏ธ");

mocha-remote-server

Run Mocha tests somewhere - get reporting elsewhere

ISC
Latest version published 2 months ago

Package Health Score

70 / 100
Full package analysis