Permalink
Browse files

followup tweaks to #475

  • Loading branch information...
1 parent 49b9d02 commit e7780474f401643995377f2cec65d4d7da2f7787 @sindresorhus sindresorhus committed Jan 29, 2016
Showing with 29 additions and 15 deletions.
  1. +5 −6 .iron-node.js
  2. +11 −0 maintaining.md
  3. +13 −9 profile.js
View
@@ -1,10 +1,9 @@
module.exports = {
- "app": {
- "openDevToolsDetached" : true, // DEFAULT=FALSE; opens the dev tools windows detached in an own window.
- "hideMainWindow" : true, // DEFAULT=FALSE; hides the main window to show dev tools only.
+ app: {
+ openDevToolsDetached: true,
+ hideMainWindow: true
},
- "workSpaceDirectory" : function(argv) { // determines the workspace directory for specific commandline applications.
- return __dirname
+ workSpaceDirectory: function () {
+ return __dirname;
}
};
-
View
@@ -23,3 +23,14 @@
- Ensure the [contributing guidelines](contributing.md) are followed.
- At least two team members must `LGTM` a pull request before it's merged.
- Squash commits when merging.
+
+
+## Profiling
+
+In the root of a project using AVA, run:
+
+```
+$ iron-node node_modules/ava/profile.js <test-file>
+```
+
+After `iron-node` has loaded, activate the Dev Tools profiling, and then hit <kbd>Cmd</kbd> <kbd>R</kbd> to rerun the tests.
View
@@ -5,13 +5,13 @@
// Intended to be used with iron-node for profiling purposes.
var path = require('path');
+var EventEmitter = require('events').EventEmitter;
var meow = require('meow');
var Promise = require('bluebird');
var pkgConf = require('pkg-conf');
var arrify = require('arrify');
var findCacheDir = require('find-cache-dir');
var uniqueTempDir = require('unique-temp-dir');
-var EventEmitter = require('events').EventEmitter;
var CachingPrecompiler = require('./lib/caching-precompiler');
var globals = require('./lib/globals');
@@ -24,12 +24,13 @@ var conf = pkgConf.sync('ava');
// Define a minimal set of options from the main CLI.
var cli = meow([
- 'usage: iron-node node_modules/ava/profile.js [options] TEST_FILE',
+ 'Usage',
+ ' $ iron-node node_modules/ava/profile.js <test-file>',
'',
'Options',
- ' --fail-fast Stop after first test failure',
- ' --serial, -s Run tests serially',
- ' --require, -r Module to preload (Can be repeated)',
+ ' --fail-fast Stop after first test failure',
+ ' --serial, -s Run tests serially',
+ ' --require, -r Module to preload (Can be repeated)',
''
], {
string: [
@@ -50,7 +51,7 @@ var cli = meow([
});
if (cli.input.length !== 1) {
- throw new Error('no file');
+ throw new Error('Specify a test file');
}
var file = path.resolve(cli.input[0]);
@@ -71,22 +72,25 @@ var events = new EventEmitter();
process.send = function (data) {
if (data && data.ava) {
var name = data.name.replace(/^ava-/, '');
+
if (events.listenerCount(name)) {
events.emit(name, data.data);
} else {
- console.log('UNHANDLED AVA EVENT: ', name, data.data);
+ console.log('UNHANDLED AVA EVENT:', name, data.data);
}
+
return;
}
- console.log('NON AVA EVENT: ', data);
+
+ console.log('NON AVA EVENT:', data);
};
events.on('test', function (data) {
console.log('TEST:', data.title, data.error);
});
events.on('results', function (data) {
- console.log('RESULTS: ', data.stats);
+ console.log('RESULTS:', data.stats);
});
events.on('stats', function () {

0 comments on commit e778047

Please sign in to comment.