Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/leobalter/qunit-regexp

A QUnit plugin to assert regexp tests. The advantage of using it is the fail output showing the string and the regexp values.
https://github.com/leobalter/qunit-regexp

Last synced: about 2 months ago
JSON representation

A QUnit plugin to assert regexp tests. The advantage of using it is the fail output showing the string and the regexp values.

Awesome Lists containing this project

README

        

# qunit-regexp

[![Build Status](https://travis-ci.org/leobalter/qunit-regexp.svg)](https://travis-ci.org/leobalter/qunit-regexp)

A QUnit plugin to assert regexp tests. The advantage of using it is the fail output showing the string and the regexp values.

## Install

This module requires the original QUnit (on npm as `qunitjs`) in order to run.

```
npm install --save-dev qunitjs qunit-regexp
```

## Usage

```js
QUnit.test( "RegExps", function( assert ) {
assert.regexp( "Cheers!", "^Cheers!$", "accepts a string" );
assert.regexp( "Cheers!", /^cheers!$/i, "accepts a regexp with flags" );
assert.regexp( "Cheers!", /^Cheers!$/, "accepts a regexp" );
});
```