chai-match

Advanced RegExp assertions for Chai.js

MIT 4 个版本
安装
npm install chai-match
yarn add chai-match
pnpm add chai-match
bun add chai-match
README

Chai Match

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');
版本列表
1.1.1 2015-11-12
1.1.0 2015-05-22
1.0.1 2015-05-22
1.0.0 2015-05-22