# mocha-mobile

> Test a node.js library on mobile devices with Mocha

Latest version **0.0.7** (published 2018-11-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install mocha-mobile
pnpm add mocha-mobile
yarn add mocha-mobile
bun add mocha-mobile
```

Provides the command `mocha-mobile`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; large bundle; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2018-11-16 |
| First published | 2018-11-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 104.6 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | areth |
| Keywords | mobile, test, mocha, android, ios, native |

## Links

- npm: https://www.npmjs.com/package/mocha-mobile
- Repository: https://github.com/areth/mocha-mobile
- Homepage: https://github.com/areth/mocha-mobile#readme
- Issues: https://github.com/areth/mocha-mobile/issues
- npm.io page: https://npm.io/package/mocha-mobile

## Dependencies (4)

- [glob](https://npm.io/package/glob.md) ^7.1.3
- [mocha](https://npm.io/package/mocha.md) ^5.2.0
- [archiver](https://npm.io/package/archiver.md) ^3.0.0
- [commander](https://npm.io/package/commander.md) ^2.19.0

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 0.0.7 (latest) — 2018-11-16
- 0.0.6 — 2018-11-16
- 0.0.5 — 2018-11-15
- 0.0.3 — 2018-11-15
- 0.0.2 — 2018-11-09

## README

# mocha-mobile
Test Node.js applications on mobile devices.

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](https://developer.android.com/studio/install.html) 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](https://github.com/phonegap/ios-deploy) for installing and running the test app. You can install it by using npm:
```sh
npm install -g ios-deploy@1.9.2
```

## Installation
mocha-mobile have to be installed locally
```sh
npm i --save-dev mocha-mobile
```
## Run tests
Quick example
```sh
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](LICENSE.md) file for details

---
_Source: https://npm.io/package/mocha-mobile · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
