Skip to content

Commit

Permalink
fail when tests executed without cli
Browse files Browse the repository at this point in the history
  • Loading branch information
vdemedes committed Nov 11, 2015
1 parent 3a75cb1 commit 956002e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
'use strict';
var setImmediate = require('set-immediate-shim');
var hasFlag = require('has-flag');
var relative = require('path').relative;
var serializeError = require('serialize-error');
var Runner = require('./lib/runner');
var log = require('./lib/logger');
var runner = new Runner();

// check if the test is being run without AVA cli
var isForked = typeof process.send === 'function';

if (!isForked) {
var path = relative('.', process.argv[1]);

log.write();
log.error('Test files must be run with the AVA CLI:\n\n $ ava ' + path + '\n');

process.exit(1);
}

// if fail-fast is enabled, use this variable to detect,
// that no more tests should be logged
var isFailed = false;
Expand Down

0 comments on commit 956002e

Please sign in to comment.