dojo/cli-test-intern

Name: cli-test-intern

Owner: Dojo

Description: :rocket: Dojo 2 - cli command for testing applications

Created: 2017-01-06 16:52:54.0

Updated: 2018-05-02 15:22:00.0

Pushed: 2018-05-02 15:21:59.0

Homepage: http://dojo.io

Size: 666

Language: TypeScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

cli-test-intern

Build Status Build status codecov npm version

The official Dojo 2 test command. This package uses Intern to run unit and functional tests against your Dojo project.

Usage
Prerequisites

This project is a command for the Dojo CLI. Please visit the Dojo CLI project for information about the project and how to install.

Installation

The use @dojo/cli-test-intern in a project, install the package:

install @dojo/cli-test-intern
Basic Usage

First, build your application and tests using @dojo/cli-build-app

 build app --mode dev
 build app --mode test

Then, run your tests using @dojo/cli-test-intern

 test -a

There are several configuration options available. To list them run dojo test -h.

Running Tests

Intern supports two types of testing approaches unit and functional. Unit tests are tests run via node and the local Selenium tunnel and test isolated blocks of code. Functional tests are run using Selenium in the browser and test the overall functionality of the software as a user would interact with it.

Unit tests

Unit tests may be run explicitly with the -u flag or as part of a full test run using the -a flag

 test -u

@dojo/cli-test-intern will execute tests located at output/tests/unit.js in node and in Chrome and provide a report listing any failed tests and display a coverage report.

Functional tests

Functional tests may be run explicitly with the -f flag or as part of a full test run using the -a flag

 test -f

@dojo/cli-test-intern will execute tests located at ./output/test/functional.js in Chrome using Selenium and provide a report listing any failed tests.

Testing services

Intern comes with support for running tests remotely on BrowserStack, SauceLabs, and TestingBot. You may use one of these services by signing up for an account and providing your credentials to cli-test-intern. By default, all of the testing services will run tests against IE11, Firefox, and Chrome.

BrowserStack

BrowserStack requires an access key and username to use its services. These may be provided on the command line or as environment variables as described in Intern's documentation.

 test -a -c browserstack -k <accesskey> --userName <username>

or with environment variables

SERSTACK_USERNAME=<username> BROWSERSTACK_ACCESS_KEY=<key> dojo test -a -c browserstack
SauceLabs

SauceLabs requires an access key and username to use its services. These may be provided on the command line or as environment variables as described in Intern's documentation.

 test -a -c saucelabs -k <accesskey> --userName <username>

or with environment variables

E_USERNAME=<username> SAUCE_ACCESS_KEY=<key> dojo test -a -c saucelabs
TestingBot

TestingBot requires an key and a secret to use its services. These may be provided on the command line or as environment variables as described in Intern's documentation.

 test -a -c testingbot -k <key> -s <secret>

or with environment variables

INGBOT_SECRET=<secret> TESTINGBOT_KEY=<key> dojo test -a -c saucelabs
How do I contribute?

We appreciate your interest! Please see the Dojo 2 Meta Repository for the Contributing Guidelines.

Code Style

This repository uses prettier for code styling rules and formatting. A pre-commit hook is installed automatically and configured to run prettier against all staged files as per the configuration in the projects package.json.

An additional npm script to run prettier (with write set to true) against all src and test project files is available by running:

run prettier
Testing

Test cases MUST be written using Intern using the “bdd” test interface and “assert” assertion interface.

90% branch coverage MUST be provided for all code submitted to this repository, as reported by Istanbul?s combined coverage results for all supported platforms.

To test locally in node run:

grunt test

© 2018 JS Foundation & contributors. New BSD license.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.