mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-17 06:47:09 +01:00
Merge fe8fe90f0e into 8848447e3f
This commit is contained in:
commit
3faf8fb999
9 changed files with 286 additions and 105 deletions
19
__tests__/__outputs__/jest-test-errors-results.md
Normal file
19
__tests__/__outputs__/jest-test-errors-results.md
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|

|
||||||
|
## ❌ <a id="user-content-r0" href="#r0">fixtures/test-errors/jest/jest-test-results.xml</a>
|
||||||
|
**2** tests were completed in **646ms** with **0** passed, **2** failed and **0** skipped.
|
||||||
|
|Test suite|Passed|Failed|Skipped|Time|
|
||||||
|
|:---|---:|---:|---:|---:|
|
||||||
|
|[libs/bar.spec.ts](#r0s0)||1❌||0ms|
|
||||||
|
|[libs/foo.spec.ts](#r0s1)||1❌||0ms|
|
||||||
|
### ❌ <a id="user-content-r0s0" href="#r0s0">libs/bar.spec.ts</a>
|
||||||
|
```
|
||||||
|
Test suite failed to run
|
||||||
|
❌ libs/bar.spec.ts
|
||||||
|
● Test suite failed to run
|
||||||
|
```
|
||||||
|
### ❌ <a id="user-content-r0s1" href="#r0s1">libs/foo.spec.ts</a>
|
||||||
|
```
|
||||||
|
Test suite failed to run
|
||||||
|
❌ libs/foo.spec.ts
|
||||||
|
● Test suite failed to run
|
||||||
|
```
|
||||||
|
|
@ -1,5 +1,68 @@
|
||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`jest-junit tests jest testsuite errors example test results matches snapshot 1`] = `
|
||||||
|
TestRunResult {
|
||||||
|
"path": "fixtures/test-errors/jest/jest-test-results.xml",
|
||||||
|
"suites": Array [
|
||||||
|
TestSuiteResult {
|
||||||
|
"groups": Array [
|
||||||
|
TestGroupResult {
|
||||||
|
"name": "Test suite failed to run",
|
||||||
|
"tests": Array [
|
||||||
|
TestCaseResult {
|
||||||
|
"error": Object {
|
||||||
|
"details": " ● Test suite failed to run
|
||||||
|
|
||||||
|
tsconfig.json:13:3 - error TS6258: 'typeRoots' should be set inside the 'compilerOptions' object of the config json file
|
||||||
|
|
||||||
|
13 \\"typeRoots\\": [\\"./src/lib/types\\", \\"./node_modules/@types\\"],
|
||||||
|
~~~~~~~~~~~
|
||||||
|
",
|
||||||
|
"line": undefined,
|
||||||
|
"path": undefined,
|
||||||
|
},
|
||||||
|
"name": "libs/foo.spec.ts",
|
||||||
|
"result": "failed",
|
||||||
|
"time": 0,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"name": "libs/foo.spec.ts",
|
||||||
|
"totalTime": 0,
|
||||||
|
},
|
||||||
|
TestSuiteResult {
|
||||||
|
"groups": Array [
|
||||||
|
TestGroupResult {
|
||||||
|
"name": "Test suite failed to run",
|
||||||
|
"tests": Array [
|
||||||
|
TestCaseResult {
|
||||||
|
"error": Object {
|
||||||
|
"details": " ● Test suite failed to run
|
||||||
|
|
||||||
|
tsconfig.json:13:3 - error TS6258: 'typeRoots' should be set inside the 'compilerOptions' object of the config json file
|
||||||
|
|
||||||
|
13 \\"typeRoots\\": [\\"./src/lib/types\\", \\"./node_modules/@types\\"],
|
||||||
|
~~~~~~~~~~~
|
||||||
|
",
|
||||||
|
"line": undefined,
|
||||||
|
"path": undefined,
|
||||||
|
},
|
||||||
|
"name": "libs/bar.spec.ts",
|
||||||
|
"result": "failed",
|
||||||
|
"time": 0,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"name": "libs/bar.spec.ts",
|
||||||
|
"totalTime": 0,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"totalTime": 646,
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`jest-junit tests report from ./reports/jest test results matches snapshot 1`] = `
|
exports[`jest-junit tests report from ./reports/jest test results matches snapshot 1`] = `
|
||||||
TestRunResult {
|
TestRunResult {
|
||||||
"path": "fixtures/jest-junit.xml",
|
"path": "fixtures/jest-junit.xml",
|
||||||
|
|
|
||||||
3
__tests__/fixtures/test-errors/jest/files.txt
Normal file
3
__tests__/fixtures/test-errors/jest/files.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
libs/bar.spec.ts
|
||||||
|
libs/foo.spec.ts
|
||||||
|
tsconfig.json
|
||||||
25
__tests__/fixtures/test-errors/jest/jest-test-results.xml
Normal file
25
__tests__/fixtures/test-errors/jest/jest-test-results.xml
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<testsuites name="jest tests" tests="0" failures="0" errors="2" time="0.646">
|
||||||
|
<testsuite name="libs/foo.spec.ts" errors="1" failures="0" skipped="0" timestamp="1970-01-01T00:00:00" time="0" tests="0">
|
||||||
|
<testcase classname="Test suite failed to run" name="libs/foo.spec.ts" time="0">
|
||||||
|
<error> ● Test suite failed to run
|
||||||
|
|
||||||
|
tsconfig.json:13:3 - error TS6258: 'typeRoots' should be set inside the 'compilerOptions' object of the config json file
|
||||||
|
|
||||||
|
13 "typeRoots": ["./src/lib/types", "./node_modules/@types"],
|
||||||
|
~~~~~~~~~~~
|
||||||
|
</error>
|
||||||
|
</testcase>
|
||||||
|
</testsuite>
|
||||||
|
<testsuite name="libs/bar.spec.ts" errors="1" failures="0" skipped="0" timestamp="1970-01-01T00:00:00" time="0" tests="0">
|
||||||
|
<testcase classname="Test suite failed to run" name="libs/bar.spec.ts" time="0">
|
||||||
|
<error> ● Test suite failed to run
|
||||||
|
|
||||||
|
tsconfig.json:13:3 - error TS6258: 'typeRoots' should be set inside the 'compilerOptions' object of the config json file
|
||||||
|
|
||||||
|
13 "typeRoots": ["./src/lib/types", "./node_modules/@types"],
|
||||||
|
~~~~~~~~~~~
|
||||||
|
</error>
|
||||||
|
</testcase>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
|
@ -66,4 +66,27 @@ describe('jest-junit tests', () => {
|
||||||
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
|
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
|
||||||
fs.writeFileSync(outputPath, report)
|
fs.writeFileSync(outputPath, report)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('jest testsuite errors example test results matches snapshot', async () => {
|
||||||
|
const fixturePath = path.join(__dirname, 'fixtures', 'test-errors', 'jest', 'jest-test-results.xml')
|
||||||
|
const trackedFilesPath = path.join(__dirname, 'fixtures', 'test-errors', 'jest', 'files.txt')
|
||||||
|
const outputPath = path.join(__dirname, '__outputs__', 'jest-test-errors-results.md')
|
||||||
|
const filePath = normalizeFilePath(path.relative(__dirname, fixturePath))
|
||||||
|
const fileContent = fs.readFileSync(fixturePath, {encoding: 'utf8'})
|
||||||
|
|
||||||
|
const trackedFiles = fs.readFileSync(trackedFilesPath, {encoding: 'utf8'}).split(/\n\r?/g)
|
||||||
|
const opts: ParseOptions = {
|
||||||
|
parseErrors: true,
|
||||||
|
trackedFiles
|
||||||
|
//workDir: '/home/dorny/dorny/jest/'
|
||||||
|
}
|
||||||
|
|
||||||
|
const parser = new JestJunitParser(opts)
|
||||||
|
const result = await parser.parse(filePath, fileContent)
|
||||||
|
expect(result).toMatchSnapshot()
|
||||||
|
|
||||||
|
const report = getReport([result])
|
||||||
|
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
|
||||||
|
fs.writeFileSync(outputPath, report)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
249
dist/index.js
generated
vendored
249
dist/index.js
generated
vendored
|
|
@ -1089,17 +1089,17 @@ class JestJunitParser {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
getTestCaseResult(test) {
|
getTestCaseResult(test) {
|
||||||
if (test.failure)
|
if (test.failure || test.error)
|
||||||
return 'failed';
|
return 'failed';
|
||||||
if (test.skipped)
|
if (test.skipped)
|
||||||
return 'skipped';
|
return 'skipped';
|
||||||
return 'success';
|
return 'success';
|
||||||
}
|
}
|
||||||
getTestCaseError(tc) {
|
getTestCaseError(tc) {
|
||||||
if (!this.options.parseErrors || !tc.failure) {
|
if (!this.options.parseErrors || !(tc.failure || tc.error)) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
const details = tc.failure[0];
|
const details = tc.failure ? tc.failure[0] : tc.error ? tc.error[0] : 'unknown failure';
|
||||||
let path;
|
let path;
|
||||||
let line;
|
let line;
|
||||||
const src = node_utils_1.getExceptionSource(details, this.options.trackedFiles, file => this.getRelativePath(file));
|
const src = node_utils_1.getExceptionSource(details, this.options.trackedFiles, file => this.getRelativePath(file));
|
||||||
|
|
@ -8354,13 +8354,12 @@ module.exports = function (/**String*/input) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function fixPath(zipPath){
|
function fixPath(zipPath){
|
||||||
// convert windows file separators
|
// convert windows file separators and normalize
|
||||||
zipPath = zipPath.split("\\").join("/");
|
zipPath = pth.posix.normalize(zipPath.split("\\").join("/"));
|
||||||
// add separator if it wasnt given
|
// cleanup, remove invalid folder names
|
||||||
if (zipPath.charAt(zipPath.length - 1) !== "/") {
|
var names = zipPath.split("/").filter((c) => c !== "" && c !== "." && c !== "..");
|
||||||
zipPath += "/";
|
// if we have name we return it
|
||||||
}
|
return names.length ? names.join("/") + "/" : "";
|
||||||
return zipPath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
@ -8526,7 +8525,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
|
||||||
|
|
@ -8546,7 +8545,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);
|
||||||
|
|
@ -8573,10 +8572,11 @@ 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)) {
|
||||||
if (filepath.charAt(filepath.length - 1) !== pth.sep) {
|
var stats = fs.statSync(filepath);
|
||||||
self.addFile(zipPath + p, fs.readFileSync(filepath), "", fs.statSync(filepath));
|
if (stats.isFile()) {
|
||||||
|
self.addFile(zipPath + p, fs.readFileSync(filepath), "", stats);
|
||||||
} else {
|
} else {
|
||||||
self.addFile(zipPath + p + '/', Buffer.alloc(0), "", 0);
|
self.addFile(zipPath + p + '/', Buffer.alloc(0), "", stats);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -8594,75 +8594,83 @@ 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 === undefined) {
|
if (filter instanceof RegExp) {
|
||||||
filter = function () {
|
filter = (function (rx) {
|
||||||
return true;
|
return function (filename) {
|
||||||
};
|
return rx.test(filename);
|
||||||
} else if (filter instanceof RegExp) {
|
};
|
||||||
filter = function (filter) {
|
})(filter);
|
||||||
return function (filename) {
|
} else if ("function" !== typeof filter) {
|
||||||
return filter.test(filename);
|
filter = function () {
|
||||||
}
|
return true;
|
||||||
}(filter);
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zipPath) {
|
// fix ZipPath
|
||||||
zipPath = zipPath.split("\\").join("/");
|
zipPath = zipPath ? fixPath(zipPath) : "";
|
||||||
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 += "/";
|
|
||||||
|
|
||||||
var self = this;
|
// normalize the path first
|
||||||
fs.open(localPath, 'r', function (err, fd) {
|
localPath = pth.normalize(localPath);
|
||||||
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 next = function () {
|
var self = this;
|
||||||
i += 1;
|
fs.open(localPath, 'r', function (err) {
|
||||||
if (i < items.length) {
|
if (err && err.code === 'ENOENT') {
|
||||||
var p = items[i].split("\\").join("/").replace(new RegExp(localPath.replace(/(\(|\))/g, '\\$1'), 'i'), ""); //windows fix
|
callback(undefined, Utils.Errors.FILE_NOT_FOUND.replace("%s", localPath));
|
||||||
p = p.normalize('NFD').replace(/[\u0300-\u036f]/g, '').replace(/[^\x20-\x7E]/g, '') // accent fix
|
} else if (err) {
|
||||||
if (filter(p)) {
|
callback(undefined, err);
|
||||||
if (p.charAt(p.length - 1) !== "/") {
|
} else {
|
||||||
fs.readFile(items[i], function (err, data) {
|
var items = Utils.findFiles(localPath);
|
||||||
if (err) {
|
var i = -1;
|
||||||
callback(undefined, err);
|
|
||||||
} else {
|
|
||||||
self.addFile(zipPath + p, data, '', 0);
|
|
||||||
next();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
self.addFile(zipPath + p, Buffer.alloc(0), "", 0);
|
|
||||||
next();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
next();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
var next = function () {
|
||||||
callback(true, undefined);
|
i += 1;
|
||||||
}
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
next();
|
} else {
|
||||||
}
|
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.
|
||||||
|
|
@ -8696,10 +8704,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--)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -8781,8 +8789,9 @@ 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()
|
||||||
Utils.writeFileTo(childName, content, overwrite);
|
var fileAttr = child.attr ? (((child.attr >>> 0) | 0) >> 16) & 0xfff : 0;
|
||||||
|
Utils.writeFileTo(childName, content, overwrite, fileAttr);
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -8793,7 +8802,9 @@ 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);
|
||||||
}
|
}
|
||||||
Utils.writeFileTo(target, content, overwrite);
|
// The reverse operation for attr depend on method addFile()
|
||||||
|
var fileAttr = item.attr ? (((item.attr >>> 0) | 0) >> 16) & 0xfff : 0;
|
||||||
|
Utils.writeFileTo(target, content, overwrite, fileAttr);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
@ -8845,7 +8856,9 @@ 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);
|
||||||
}
|
}
|
||||||
Utils.writeFileTo(entryName, content, overwrite);
|
// The reverse operation for attr depend on method addFile()
|
||||||
|
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) {
|
||||||
|
|
@ -8897,7 +8910,9 @@ module.exports = function (/**String*/input) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.writeFileToAsync(sanitize(targetPath, entryName), content, overwrite, function (succ) {
|
// The reverse operation for attr depend on method addFile()
|
||||||
|
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) {
|
||||||
|
|
@ -8942,6 +8957,27 @@ 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
|
||||||
*
|
*
|
||||||
|
|
@ -10306,17 +10342,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);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -10332,14 +10368,20 @@ module.exports = function (/*Buffer*/input) {
|
||||||
},
|
},
|
||||||
|
|
||||||
packHeader : function() {
|
packHeader : function() {
|
||||||
|
// 1. create header (buffer)
|
||||||
var header = _entryHeader.entryHeaderToBinary();
|
var header = _entryHeader.entryHeaderToBinary();
|
||||||
// add
|
var addpos = Utils.Constants.CENHDR;
|
||||||
_entryName.copy(header, Utils.Constants.CENHDR);
|
// 2. add file name
|
||||||
|
_entryName.copy(header, addpos);
|
||||||
|
addpos += _entryName.length;
|
||||||
|
// 3. add extra data
|
||||||
if (_entryHeader.extraLength) {
|
if (_entryHeader.extraLength) {
|
||||||
_extra.copy(header, Utils.Constants.CENHDR + _entryName.length)
|
_extra.copy(header, addpos);
|
||||||
|
addpos += _entryHeader.extraLength;
|
||||||
}
|
}
|
||||||
|
// 4. add file comment
|
||||||
if (_entryHeader.commentLength) {
|
if (_entryHeader.commentLength) {
|
||||||
_comment.copy(header, Utils.Constants.CENHDR + _entryName.length + _entryHeader.extraLength, _comment.length);
|
_comment.copy(header, addpos);
|
||||||
}
|
}
|
||||||
return header;
|
return header;
|
||||||
},
|
},
|
||||||
|
|
@ -11960,12 +12002,14 @@ module.exports = (fromStream, toStream) => {
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 6214:
|
/***/ 6214:
|
||||||
/***/ ((module, exports, __nccwpck_require__) => {
|
/***/ ((module, exports) => {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const tls_1 = __nccwpck_require__(4016);
|
function isTLSSocket(socket) {
|
||||||
|
return socket.encrypted;
|
||||||
|
}
|
||||||
const deferToConnect = (socket, fn) => {
|
const deferToConnect = (socket, fn) => {
|
||||||
let listeners;
|
let listeners;
|
||||||
if (typeof fn === 'function') {
|
if (typeof fn === 'function') {
|
||||||
|
|
@ -11982,7 +12026,7 @@ const deferToConnect = (socket, fn) => {
|
||||||
if (hasConnectListener) {
|
if (hasConnectListener) {
|
||||||
listeners.connect();
|
listeners.connect();
|
||||||
}
|
}
|
||||||
if (socket instanceof tls_1.TLSSocket && hasSecureConnectListener) {
|
if (isTLSSocket(socket) && hasSecureConnectListener) {
|
||||||
if (socket.authorized) {
|
if (socket.authorized) {
|
||||||
listeners.secureConnect();
|
listeners.secureConnect();
|
||||||
}
|
}
|
||||||
|
|
@ -15992,7 +16036,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);
|
||||||
const globalDnsCache = new cacheable_lookup_1.default();
|
let globalDnsCache;
|
||||||
const kRequest = Symbol('request');
|
const kRequest = Symbol('request');
|
||||||
const kResponse = Symbol('response');
|
const kResponse = Symbol('response');
|
||||||
const kResponseSize = Symbol('responseSize');
|
const kResponseSize = Symbol('responseSize');
|
||||||
|
|
@ -16549,6 +16593,9 @@ 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
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
|
|
@ -71,17 +71,17 @@ export class JestJunitParser implements TestParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
private getTestCaseResult(test: TestCase): TestExecutionResult {
|
private getTestCaseResult(test: TestCase): TestExecutionResult {
|
||||||
if (test.failure) return 'failed'
|
if (test.failure || test.error) return 'failed'
|
||||||
if (test.skipped) return 'skipped'
|
if (test.skipped) return 'skipped'
|
||||||
return 'success'
|
return 'success'
|
||||||
}
|
}
|
||||||
|
|
||||||
private getTestCaseError(tc: TestCase): TestCaseError | undefined {
|
private getTestCaseError(tc: TestCase): TestCaseError | undefined {
|
||||||
if (!this.options.parseErrors || !tc.failure) {
|
if (!this.options.parseErrors || !(tc.failure || tc.error)) {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
const details = tc.failure[0]
|
const details = tc.failure ? tc.failure[0] : tc.error ? tc.error[0] : 'unknown failure'
|
||||||
let path
|
let path
|
||||||
let line
|
let line
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,4 +31,5 @@ export interface TestCase {
|
||||||
}
|
}
|
||||||
failure?: string[]
|
failure?: string[]
|
||||||
skipped?: string[]
|
skipped?: string[]
|
||||||
|
error?: string[]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue