# mock20

> A Roll20 nodejs mocker.

Latest version **1.3.1** (published 2017-10-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install mock20
pnpm add mock20
yarn add mock20
bun add mock20
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.1 |
| Published | 2017-10-13 |
| First published | 2017-08-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Kyle Smith |
| Maintainers | kyledavidady |
| Keywords | Roll20, mocker |

## Links

- npm: https://www.npmjs.com/package/mock20
- Repository: https://github.com/kyleady/Mock20
- Homepage: https://github.com/kyleady/Mock20#readme
- Issues: https://github.com/kyleady/Mock20/issues
- npm.io page: https://npm.io/package/mock20

## Dependencies (1)

- [underscore](https://npm.io/package/underscore.md) ^1.8.3

## Recent versions

- 1.3.1 (latest) — 2017-10-13
- 1.3.0 — 2017-09-26
- 1.2.0 — 2017-08-27
- 1.1.0 — 2017-08-21
- 1.0.3 — 2017-08-18
- 1.0.2 — 2017-08-09
- 1.0.1 — 2017-08-09
- 1.0.0 — 2017-08-08

## README

# Mock20

[![Build Status](https://travis-ci.org/kyleady/Mock20.svg?branch=master)](https://travis-ci.org/kyleady/Mock20) [![Coverage Status](https://coveralls.io/repos/github/kyleady/Mock20/badge.svg?branch=master)](https://coveralls.io/github/kyleady/Mock20?branch=master) [![dependencies Status](https://david-dm.org/kyleady/Mock20/status.png)](https://david-dm.org/kyleady/Mock20)


A [node.js](https://nodejs.org/en/) module that mocks the [Roll20](https://roll20.net/) API environment.

For an exmple Roll20 project that uses Mock20, see [Example Mock20 Testing](https://github.com/kyleady/Example-Mock20-Testing).

## Installation

1) Get [node and npm](https://www.npmjs.com/get-npm).

2) Turn your scripts into a [node module](https://docs.npmjs.com/getting-started/creating-node-modules).

3) Add mock20 as a dependency.

    `npm install mock20`

4) Require mock20 and signal the end of your scripts.

    ```
    require('mock20');
     
    //your script here
    
    MOCK20endOfLastScript(); //triggers all of your on('ready') functions
    ```
## Mocking

Mock20 mocks all of the functions listed in the Roll20 API wiki.

See the [wiki](https://github.com/kyleady/Mock20/wiki) for more information.

* [API:Objects](https://github.com/kyleady/Mock20/wiki/API_Objects)
* [API:Events](https://github.com/kyleady/Mock20/wiki/API_Events)
* [API:Chat](https://github.com/kyleady/Mock20/wiki/API_Chat)
  * **WARNING**: The current version of Mock20 does not parse rolls like `'/r D20'`
  * **WARNING**: The current version of Mock20 does not parse inlines like  `'Rolls a [[D20]]'`
* [API:Utility](https://github.com/kyleady/Mock20/wiki/API_Utility)

## Simulating

Mock20 can simulate circumstances you may want to test.

See the [wiki](https://github.com/kyleady/Mock20/wiki) for more information.

```
var player = createObj('player', {_displayname: 'test player'}, {MOCK20override: true});
var gm = createObj('player', {_displayname: 'test gm'}, {MOCK20override: true});
gm.MOCK20gm = true;

player.MOCK20chat('!gmOnlyCMD');
gm.MOCK20chat('!gmOnlyCMD');
```

## Issues

If you have any issues with Mock20 please report them through github's [issues](https://github.com/kyleady/Mock20/issues).

## Contributing

If you would like to contribute to the project, open up a fork and work away.

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