All Projects → BinaryMuse → Atom Mocha Test Runner

BinaryMuse / Atom Mocha Test Runner

Licence: mit
Run your Atom package tests using Mocha

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Atom Mocha Test Runner

Telegraf-Test
Telegraf Test - Simple Test ToolKit of Telegram Bots
Stars: ✭ 22 (+120%)
Mutual labels:  mocha, tests
mocha-wrap
Fluent pluggable interface for easily wrapping `describe` and `it` blocks in Mocha tests.
Stars: ✭ 54 (+440%)
Mutual labels:  mocha, tests
spectron-typescript-starter
Spectron TypeScript Starter for e2e testing electron applications
Stars: ✭ 15 (+50%)
Mutual labels:  mocha, tests
playwright-test
Run unit tests with several runners or benchmark inside real browsers with playwright.
Stars: ✭ 81 (+710%)
Mutual labels:  mocha, tests
atom-mocha
Mocha test runner in Atom
Stars: ✭ 13 (+30%)
Mutual labels:  atom, mocha
Mighty React Snippets
Crafty React & Redux snippets for Atom Editor
Stars: ✭ 16 (+60%)
Mutual labels:  atom
Helm Test
A mocha based testing CLI for helm packages
Stars: ✭ 22 (+120%)
Mutual labels:  mocha
Webdriverio
Next-gen browser and mobile automation test framework for Node.js
Stars: ✭ 7,214 (+72040%)
Mutual labels:  mocha
Unit Test Demo
一步一步介绍如何给项目添加单元测试
Stars: ✭ 766 (+7560%)
Mutual labels:  mocha
Atom Modular Snippets
:atom: A modular solution to snippets in @Atom.
Stars: ✭ 8 (-20%)
Mutual labels:  atom
Atom Korean Spell Daum
Daum 맞춤법 검사기로 텍스트를 보내 손쉽게 교정 가능한 Atom package
Stars: ✭ 24 (+140%)
Mutual labels:  atom
Miniflux Legacy
Minimalist RSS reader (version 1.x)
Stars: ✭ 897 (+8870%)
Mutual labels:  atom
Atom Genesis Syntax
Custom syntax theme for Atom text editor (retired)
Stars: ✭ 16 (+60%)
Mutual labels:  atom
Language Diff
Stars: ✭ 22 (+120%)
Mutual labels:  atom
Atom Clock
Clock for the Atom Editor
Stars: ✭ 5 (-50%)
Mutual labels:  atom
Atomic Chrome
Edit Chrome textareas in Atom
Stars: ✭ 930 (+9200%)
Mutual labels:  atom
Avoriaz
🔬 a Vue.js testing utility library
Stars: ✭ 771 (+7610%)
Mutual labels:  tests
Feedkit
An RSS, Atom and JSON Feed parser written in Swift
Stars: ✭ 895 (+8850%)
Mutual labels:  atom
Autocomplete Haskell
Atom autocomplete-plus provider for haskell
Stars: ✭ 23 (+130%)
Mutual labels:  atom
Vuejs Snippets
Collection of Vuejs 2.0+ snippets
Stars: ✭ 17 (+70%)
Mutual labels:  atom

Atom Mocha Test Runner

By default, Atom runs your tests with Jasmine (for more information on testing packages in Atom, please see the Atom Flight Manual). Atom allows you to specify a custom test runner using the atomTestRunner field in your package.json, but implementing a custom test runner is not straightforward. This module allows you to run your specs using Mocha with minimal fuss.

Installation

$ apm install [--save-dev] atom-mocha-test-runner

Usage

Default Test Runner

If you want to use all the default options, simply pass the module name as the atomTestRunner value in your package.json:

{
  "name": "my-package",
  // ...
  "atomTestRunner": "atom-mocha-test-runner"
}

Note that your package.json may be cached by Atom's compile cache when running tests with Atom's GUI test runner, so if adding or changing that field doesn't seem to work, try quitting and restarting Atom. Also note that by default, the runner looks for tests with a .test.js or .test.coffee file extension, e.g. my-component.test.js.

Programmatic Usage

If you'd like to perform more customization of your testing environment, you can create a custom runner while still utilizing atom-mocha-test-runner for most of the heavy lifting. First, set atomTestRunner to a relative path to a file:

{
  "name": "my-package",
  // ...
  "atomTestRunner": "./test/custom-runner"
}

Then export a test runner created via the atom-mocha-test-runner from test/custom-runner.js:

var createRunner = require('atom-mocha-test-runner').createRunner

// optional options to customize the runner
var extraOptions = {
  testSuffixes: ['-spec.js', '-spec.coffee']
}

var optionalConfigurationFunction = function (mocha) {
  // If provided, atom-mocha-test-runner will pass the mocha instance
  // to this function, so you can do whatever you'd like to it.
}

module.exports = createRunner(extraOptions, optionalConfigurationFunction)

API

createRunner([options,] [callback])

Returns a test runner created with the given options and callback. Both parameters are optional. The returned value can be exported from your atomTestRunner script for Atom to consume.

  • options - An object specifying customized options:

    • options.reporter [default: 'dot'] - Which reporter to use on the terminal
    • globalAtom [default: true] - Whether or not to assign the created Atom environment to global.atom
    • testSuffixes [default: ['test.js', 'test.coffee']] - File extensions that indicate that the file contains tests
    • colors [default: true (false on Windows)] - Whether or not to colorize output on the terminal
    • htmlTitle [default: ''] - The string to use for the window title in the HTML reporter

Making Assertions

atom-mocha-test-runner does not include any assertion libraries; it only includes the Mocha test runner. You can pull in any assertion library you want, but Chai is a great choice.

const assert = require('chai').assert

describe('Testing', function () {
  it('works', function () {
    assert.equal(answerToLifeUniverseAndEverything, 42)
  })
})
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].