Force generating summary if there is single results file and onlySummary is enabled

This commit is contained in:
Michal Dorner 2021-06-22 21:28:22 +02:00
parent 17e793242c
commit 2ac8b4498f
No known key found for this signature in database
GPG key ID: 9EEE04B48DA36786
6 changed files with 128 additions and 167 deletions

View file

@ -128,6 +128,11 @@ jobs:
# mocha-json # mocha-json
reporter: '' reporter: ''
# Allows you to generate only the summary.
# If enabled, the report will contain a table listing each test results file and the number of passed, failed, and skipped tests.
# Detailed listing of test suites and test cases will be skipped.
only-summary: 'false'
# Limits which test suites are listed: # Limits which test suites are listed:
# all # all
# failed # failed

View file

@ -54,7 +54,10 @@ inputs:
description: Relative path under $GITHUB_WORKSPACE where the repository was checked out description: Relative path under $GITHUB_WORKSPACE where the repository was checked out
required: false required: false
only-summary: only-summary:
description: allows you to generate the summary only. description: |
Allows you to generate only the summary.
If enabled, the report will contain a table listing each test results file and the number of passed, failed, and skipped tests.
Detailed listing of test suites and test cases will be skipped.
default: 'false' default: 'false'
required: false required: false
token: token:

245
dist/index.js generated vendored
View file

