Skip to content

Commit a2374b0

Browse files
committed
Fixed file path being omitted
1 parent b102aca commit a2374b0

2 files changed

Lines changed: 178 additions & 178 deletions

File tree

dist/index.js

Lines changed: 175 additions & 175 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const lineReader = __webpack_require__(631);
1010
const fs = __webpack_require__(747);
1111

1212
try {
13-
const regex = /(\w+_test.go:\d+:)/g; // Extracts file name and line where test failures occurred
13+
const regex = /[\w\d]+_test.go:\d+:/iu; // Extracts file name and line where test failures occurred
1414

1515
const testResultsPath = core.getInput('test-results');
1616
const customPackageName = core.getInput('package-name');
@@ -61,9 +61,9 @@ try {
6161
const result = regex.exec(value);
6262
if (result != null) {
6363
const parts = result[0].split(":");
64-
const file = parts[0]
64+
const file = key.split("/").slice(0, -1).join("/") + "/" + parts[0];
6565
const lineNumber = parts[1];
66-
core.info(`::error file=${file},line=${lineNumber}::${value}`)
66+
core.info(`::error file=${file},line=${lineNumber}::${value}`);
6767
}
6868
}
6969
}
@@ -584,178 +584,178 @@ exports.toCommandProperties = toCommandProperties;
584584
/***/ 631:
585585
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
586586

