forked from avajs/ava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.js
More file actions
executable file
·28 lines (24 loc) · 784 Bytes
/
Copy pathcli.js
File metadata and controls
executable file
·28 lines (24 loc) · 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env node
'use strict';
var path = require('path');
var debug = require('debug')('ava');
// Prefer the local installation of AVA.
var resolveCwd = require('resolve-cwd');
var localCLI = resolveCwd('ava/cli');
// Use path.relative() to detect local AVA installation,
// because __filename's case is inconsistent on Windows
// see https://github.com/nodejs/node/issues/6624
if (localCLI && path.relative(localCLI, __filename) !== '') {
debug('Using local install of AVA');
require(localCLI); // eslint-disable-line import/no-dynamic-require
} else {
if (debug.enabled) {
require('time-require'); // eslint-disable-line import/no-unassigned-import
}
try {
require('./lib/cli').run();
} catch (err) {
console.error('\n ' + err.message);
process.exit(1);
}
}