@ -1450,7 +1450,7 @@ function getBadge(passed, failed, skipped) {
} }
function getTestRunsReport(testRuns, options) { function getTestRunsReport(testRuns, options) {
const sections = []; const sections = [];
if (testRuns.length > 1) { if (testRuns.length > 1 || options.onlySummary) {
const tableData = testRuns.map((tr, runIndex) => { const tableData = testRuns.map((tr, runIndex) => {
const time = markdown_utils_1.formatTime(tr.time); const time = markdown_utils_1.formatTime(tr.time);
const name = tr.path; const name = tr.path;
@ -8350,12 +8350,13 @@ module.exports = function (/**String*/input) {
} }
function fixPath(zipPath){ function fixPath(zipPath){
// convert windows file separators and normalize // convert windows file separators
zipPath = pth.posix.normalize(zipPath.split("\\").join("/")); zipPath = zipPath.split("\\").join("/");
// cleanup, remove invalid folder names // add separator if it wasnt given
var names = zipPath.split("/").filter((c) => c !== "" && c !== "." && c !== ".."); if (zipPath.charAt(zipPath.length - 1) !== "/") {
// if we have name we return it zipPath += "/";
return names.length ? names.join("/") + "/" : ""; }
return zipPath;
} }
return { return {
@ -8521,7 +8522,7 @@ module.exports = function (/**String*/input) {
// add file name into zippath // add file name into zippath
zipPath += (zipName) ? zipName : p; zipPath += (zipName) ? zipName : p;
// read file attributes // read file attributes
const _attr = fs.statSync(localPath); const _attr = fs.statSync(localPath);
// add file into zip file // add file into zip file
@ -8541,7 +8542,7 @@ module.exports = function (/**String*/input) {
*/ */
addLocalFolder: function (/**String*/localPath, /**String=*/zipPath, /**=RegExp|Function*/filter) { addLocalFolder: function (/**String*/localPath, /**String=*/zipPath, /**=RegExp|Function*/filter) {
// Prepare filter // Prepare filter
if (filter instanceof RegExp) { // if filter is RegExp wrap it if (filter instanceof RegExp) { // if filter is RegExp wrap it
filter = (function (rx){ filter = (function (rx){
return function (filename) { return function (filename) {
return rx.test(filename); return rx.test(filename);
@ -8568,11 +8569,10 @@ module.exports = function (/**String*/input) {
items.forEach(function (filepath) { items.forEach(function (filepath) {
var p = pth.relative(localPath, filepath).split("\\").join("/"); //windows fix var p = pth.relative(localPath, filepath).split("\\").join("/"); //windows fix
if (filter(p)) { if (filter(p)) {
var stats = fs.statSync(filepath); if (filepath.charAt(filepath.length - 1) !== pth.sep) {
if (stats.isFile()) { self.addFile(zipPath + p, fs.readFileSync(filepath), "", fs.statSync(filepath));
self.addFile(zipPath + p, fs.readFileSync(filepath), "", stats);
} else { } else {
self.addFile(zipPath + p + '/', Buffer.alloc(0), "", stats); self.addFile(zipPath + p + '/', Buffer.alloc(0), "", 0);
} }
} }
}); });
@ -8590,83 +8590,75 @@ module.exports = function (/**String*/input) {
* @param filter optional RegExp or Function if files match will * @param filter optional RegExp or Function if files match will
* be included. * be included.
*/ */
addLocalFolderAsync: function (/*String*/localPath, /*Function*/callback, /*String*/zipPath, /*RegExp|Function*/filter) { addLocalFolderAsync: function (/*String*/localPath, /*Function*/callback, /*String*/zipPath, /*RegExp|Function*/filter) {
if (filter instanceof RegExp) { if (filter === undefined) {
filter = (function (rx) { filter = function () {
return function (filename) { return true;
return rx.test(filename); };
}; } else if (filter instanceof RegExp) {
})(filter); filter = function (filter) {
} else if ("function" !== typeof filter) { return function (filename) {
filter = function () { return filter.test(filename);
return true; }
}; }(filter);
} }
// fix ZipPath if (zipPath) {
zipPath = zipPath ? fixPath(zipPath) : ""; zipPath = zipPath.split("\\").join("/");
if (zipPath.charAt(zipPath.length - 1) !== "/") {
zipPath += "/";
}
} else {
zipPath = "";
}
// normalize the path first
localPath = pth.normalize(localPath);
localPath = localPath.split("\\").join("/"); //windows fix
if (localPath.charAt(localPath.length - 1) !== "/")
localPath += "/";
// normalize the path first var self = this;
localPath = pth.normalize(localPath); fs.open(localPath, 'r', function (err, fd) {
if (err && err.code === 'ENOENT') {
callback(undefined, Utils.Errors.FILE_NOT_FOUND.replace("%s", localPath));
} else if (err) {
callback(undefined, err);
} else {
var items = Utils.findFiles(localPath);
var i = -1;
var self = this; var next = function () {
fs.open(localPath, 'r', function (err) { i += 1;
if (err && err.code === 'ENOENT') { if (i < items.length) {
callback(undefined, Utils.Errors.FILE_NOT_FOUND.replace("%s", localPath)); var p = items[i].split("\\").join("/").replace(new RegExp(localPath.replace(/(\(|\))/g, '\\$1'), 'i'), ""); //windows fix
} else if (err) { p = p.normalize('NFD').replace(/[\u0300-\u036f]/g, '').replace(/[^\x20-\x7E]/g, '') // accent fix
callback(undefined, err); if (filter(p)) {
} else { if (p.charAt(p.length - 1) !== "/") {
var items = Utils.findFiles(localPath); fs.readFile(items[i], function (err, data) {
var i = -1; if (err) {
callback(undefined, err);
} else {
self.addFile(zipPath + p, data, '', 0);
next();
}
})
} else {
self.addFile(zipPath + p, Buffer.alloc(0), "", 0);
next();
}
} else {
next();
}
var next = function () { } else {
i += 1; callback(true, undefined);
if (i < items.length) { }
var filepath = items[i]; }
var p = pth.relative(localPath, filepath).split("\\").join("/"); //windows fix
p = p.normalize('NFD').replace(/[\u0300-\u036f]/g, '').replace(/[^\x20-\x7E]/g, '') // accent fix
if (filter(p)) {
fs.stat(filepath, function (er0, stats) {
if (er0) callback(undefined, er0);
if (stats.isFile()) {
fs.readFile(filepath, function (er1, data) {
if (er1) {
callback(undefined, er1);
} else {
self.addFile(zipPath + p, data, "", stats);
next();
}
});
} else {
self.addFile(zipPath + p + "/", Buffer.alloc(0), "", stats);
next();
}
});
} else {
next();
}
} else { next();
callback(true, undefined); }
} });
} },
next();
}
});
},
addLocalFolderPromise: function (/*String*/ localPath, /* object */ options) {
return new Promise((resolve, reject) => {
const { filter, zipPath } = Object.assign({}, options);
this.addLocalFolderAsync(localPath,
(done, err) => {
if (err) reject(err);
if (done) resolve(this);
}, zipPath, filter
);
});
},
/** /**
* Allows you to create a entry (file or directory) in the zip file. * Allows you to create a entry (file or directory) in the zip file.
@ -8700,10 +8692,10 @@ module.exports = function (/**String*/input) {
var unix = (entry.isDirectory) ? 0x4000 : 0x8000; var unix = (entry.isDirectory) ? 0x4000 : 0x8000;
if (isStat) { // File attributes from file stats if (isStat) { // File attributes from file stats
unix |= (0xfff & attr.mode); unix |= (0xfff & attr.mode)
}else if ('number' === typeof attr){ // attr from given attr values }else if ('number' === typeof attr){ // attr from given attr values
unix |= (0xfff & attr); unix |= (0xfff & attr);
}else{ // Default values: }else{ // Default values:
unix |= (entry.isDirectory) ? 0o755 : 0o644; // permissions (drwxr-xr-x) or (-r-wr--r--) unix |= (entry.isDirectory) ? 0o755 : 0o644; // permissions (drwxr-xr-x) or (-r-wr--r--)
} }
@ -8785,9 +8777,8 @@ module.exports = function (/**String*/input) {
} }
var name = canonical(child.entryName) var name = canonical(child.entryName)
var childName = sanitize(targetPath, maintainEntryPath ? name : pth.basename(name)); var childName = sanitize(targetPath, maintainEntryPath ? name : pth.basename(name));
// The reverse operation for attr depend on method addFile()
var fileAttr = child.attr ? (((child.attr >>> 0) | 0) >> 16) & 0xfff : 0; Utils.writeFileTo(childName, content, overwrite);
Utils.writeFileTo(childName, content, overwrite, fileAttr);
}); });
return true; return true;
} }
@ -8798,9 +8789,7 @@ module.exports = function (/**String*/input) {
if (fs.existsSync(target) && !overwrite) { if (fs.existsSync(target) && !overwrite) {
throw new Error(Utils.Errors.CANT_OVERRIDE); throw new Error(Utils.Errors.CANT_OVERRIDE);
} }
// The reverse operation for attr depend on method addFile() Utils.writeFileTo(target, content, overwrite);
var fileAttr = item.attr ? (((item.attr >>> 0) | 0) >> 16) & 0xfff : 0;
Utils.writeFileTo(target, content, overwrite, fileAttr);
return true; return true;
}, },
@ -8852,9 +8841,7 @@ module.exports = function (/**String*/input) {
if (!content) { if (!content) {
throw new Error(Utils.Errors.CANT_EXTRACT_FILE); throw new Error(Utils.Errors.CANT_EXTRACT_FILE);
} }
// The reverse operation for attr depend on method addFile() Utils.writeFileTo(entryName, content, overwrite);
var fileAttr = entry.attr ? (((entry.attr >>> 0) | 0) >> 16) & 0xfff : 0;
Utils.writeFileTo(entryName, content, overwrite, fileAttr);
try { try {
fs.utimesSync(entryName, entry.header.time, entry.header.time) fs.utimesSync(entryName, entry.header.time, entry.header.time)
} catch (err) { } catch (err) {
@ -8906,9 +8893,7 @@ module.exports = function (/**String*/input) {
return; return;
} }
// The reverse operation for attr depend on method addFile() Utils.writeFileToAsync(sanitize(targetPath, entryName), content, overwrite, function (succ) {
var fileAttr = entry.attr ? (((entry.attr >>> 0) | 0) >> 16) & 0xfff : 0;
Utils.writeFileToAsync(sanitize(targetPath, entryName), content, overwrite, fileAttr, function (succ) {
try { try {
fs.utimesSync(pth.resolve(targetPath, entryName), entry.header.time, entry.header.time); fs.utimesSync(pth.resolve(targetPath, entryName), entry.header.time, entry.header.time);
} catch (err) { } catch (err) {
@ -8953,27 +8938,6 @@ module.exports = function (/**String*/input) {
} }
}, },
writeZipPromise: function (/**String*/ targetFileName, /* object */ options) {
const { overwrite, perm } = Object.assign({ overwrite: true }, options);
return new Promise((resolve, reject) => {
// find file name
if (!targetFileName && _filename) targetFileName = _filename;
if (!targetFileName) reject("ADM-ZIP: ZIP File Name Missing");
this.toBufferPromise().then((zipData) => {
const ret = (done) => (done ? resolve(done) : reject("ADM-ZIP: Wasn't able to write zip file"));
Utils.writeFileToAsync(targetFileName, zipData, overwrite, perm, ret);
}, reject);
});
},
toBufferPromise: function () {
return new Promise((resolve, reject) => {
_zip.toAsyncBuffer(resolve, reject);
});
},
/** /**
* Returns the content of the entire zip file as a Buffer object * Returns the content of the entire zip file as a Buffer object
* *
@ -10338,17 +10302,17 @@ module.exports = function (/*Buffer*/input) {
getData : function(pass) { getData : function(pass) {
if (_entryHeader.changed) { if (_entryHeader.changed) {
return uncompressedData; return uncompressedData;
} else { } else {
return decompress(false, null, pass); return decompress(false, null, pass);
} }
}, },
getDataAsync : function(/*Function*/callback, pass) { getDataAsync : function(/*Function*/callback, pass) {
if (_entryHeader.changed) { if (_entryHeader.changed) {
callback(uncompressedData); callback(uncompressedData)
} else { } else {
decompress(true, callback, pass); decompress(true, callback, pass)
} }
}, },
@ -10364,20 +10328,14 @@ module.exports = function (/*Buffer*/input) {
}, },
packHeader : function() { packHeader : function() {
// 1. create header (buffer)
var header = _entryHeader.entryHeaderToBinary(); var header = _entryHeader.entryHeaderToBinary();
var addpos = Utils.Constants.CENHDR; // add
// 2. add file name _entryName.copy(header, Utils.Constants.CENHDR);
_entryName.copy(header, addpos);
addpos += _entryName.length;
// 3. add extra data
if (_entryHeader.extraLength) { if (_entryHeader.extraLength) {
_extra.copy(header, addpos); _extra.copy(header, Utils.Constants.CENHDR + _entryName.length)
addpos += _entryHeader.extraLength;
} }
// 4. add file comment
if (_entryHeader.commentLength) { if (_entryHeader.commentLength) {
_comment.copy(header, addpos); _comment.copy(header, Utils.Constants.CENHDR + _entryName.length + _entryHeader.extraLength, _comment.length);
} }
return header; return header;
}, },
@ -11998,14 +11956,12 @@ module.exports = (fromStream, toStream) => {
/***/ }), /***/ }),
/***/ 6214: /***/ 6214:
/***/ ((module, exports) => { /***/ ((module, exports, __nccwpck_require__) => {
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
function isTLSSocket(socket) { const tls_1 = __nccwpck_require__(4016);
return socket.encrypted;
}
const deferToConnect = (socket, fn) => { const deferToConnect = (socket, fn) => {
let listeners; let listeners;
if (typeof fn === 'function') { if (typeof fn === 'function') {
@ -12022,7 +11978,7 @@ const deferToConnect = (socket, fn) => {
if (hasConnectListener) { if (hasConnectListener) {
listeners.connect(); listeners.connect();
} }
if (isTLSSocket(socket) && hasSecureConnectListener) { if (socket instanceof tls_1.TLSSocket && hasSecureConnectListener) {
if (socket.authorized) { if (socket.authorized) {
listeners.secureConnect(); listeners.secureConnect();
} }
@ -16032,7 +15988,7 @@ const is_response_ok_1 = __nccwpck_require__(9298);
const deprecation_warning_1 = __nccwpck_require__(397); const deprecation_warning_1 = __nccwpck_require__(397);
const normalize_arguments_1 = __nccwpck_require__(1048); const normalize_arguments_1 = __nccwpck_require__(1048);
const calculate_retry_delay_1 = __nccwpck_require__(3462); const calculate_retry_delay_1 = __nccwpck_require__(3462);
let globalDnsCache; const globalDnsCache = new cacheable_lookup_1.default();
const kRequest = Symbol('request'); const kRequest = Symbol('request');
const kResponse = Symbol('response'); const kResponse = Symbol('response');
const kResponseSize = Symbol('responseSize'); const kResponseSize = Symbol('responseSize');
@ -16589,9 +16545,6 @@ class Request extends stream_1.Duplex {
options.cacheOptions = { ...options.cacheOptions }; options.cacheOptions = { ...options.cacheOptions };
// `options.dnsCache` // `options.dnsCache`
if (options.dnsCache === true) { if (options.dnsCache === true) {
if (!globalDnsCache) {
globalDnsCache = new cacheable_lookup_1.default();
}
options.dnsCache = globalDnsCache; options.dnsCache = globalDnsCache;
} }
else if (!is_1.default.undefined(options.dnsCache) && !options.dnsCache.lookup) { else if (!is_1.default.undefined(options.dnsCache) && !options.dnsCache.lookup) {

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

36
dist/licenses.txt generated vendored
View file

@ -341,27 +341,27 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
adm-zip adm-zip
MIT MIT
MIT License Copyright (c) 2012 Another-D-Mention Software and other contributors,
http://www.another-d-mention.ro/
Copyright (c) 2012 Another-D-Mention Software and other contributors Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy The above copyright notice and this permission notice shall be
of this software and associated documentation files (the "Software"), to deal included in all copies or substantial portions of the Software.
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
copies or substantial portions of the Software. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
before-after-hook before-after-hook

View file

@ -134,7 +134,7 @@ function getBadge(passed: number, failed: number, skipped: number): string {
function getTestRunsReport(testRuns: TestRunResult[], options: ReportOptions): string[] { function getTestRunsReport(testRuns: TestRunResult[], options: ReportOptions): string[] {
const sections: string[] = [] const sections: string[] = []
if (testRuns.length > 1) { if (testRuns.length > 1 || options.onlySummary) {
const tableData = testRuns.map((tr, runIndex) => { const tableData = testRuns.map((tr, runIndex) => {
const time = formatTime(tr.time) const time = formatTime(tr.time)
const name = tr.path const name = tr.path