Skip to content

Instantly share code, notes, and snippets.

@develar
Created March 2, 2016 08:52
Show Gist options
  • Save develar/da7d3c01c3b8e6e0eace to your computer and use it in GitHub Desktop.
Save develar/da7d3c01c3b8e6e0eace to your computer and use it in GitHub Desktop.
Index: cli.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- cli.js (date 1454269165000)
+++ cli.js (revision )
@@ -52,6 +52,7 @@
// Leave --watch and --sources undocumented until they're stable enough
// ' --watch, -w Re-run tests when tests and source files change',
// ' --source Pattern to match source files so tests can be re-run (Can be repeated)',
+ ' --match, -m Only run tests with titles matching',
'',
'Examples',
' ava',
@@ -67,7 +68,8 @@
string: [
'_',
'require',
- 'source'
+ 'source',
+ 'match'
],
boolean: [
'fail-fast',
@@ -82,7 +84,8 @@
v: 'verbose',
r: 'require',
s: 'serial',
- w: 'watch'
+ w: 'watch',
+ m: 'match'
}
});
@@ -98,7 +101,8 @@
serial: cli.flags.serial,
require: arrify(cli.flags.require),
cacheEnabled: cli.flags.cache !== false,
- explicitTitles: cli.flags.watch
+ explicitTitles: cli.flags.watch,
+ match: cli.flags.match,
});
var reporter;
Index: lib/runner.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- lib/runner.js (date 1454269165000)
+++ lib/runner.js (revision )
@@ -35,6 +35,7 @@
EventEmitter.call(this);
+ this._match = options.match;
this.tests = new TestCollection();
this._bail = options.bail;
this._serial = options.serial;
@@ -51,6 +52,7 @@
title = null;
}
+ opts.skipped = opts.skipped || (this._match && title && title.indexOf(this._match) === -1);
if (this._serial) {
opts.serial = true;
}
Index: index.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- index.js (date 1454269165000)
+++ index.js (revision )
@@ -13,7 +13,8 @@
var opts = globals.options;
var runner = new Runner({
serial: opts.serial,
- bail: opts.failFast
+ bail: opts.failFast,
+ match: opts.match,
});
// check if the test is being run without AVA cli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment