Skip to content

Commit e778047

Browse files
committed
followup tweaks to #475
1 parent 49b9d02 commit e778047

File tree

3 files changed

+29
-15
lines changed

3 files changed

+29
-15
lines changed

.iron-node.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
module.exports = {
2-
"app": {
3-
"openDevToolsDetached" : true, // DEFAULT=FALSE; opens the dev tools windows detached in an own window.
4-
"hideMainWindow" : true, // DEFAULT=FALSE; hides the main window to show dev tools only.
2+
app: {
3+
openDevToolsDetached: true,
4+
hideMainWindow: true
55
},
6-
"workSpaceDirectory" : function(argv) { // determines the workspace directory for specific commandline applications.
7-
return __dirname
6+
workSpaceDirectory: function () {
7+
return __dirname;
88
}
99
};
10-

maintaining.md

+11
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,14 @@
2323
- Ensure the [contributing guidelines](contributing.md) are followed.
2424
- At least two team members must `LGTM` a pull request before it's merged.
2525
- Squash commits when merging.
26+
27+
28+
## Profiling
29+
30+
In the root of a project using AVA, run:
31+
32+
```
33+
$ iron-node node_modules/ava/profile.js <test-file>
34+
```
35+
36+
After `iron-node` has loaded, activate the Dev Tools profiling, and then hit <kbd>Cmd</kbd> <kbd>R</kbd> to rerun the tests.

profile.js

+13-9
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
// Intended to be used with iron-node for profiling purposes.
66

77
var path = require('path');
8+
var EventEmitter = require('events').EventEmitter;
89
var meow = require('meow');
910
var Promise = require('bluebird');
1011
var pkgConf = require('pkg-conf');
1112
var arrify = require('arrify');
1213
var findCacheDir = require('find-cache-dir');
1314
var uniqueTempDir = require('unique-temp-dir');
14-
var EventEmitter = require('events').EventEmitter;
1515
var CachingPrecompiler = require('./lib/caching-precompiler');
1616
var globals = require('./lib/globals');
1717

@@ -24,12 +24,13 @@ var conf = pkgConf.sync('ava');
2424

2525
// Define a minimal set of options from the main CLI.
2626
var cli = meow([
27-
'usage: iron-node node_modules/ava/profile.js [options] TEST_FILE',
27+
'Usage',
28+
' $ iron-node node_modules/ava/profile.js <test-file>',
2829
'',
2930
'Options',
30-
' --fail-fast Stop after first test failure',
31-
' --serial, -s Run tests serially',
32-
' --require, -r Module to preload (Can be repeated)',
31+
' --fail-fast Stop after first test failure',
32+
' --serial, -s Run tests serially',
33+
' --require, -r Module to preload (Can be repeated)',
3334
''
3435
], {
3536
string: [
@@ -50,7 +51,7 @@ var cli = meow([
5051
});
5152

5253
if (cli.input.length !== 1) {
53-
throw new Error('no file');
54+
throw new Error('Specify a test file');
5455
}
5556

5657
var file = path.resolve(cli.input[0]);
@@ -71,22 +72,25 @@ var events = new EventEmitter();
7172
process.send = function (data) {
7273
if (data && data.ava) {
7374
var name = data.name.replace(/^ava-/, '');
75+
7476
if (events.listenerCount(name)) {
7577
events.emit(name, data.data);
7678
} else {
77-
console.log('UNHANDLED AVA EVENT: ', name, data.data);
79+
console.log('UNHANDLED AVA EVENT:', name, data.data);
7880
}
81+
7982
return;
8083
}
81-
console.log('NON AVA EVENT: ', data);
84+
85+
console.log('NON AVA EVENT:', data);
8286
};
8387

8488
events.on('test', function (data) {
8589
console.log('TEST:', data.title, data.error);
8690
});
8791

8892
events.on('results', function (data) {
89-
console.log('RESULTS: ', data.stats);
93+
console.log('RESULTS:', data.stats);
9094
});
9195

9296
events.on('stats', function () {

0 commit comments

Comments
 (0)