# @lite-js/torch

> test framework to light up the world

Latest version **0.2.6** (published 2017-08-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @lite-js/torch
pnpm add @lite-js/torch
yarn add @lite-js/torch
bun add @lite-js/torch
```

Provides the commands `torch`, `torch-coverage`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.6 |
| Published | 2017-08-11 |
| First published | 2017-07-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 14 |
| Known vulnerabilities | 0 (+62 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | laispace, leungwensen |
| Keywords | torch, electron, mocha, test, framework |

## Links

- npm: https://www.npmjs.com/package/@lite-js/torch
- Repository: https://github.com/lite-js/torch
- Homepage: https://github.com/lite-js/torch#readme
- Issues: https://github.com/lite-js/torch/issues
- npm.io page: https://npm.io/package/@lite-js/torch

## Dependencies (14)

- [glob](https://npm.io/package/glob.md) ^7.1.2
- [mocha](https://npm.io/package/mocha.md) ^3.4.2
- [which](https://npm.io/package/which.md) ^1.2.14
- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [chokidar](https://npm.io/package/chokidar.md) ^1.7.0
- [electron](https://npm.io/package/electron.md) ~1.6.11
- [istanbul](https://npm.io/package/istanbul.md) ^0.4.5
- [commander](https://npm.io/package/commander.md) ^2.9.0
- [minimatch](https://npm.io/package/minimatch.md) ^3.0.4
- [babel-core](https://npm.io/package/babel-core.md) ^6.25.0
- [node-notifier](https://npm.io/package/node-notifier.md) ^5.1.2
- [babel-register](https://npm.io/package/babel-register.md) ^6.24.1
- [source-map-support](https://npm.io/package/source-map-support.md) ^0.4.15
- [is-electron-renderer](https://npm.io/package/is-electron-renderer.md) ^2.0.1

## 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
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 0.2.6 (latest) — 2017-08-11
- 0.2.5 — 2017-08-06
- 0.2.3 — 2017-08-06
- 0.2.2 — 2017-08-05
- 0.2.1 — 2017-08-05
- 0.2.0 — 2017-07-31
- 0.2.0-beta2 — 2017-07-28
- 0.2.0-beta1 — 2017-07-28
- 0.2.0-beta0 — 2017-07-27
- 0.1.6 — 2017-07-18
- 0.1.5 — 2017-07-13
- 0.1.4 — 2017-07-12
- 0.1.3 — 2017-07-12
- 0.1.2 — 2017-07-12
- 0.1.1 — 2017-07-12
- … 5 more at https://npm.io/package/@lite-js/torch/versions

## README

torch
=====

[![NPM version][npm-image]][npm-url] [![build status][travis-image]][travis-url] [![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/@lite-js/torch.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@lite-js/torch
[travis-image]: https://img.shields.io/travis/@lite-js/torch.svg?style=flat-square
[travis-url]: https://travis-ci.org/@lite-js/torch
[download-image]: https://img.shields.io/npm/dm/@lite-js/torch.svg?style=flat-square
[download-url]: https://npmjs.org/package/@lite-js/torch

---

Test framework to light up the world.

## install

``` bash
$ npm install @lite-js/torch [-g]
```

## use

### main process

``` bash
$ torch test/main
```

### renderer process

``` bash
$ torch --renderer test/renderer
```

### interactive mode (you can re-run tests by CMD+R)

``` bash
$ torch --interative test/renderer
```

> watching source files

``` bash
$ torch --interactive --watch test/renderer
```

### view code coverage

``` bash
$ torch --coverage test/main && torch-coverage
```

### + overalls

``` bash
$ torch --coverage test/main && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage
```

### specify source files (for watching / code coverage)

> interactive mode

``` bash
$ torch --interactive --watch --source-pattern src/**/*.js test/renderer
```

> code coverage

``` bash
$ torch --coverage --source-pattern src/**/*.js test/main && torch-coverage
```

## options

``` bash
$ torch --help

  Usage: torch [options]

  Options:

    -h, --help                              output usage information
    -V, --version                           output the version number
    -C, --no-colors                         force disabling of colors
    -O, --reporter-options <k=v,k2=v2,...>  reporter-specific options
    -R, --reporter <name>                   specify the reporter to use
    -S, --sort                              sort test files
    -b, --bail                              bail after first test failure
    -g, --grep <pattern>                    only run tests matching <pattern>
    -f, --fgrep <string>                    only run tests containing <string>
    -i, --invert                            inverts --grep and --fgrep matches
    -r, --require <name>                    require the given module
    -s, --slow <ms>                         "slow" test threshold in milliseconds [75]
    -t, --timeout <ms>                      set test-case timeout in milliseconds [2000]
    -u, --ui <name>                         specify user-interface (bdd|tdd|exports)
    --check-leaks                           check for global variable leaks
    --compile                               compile with babel
    --compile-opts <path>                   path of compile options
    --compilers <ext>:<module>,...          use the given module(s) to compile files
    --coverage                              report coverage
    --debug                                 enable Electron debugger on port [5858]; for --renderer tests show window and dev-tools
    --debug-brk                             like --debug but pauses the script on the first line
    --globals <names>                       allow the given comma-delimited global [names]
    --inline-diffs                          display actual/expected differences inline within each string
    --interactive                           run tests in renderer process in a visible window that can be reloaded to re-run tests
    --interfaces                            display available interfaces
    --no-timeouts                           disables timeouts
    --notify-on-fail                        notify on failures
    --opts <path>                           specify opts path
    --preload <name>                        preload the given script in renderer process
    --recursive                             include sub directories
    --renderer                              run tests in renderer process
    --require-main <name>                   load the given script in main process before executing tests
    --source-pattern <sources>              glob pattern of source files
    --watch                                 watching source file changes
    --watch-aggregate-timeout               delay time for re-run test cases after files changed
```

### --compile-opts <path>

> experimental

specify a js file providing compile options. default path is `${process.cwd()}/.torch.compile.opts.js`

```javascript
module.exports = {
  babelrc: { // babelrc
    presets: [
      'es2015',
      'stage-0'
    ],
    sourceMaps: 'inline'
  },
  extensions: ['.es6', '.es', '.jsx', '.js'],
  include: [ // glob expressions to detect files to include
    'index.js',
    'lib/**/*.js',
    'src/**/*.js'
  ],
  exclude: [ // glob expressions to detect files to exclude
    'bower_components/**',
    'node_modules/**'
  ]
}
```

## trouble shooting

### using on Travis

Your .travis.yml will need two extra lines of configuration to run this headless on Travis:

``` yaml
before_script:
  - export DISPLAY=:99.0; sh -e /etc/init.d/xvfb start
```

## thanks to

The original idea and most of the code are stolen from [electron-mocha](https://github.com/jprichardson/electron-mocha), actually you can say that `torch` is created by adding features onto `electron-mocha`.

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