Git Product home page Git Product logo

mocha-mobile's Introduction

mocha-mobile

Test Node.js applications on mobile devices with Mocha.

Mocha-mobile runs mocha-compatible tests within a mobile device.

Supports only Android for now.

Prerequisites

Android

You'll need a macOS or Linux development machine, and a physical Android device.

You'll need Android Studio installed on your development Machine, alongside Java, Gradle, the Android 8.0 (Android SDK Platform 26), Android SDK Build Tools v26.0.1, Android SDK Tools, Android SDK Platform-Tools, NDK version >=17 and CMake.

You should set the Environment variables required to build Android Applications from the command line: the ANDROID_HOME variable pointing to your android-sdk path and the ANDROID_NDK_HOME variable pointing to the installed NDK path (it usually is $ANDROID_HOME/ndk-bundle) . You should also add $ANDROID_HOME/platform-tools, $ANDROID_HOME/tools and $ANDROID_HOME/tools/bin to the PATH environment variable.

iOS

You'll need a macOS development machine, an iOS arm64 physical device running iOS 11.0 or greater and a valid iOS Development certificate installed.

iOS tests depend on the ios-deploy tool for installing and running the test app. You can install it by using npm:

npm install -g [email protected]

Installation

mocha-mobile have to be installed locally

npm i --save-dev mocha-mobile

Run tests

Quick example

mocha-mobile -a android --timeout 10000

Mocha-mobile CLI inherits Mocha CLI with additional parameters:

-a, --arch <architecture> - Required. Architecture to run test (android|ios).
--ignore <pattern> - Files pattern to ignore during mobile app assembling. Like `**/build/*`.
--onlyprep - Only prepare test, don't run it
--onlyrun - Only run test, don't prepare it (test has to be prepared)

Additional file exceptions may be specified in .mmignore

How it works

It uses precompiled libraries for mobile devices to run node.js code. Mocha-mobile command proceeds the following steps:

  • deploys native app with precompiled library and Node.js application as a zipped asset to a device
  • unzips a Node.js application within device and executes Mocha over it
  • displays tests results in a host terminal

License

This project is licensed under the MIT License - see the LICENSE.md file for details

mocha-mobile's People

Contributors

areth avatar

Watchers

 avatar

mocha-mobile's Issues

Try to test inplace

Try not to use separate repo for testing. Exclude testing artifacts with gradle.build.

Recompile mobile app only if necessary

Must have an app directory snapshot to compare when next test is running. Something like .mobile-test-files file with only files/folders names and its modification dates.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.