587-
/*
588-
* Line By Line
589-
*
590-
* A NodeJS module that helps you reading large text files, line by line,
591-
* without buffering the files into memory.
592-
*
593-
* Copyright (c) 2012 Markus von der Wehd <mvdw@mwin.de>
594-
* MIT License, see LICENSE.txt, see http://www.opensource.org/licenses/mit-license.php
595-
*/
596-
597-
var stream = __webpack_require__(413);
598-
var StringDecoder = __webpack_require__(304).StringDecoder;
599-
var path = __webpack_require__(622);
600-
var fs = __webpack_require__(747);
601-
var events = __webpack_require__(614);
602-
603-
// let's make sure we have a setImmediate function (node.js <0.10)
604-
if (typeof global.setImmediate == 'undefined') { setImmediate = process.nextTick;}
605-
606-
var LineByLineReader = function (filepath, options) {
607-
var self = this;
608-
609-
this._encoding = options && options.encoding || 'utf8';
610-
if (filepath instanceof stream.Readable) {
611-
this._readStream = filepath;
612-
}
613-
else {
614-
this._readStream = null;
615-
this._filepath = path.normalize(filepath);
616-
this._streamOptions = { encoding: this._encoding };
617-
618-
if (options && options.start) {
619-
this._streamOptions.start = options.start;
620-
}
621-
622-
if (options && options.end) {
623-
this._streamOptions.end = options.end;
624-
}
625-
}
626-
this._skipEmptyLines = options && options.skipEmptyLines || false;
627-
628-
this._lines = [];
629-
this._lineFragment = '';
630-
this._paused = false;
631-
this._end = false;
632-
this._ended = false;
633-
this.decoder = new StringDecoder(this._encoding);
634-
635-
events.EventEmitter.call(this);
636-
637-
setImmediate(function () {
638-
self._initStream();
639-
});
640-
};
641-
642-
LineByLineReader.prototype = Object.create(events.EventEmitter.prototype, {
643-
constructor: {
644-
value: LineByLineReader,
645-
enumerable: false
646-
}
647-
});
648-
649-
LineByLineReader.prototype._initStream = function () {
650-
var self = this,
651-
readStream = this._readStream ? this._readStream :
652-
fs.createReadStream(this._filepath, this._streamOptions);
653-
654-
readStream.on('error', function (err) {
655-
self.emit('error', err);
656-
});
657-
658-
readStream.on('open', function () {
659-
self.emit('open');
660-
});
661-
662-
readStream.on('data', function (data) {
663-
self._readStream.pause();
664-
var dataAsString = data;
665-
if (data instanceof Buffer) {
666-
dataAsString = self.decoder.write(data);
667-
}
668-
self._lines = self._lines.concat(dataAsString.split(/(?:\n|\r\n|\r)/g));
669-
670-
self._lines[0] = self._lineFragment + self._lines[0];
671-
self._lineFragment = self._lines.pop() || '';
672-
673-
setImmediate(function () {
674-
self._nextLine();
675-
});
676-
});
677-
678-
readStream.on('end', function () {
679-
self._end = true;
680-
681-
setImmediate(function () {
682-
self._nextLine();
683-
});
684-
});
685-
686-
this._readStream = readStream;
687-
};
688-
689-
LineByLineReader.prototype._nextLine = function () {
690-
var self = this,
691-
line;
692-
693-
if (this._paused) {
694-
return;
695-
}
696-
697-
if (this._lines.length === 0) {
698-
if (this._end) {
699-
if (this._lineFragment) {
700-
this.emit('line', this._lineFragment);
701-
this._lineFragment = '';
702-
}
703-
if (!this._paused) {
704-
this.end();
705-
}
706-
} else {
707-
this._readStream.resume();
708-
}
709-
return;
710-
}
711-
712-
line = this._lines.shift();
713-
714-
if (!this._skipEmptyLines || line.length > 0) {
715-
this.emit('line', line);
716-
}
717-
718-
setImmediate(function () {
719-
if (!this._paused) {
720-
self._nextLine();
721-
}
722-
});
723-
};
724-
725-
LineByLineReader.prototype.pause = function () {
726-
this._paused = true;
727-
};
728-
729-
LineByLineReader.prototype.resume = function () {
730-
var self = this;
731-
732-
this._paused = false;
733-
734-
setImmediate(function () {
735-
self._nextLine();
736-
});
737-
};
738-
739-
LineByLineReader.prototype.end = function () {
740-
if (!this._ended){
741-
this._ended = true;
742-
this.emit('end');
743-
}
744-
};
745-
746-
LineByLineReader.prototype.close = function () {
747-
var self = this;
748-
749-
this._readStream.destroy();
750-
this._end = true;
751-
this._lines = [];
752-
753-
setImmediate(function () {
754-
self._nextLine();
755-
});
756-
};
757-
758-
module.exports = LineByLineReader;
587+
/*
588+
* Line By Line
589+
*
590+
* A NodeJS module that helps you reading large text files, line by line,
591+
* without buffering the files into memory.
592+
*
593+
* Copyright (c) 2012 Markus von der Wehd <mvdw@mwin.de>
594+
* MIT License, see LICENSE.txt, see http://www.opensource.org/licenses/mit-license.php
595+
*/
596+
597+
var stream = __webpack_require__(413);
598+
var StringDecoder = __webpack_require__(304).StringDecoder;
599+
var path = __webpack_require__(622);
600+
var fs = __webpack_require__(747);
601+
var events = __webpack_require__(614);
602+
603+
// let's make sure we have a setImmediate function (node.js <0.10)
604+
if (typeof global.setImmediate == 'undefined') { setImmediate = process.nextTick;}
605+
606+
var LineByLineReader = function (filepath, options) {
607+
var self = this;
608+
609+
this._encoding = options && options.encoding || 'utf8';
610+
if (filepath instanceof stream.Readable) {
611+
this._readStream = filepath;
612+
}
613+
else {
614+
this._readStream = null;
615+
this._filepath = path.normalize(filepath);
616+
this._streamOptions = { encoding: this._encoding };
617+
618+
if (options && options.start) {
619+
this._streamOptions.start = options.start;
620+
}
621+
622+
if (options && options.end) {
623+
this._streamOptions.end = options.end;
624+
}
625+
}
626+
this._skipEmptyLines = options && options.skipEmptyLines || false;
627+
628+
this._lines = [];
629+
this._lineFragment = '';
630+
this._paused = false;
631+
this._end = false;
632+
this._ended = false;
633+
this.decoder = new StringDecoder(this._encoding);
634+
635+
events.EventEmitter.call(this);
636+
637+
setImmediate(function () {
638+
self._initStream();
639+
});
640+
};
641+
642+
LineByLineReader.prototype = Object.create(events.EventEmitter.prototype, {
643+
constructor: {
644+
value: LineByLineReader,
645+
enumerable: false
646+
}
647+
});
648+
649+
LineByLineReader.prototype._initStream = function () {
650+
var self = this,
651+
readStream = this._readStream ? this._readStream :
652+
fs.createReadStream(this._filepath, this._streamOptions);
653+
654+
readStream.on('error', function (err) {
655+
self.emit('error', err);
656+
});
657+
658+
readStream.on('open', function () {
659+
self.emit('open');
660+
});
661+
662+
readStream.on('data', function (data) {
663+
self._readStream.pause();
664+
var dataAsString = data;
665+
if (data instanceof Buffer) {
666+
dataAsString = self.decoder.write(data);
667+
}
668+
self._lines = self._lines.concat(dataAsString.split(/(?:\n|\r\n|\r)/g));
669+
670+
self._lines[0] = self._lineFragment + self._lines[0];
671+
self._lineFragment = self._lines.pop() || '';
672+
673+
setImmediate(function () {
674+
self._nextLine();
675+
});
676+
});
677+
678+
readStream.on('end', function () {
679+
self._end = true;
680+
681+
setImmediate(function () {
682+
self._nextLine();
683+
});
684+
});
685+
686+
this._readStream = readStream;
687+
};
688+
689+
LineByLineReader.prototype._nextLine = function () {
690+
var self = this,
691+
line;
692+
693+
if (this._paused) {
694+
return;
695+
}
696+
697+
if (this._lines.length === 0) {
698+
if (this._end) {
699+
if (this._lineFragment) {
700+
this.emit('line', this._lineFragment);
701+
this._lineFragment = '';
702+
}
703+
if (!this._paused) {
704+
this.end();
705+
}
706+
} else {
707+
this._readStream.resume();
708+
}
709+
return;
710+
}
711+
712+
line = this._lines.shift();
713+
714+
if (!this._skipEmptyLines || line.length > 0) {
715+
this.emit('line', line);
716+
}
717+
718+
setImmediate(function () {
719+
if (!this._paused) {
720+
self._nextLine();
721+
}
722+
});
723+
};
724+
725+
LineByLineReader.prototype.pause = function () {
726+
this._paused = true;
727+
};
728+
729+
LineByLineReader.prototype.resume = function () {
730+
var self = this;
731+
732+
this._paused = false;
733+
734+
setImmediate(function () {
735+
self._nextLine();
736+
});
737+
};
738+
739+
LineByLineReader.prototype.end = function () {
740+
if (!this._ended){
741+
this._ended = true;
742+
this.emit('end');
743+
}
744+
};
745+
746+
LineByLineReader.prototype.close = function () {
747+
var self = this;
748+
749+
this._readStream.destroy();
750+
this._end = true;
751+
this._lines = [];
752+
753+
setImmediate(function () {
754+
self._nextLine();
755+
});
756+
};
757+
758+
module.exports = LineByLineReader;
759759

760760

761761
/***/ }),

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const lineReader = require('line-by-line');
33
const fs = require('fs');
44

55
try {
6-
const regex = /(\w+_test.go:\d+:)/g; // Extracts file name and line where test failures occurred
6+
const regex = /[\w\d]+_test.go:\d+:/iu; // Extracts file name and line where test failures occurred
77

88
const testResultsPath = core.getInput('test-results');
99
const customPackageName = core.getInput('package-name');
@@ -54,9 +54,9 @@ try {
5454
const result = regex.exec(value);
5555
if (result != null) {
5656
const parts = result[0].split(":");
57-
const file = parts[0]
57+
const file = key.split("/").slice(0, -1).join("/") + "/" + parts[0];
5858
const lineNumber = parts[1];
59-
core.info(`::error file=${file},line=${lineNumber}::${value}`)
59+
core.info(`::error file=${file},line=${lineNumber}::${value}`);
6060
}
6161
}
6262
}

0 commit comments

Comments
 (0)