chai-match

Advanced RegExp assertions for Chai.js


Keywords
chai-plugin, browser, string, assertions, chai, chai-match, regexp, regexp-assertions, regexp-captures
License
MIT
Install
npm install chai-match@1.1.1

Documentation

Chai Match

Build Status NPM Version Dependencies License

Advanced RegExp assertions for Chai.js.

Installation

npm i --save-dev chai-match
var chai = require('chai');
chai.use(require('chai-match'));

API

.capture(n)

Sets the assertion object to a previous match's capture.

expect('some thing to test').to.match(/some (\w+) to test/).and.capture(0).equals('thing');
'Here in London'.should.match(/(here|there) in (\w+)/i).and.capture(1).equals('London');