torchjs for @antv.
Last updated a year ago by atool .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @antv/torch 
SYNC missed versions from official npm registry.


Test framework to light up the world.


$ npm install torchjs -g


Main process

$ torch test/main

Renderer process

$ torch --renderer test/renderer

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

$ torch --interative test/renderer

watching source files

$ torch --interactive --watch test/renderer

View code coverage

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

+ Overalls

$ 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

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

code coverage

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


$ torch --help

  Usage: torch [options]


    -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 (default: spec)
    -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 (default: )
    -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) (default: bdd)
    --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 (default: )
    --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
    --dom-global                            enable DOM in Node.js by using jsdom-global
    --dom-global-loose                      enable DOM in Node.js, while window can be modified
    --globals <names>                       allow the given comma-delimited global [names] (default: )
    --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
    --notify-on-success                     notify on success
    --opts <path>                           specify opts path (default: __tests__/mocha.opts)
    --preload <name>                        preload the given script in renderer process (default: )
    --recursive                             include sub directories
    --renderer                              run tests in renderer process
    --require-main <name>                   load the given script in main process before executing tests (default: )
    --source-pattern <sources>              glob pattern of source files (default: index.js,lib/**/*.js,src/**/*.js)
    --watch                                 watching source file changes
    --watch-aggregate-timeout               delay time for re-run test cases after files changed
    --http                                  switch it http protocol runtime
    -h, --help                              output usage information

--compile-opts <path>


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

module.exports = {
  babelrc: { // babelrc
    presets: [
    sourceMaps: 'inline'
  extensions: ['.es6', '.es', '.jsx', '.js'],
  include: [ // glob expressions to detect files to include
  exclude: [ // glob expressions to detect files to exclude

Trouble Shooting

Using on Travis

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

  - 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, actually you can say that torch is created by adding features onto electron-mocha.


The MIT License (MIT)

Current Tags

  • 1.0.6                                ...           latest (a year ago)

7 Versions

  • 1.0.6                                ...           a year ago
  • 1.0.5                                ...           2 years ago
  • 1.0.4                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Today 0
This Week 2
This Month 59
Last Day 2
Last Week 13
Last Month 30
Dependencies (24)
Dev Dependencies (2)
Dependents (0)

Copyright 2014 - 2016 © taobao.org |