diff --git a/lib/reporters/doc.js b/lib/reporters/doc.js
index 5a6af8fb42..fd6b46932d 100644
--- a/lib/reporters/doc.js
+++ b/lib/reporters/doc.js
@@ -62,6 +62,7 @@ function Doc(runner, options) {
runner.on(EVENT_TEST_PASS, function(test) {
Base.consoleLog('%s
%s', indent(), utils.escape(test.title));
+ Base.consoleLog('%s %s', indent(), utils.escape(test.file));
var code = utils.escape(utils.clean(test.body));
Base.consoleLog('%s %s
', indent(), code);
});
@@ -72,6 +73,11 @@ function Doc(runner, options) {
indent(),
utils.escape(test.title)
);
+ Base.consoleLog(
+ '%s %s',
+ indent(),
+ utils.escape(test.file)
+ );
var code = utils.escape(utils.clean(test.body));
Base.consoleLog(
'%s %s
',
diff --git a/lib/reporters/json-stream.js b/lib/reporters/json-stream.js
index 27282987ea..8caa8adfce 100644
--- a/lib/reporters/json-stream.js
+++ b/lib/reporters/json-stream.js
@@ -82,6 +82,7 @@ function clean(test) {
return {
title: test.title,
fullTitle: test.fullTitle(),
+ file: test.file,
duration: test.duration,
currentRetry: test.currentRetry()
};
diff --git a/lib/reporters/json.js b/lib/reporters/json.js
index 12b6289cd7..a46776ba9c 100644
--- a/lib/reporters/json.js
+++ b/lib/reporters/json.js
@@ -87,6 +87,7 @@ function clean(test) {
return {
title: test.title,
fullTitle: test.fullTitle(),
+ file: test.file,
duration: test.duration,
currentRetry: test.currentRetry(),
err: cleanCycles(err)
diff --git a/test/reporters/doc.spec.js b/test/reporters/doc.spec.js
index fb2703f83c..ce84a5a1b3 100644
--- a/test/reporters/doc.spec.js
+++ b/test/reporters/doc.spec.js
@@ -134,9 +134,11 @@ describe('Doc reporter', function() {
describe("on 'pass' event", function() {
var expectedTitle = 'some tite';
+ var expectedFile = 'testFile.spec.js';
var expectedBody = 'some body';
var test = {
title: expectedTitle,
+ file: expectedFile,
body: expectedBody,
slow: function() {
return '';
@@ -148,6 +150,7 @@ describe('Doc reporter', function() {
var stdout = runReporter(this, runner, options);
var expectedArray = [
' ' + expectedTitle + '\n',
+ ' ' + expectedFile + '\n',
' ' + expectedBody + '
\n'
];
expect(stdout, 'to equal', expectedArray);
@@ -155,18 +158,23 @@ describe('Doc reporter', function() {
it('should escape title and body where necessary', function() {
var unescapedTitle = '' + expectedTitle + '
';
+ var unescapedFile = '' + expectedFile + '
';
var unescapedBody = '' + expectedBody + '
';
test.title = unescapedTitle;
+ test.file = unescapedFile;
test.body = unescapedBody;
var expectedEscapedTitle =
'<div>' + expectedTitle + '</div>';
+ var expectedEscapedFile =
+ '<div>' + expectedFile + '</div>';
var expectedEscapedBody =
'<div>' + expectedBody + '</div>';
runner = createMockRunner('pass', EVENT_TEST_PASS, null, null, test);
var stdout = runReporter(this, runner, options);
var expectedArray = [
' ' + expectedEscapedTitle + '\n',
+ ' ' + expectedEscapedFile + '\n',
' ' + expectedEscapedBody + '
\n'
];
expect(stdout, 'to equal', expectedArray);
@@ -175,10 +183,12 @@ describe('Doc reporter', function() {
describe("on 'fail' event", function() {
var expectedTitle = 'some tite';
+ var expectedFile = 'testFile.spec.js';
var expectedBody = 'some body';
var expectedError = 'some error';
var test = {
title: expectedTitle,
+ file: expectedFile,
body: expectedBody,
slow: function() {
return '';
@@ -197,6 +207,7 @@ describe('Doc reporter', function() {
var stdout = runReporter(this, runner, options);
var expectedArray = [
' ' + expectedTitle + '\n',
+ ' ' + expectedFile + '\n',
' ' +
expectedBody +
'
\n',
@@ -207,13 +218,17 @@ describe('Doc reporter', function() {
it('should escape title, body, and error where necessary', function() {
var unescapedTitle = '' + expectedTitle + '
';
+ var unescapedFile = '' + expectedFile + '
';
var unescapedBody = '' + expectedBody + '
';
var unescapedError = '' + expectedError + '
';
test.title = unescapedTitle;
+ test.file = unescapedFile;
test.body = unescapedBody;
var expectedEscapedTitle =
'<div>' + expectedTitle + '</div>';
+ var expectedEscapedFile =
+ '<div>' + expectedFile + '</div>';
var expectedEscapedBody =
'<div>' + expectedBody + '</div>';
var expectedEscapedError =
@@ -229,6 +244,7 @@ describe('Doc reporter', function() {
var stdout = runReporter(this, runner, options);
var expectedArray = [
' ' + expectedEscapedTitle + '\n',
+ ' ' + expectedEscapedFile + '\n',
' ' +
expectedEscapedBody +
'
\n',
diff --git a/test/reporters/helpers.js b/test/reporters/helpers.js
index 45c4d916de..f712e19e8b 100644
--- a/test/reporters/helpers.js
+++ b/test/reporters/helpers.js
@@ -163,6 +163,7 @@ function createElements(argObj) {
function makeExpectedTest(
expectedTitle,
expectedFullTitle,
+ expectedFile,
expectedDuration,
currentRetry,
expectedBody
@@ -172,6 +173,7 @@ function makeExpectedTest(
fullTitle: function() {
return expectedFullTitle;
},
+ file: expectedFile,
duration: expectedDuration,
currentRetry: function() {
return currentRetry;
diff --git a/test/reporters/json-stream.spec.js b/test/reporters/json-stream.spec.js
index de83f861b2..613b9279f8 100644
--- a/test/reporters/json-stream.spec.js
+++ b/test/reporters/json-stream.spec.js
@@ -20,11 +20,13 @@ describe('JSON Stream reporter', function() {
var runReporter = makeRunReporter(JSONStream);
var expectedTitle = 'some title';
var expectedFullTitle = 'full title';
+ var expectedFile = 'someTest.spec.js';
var expectedDuration = 1000;
var currentRetry = 1;
var expectedTest = makeExpectedTest(
expectedTitle,
expectedFullTitle,
+ expectedFile,
expectedDuration,
currentRetry
);
@@ -70,6 +72,8 @@ describe('JSON Stream reporter', function() {
dQuote(expectedTitle) +
',"fullTitle":' +
dQuote(expectedFullTitle) +
+ ',"file":' +
+ dQuote(expectedFile) +
',"duration":' +
expectedDuration +
',"currentRetry":' +
@@ -101,6 +105,8 @@ describe('JSON Stream reporter', function() {
dQuote(expectedTitle) +
',"fullTitle":' +
dQuote(expectedFullTitle) +
+ ',"file":' +
+ dQuote(expectedFile) +
',"duration":' +
expectedDuration +
',"currentRetry":' +
@@ -135,6 +141,8 @@ describe('JSON Stream reporter', function() {
dQuote(expectedTitle) +
',"fullTitle":' +
dQuote(expectedFullTitle) +
+ ',"file":' +
+ dQuote(expectedFile) +
',"duration":' +
expectedDuration +
',"currentRetry":' +
diff --git a/test/reporters/json.spec.js b/test/reporters/json.spec.js
index f6299dd134..9aa7e7a208 100644
--- a/test/reporters/json.spec.js
+++ b/test/reporters/json.spec.js
@@ -11,6 +11,7 @@ describe('JSON reporter', function() {
var suite;
var runner;
var testTitle = 'json test 1';
+ var testFile = 'someTest.spec.js';
var noop = function() {};
beforeEach(function() {
@@ -36,11 +37,12 @@ describe('JSON reporter', function() {
it('should have 1 test failure', function(done) {
var error = {message: 'oh shit'};
- suite.addTest(
- new Test(testTitle, function(done) {
- done(new Error(error.message));
- })
- );
+ var test = new Test(testTitle, function(done) {
+ done(new Error(error.message));
+ });
+
+ test.file = testFile;
+ suite.addTest(test);
runner.run(function(failureCount) {
sandbox.restore();
@@ -49,6 +51,7 @@ describe('JSON reporter', function() {
failures: [
{
title: testTitle,
+ file: testFile,
err: {
message: error.message
}
@@ -62,7 +65,9 @@ describe('JSON reporter', function() {
});
it('should have 1 test pending', function(done) {
- suite.addTest(new Test(testTitle));
+ var test = new Test(testTitle);
+ test.file = testFile;
+ suite.addTest(test);
runner.run(function(failureCount) {
sandbox.restore();
@@ -70,7 +75,8 @@ describe('JSON reporter', function() {
testResults: {
pending: [
{
- title: testTitle
+ title: testTitle,
+ file: testFile
}
]
}
@@ -88,11 +94,12 @@ describe('JSON reporter', function() {
}
var error = new CircleError();
- suite.addTest(
- new Test(testTitle, function(done) {
- throw error;
- })
- );
+ var test = new Test(testTitle, function(done) {
+ throw error;
+ });
+
+ test.file = testFile;
+ suite.addTest(test);
runner.run(function(failureCount) {
sandbox.restore();
@@ -101,6 +108,7 @@ describe('JSON reporter', function() {
failures: [
{
title: testTitle,
+ file: testFile,
err: {
message: error.message
}