New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@smartbear/one-report-publisher

Package Overview
Dependencies
Maintainers
14
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@smartbear/one-report-publisher - npm Package Compare versions

Comparing version 0.7.0 to 0.8.0

5

dist/cjs/src/manyglob.js

@@ -68,2 +68,3 @@ "use strict";

var os = __importStar(require("os"));
var path_1 = __importDefault(require("path"));
function manyglob(globs) {

@@ -74,3 +75,5 @@ return __awaiter(this, void 0, void 0, function () {

case 0: return [4 /*yield*/, Promise.all(globs.reduce(function (prev, glob) {
return prev.concat((0, fast_glob_1.default)(glob.replace(/^~/, os.homedir())));
// Globs must always use forward slashes - even on Windows
var homeDir = os.homedir().split(path_1.default.sep).join(path_1.default.posix.sep);
return prev.concat((0, fast_glob_1.default)(glob.replace(/^~/, homeDir)));
}, []))];

@@ -77,0 +80,0 @@ case 1: return [2 /*return*/, (_a.sent()).flatMap(function (paths) { return paths; })];

21

dist/cjs/src/publish.js

@@ -74,2 +74,8 @@ "use strict";

};
var urlExtensionPath = {
'.xml': 'junit-xml',
'.json': 'cucumber-json',
'.ndjson': 'cucumber-messages',
'.zip': 'zip',
};
/**

@@ -89,3 +95,3 @@ * Publishes test results to OneReport

return __awaiter(this, void 0, void 0, function () {
var authHeaders, url, ciEnv, paths, publishPaths, _a;
var authHeaders, ciEnv, paths, publishPaths, _a;
return __generator(this, function (_b) {

@@ -101,3 +107,2 @@ switch (_b.label) {

authHeaders = authenticate();
url = new url_1.URL("/api/project/".concat(encodeURIComponent(projectId), "/test-cycle"), baseUrl);
ciEnv = (0, ci_environment_1.default)(env);

@@ -122,3 +127,5 @@ return [4 /*yield*/, (0, manyglob_js_1.manyglob)(globs)];

publishPaths = _a;
return [2 /*return*/, Promise.all(publishPaths.map(function (path) { return publishFile(path, url, ciEnv, authHeaders, requestTimeout); }))];
return [2 /*return*/, Promise.all(publishPaths.map(function (path) {
return publishFile(path, getUrl(path, baseUrl, projectId), ciEnv, authHeaders, requestTimeout);
}))];
}

@@ -193,2 +200,10 @@ });

}
function getUrl(path, baseUrl, projectId) {
var ext = (0, path_1.extname)(path);
if (!extensions.includes(ext)) {
throw new Error("Unsupported extension: ".concat(ext));
}
var urlExtension = urlExtensionPath[ext];
return new url_1.URL("/api/project/".concat(encodeURIComponent(projectId), "/").concat(encodeURIComponent(urlExtension)), baseUrl);
}
//# sourceMappingURL=publish.js.map

@@ -68,3 +68,3 @@ "use strict";

var os = __importStar(require("os"));
var path_1 = __importDefault(require("path"));
var path_1 = require("path");
var util_1 = require("util");

@@ -89,3 +89,3 @@ var manyglob_js_1 = require("../src/manyglob.js");

it('expands ~ to home dir', function () { return __awaiter(void 0, void 0, void 0, function () {
var tmp, homeTmp, wanted, paths;
var tmp, homeTmp, wanted, paths, normalizedPaths;
return __generator(this, function (_a) {

@@ -95,3 +95,3 @@ switch (_a.label) {

tmp = 'one-report-publisher-test-' + Date.now();
homeTmp = path_1.default.join(os.homedir(), tmp);
homeTmp = (0, path_1.join)(os.homedir(), tmp);
_a.label = 1;

@@ -103,3 +103,3 @@ case 1:

_a.sent();
wanted = path_1.default.join(homeTmp, 'file.txt');
wanted = (0, path_1.join)(homeTmp, 'file.txt');
return [4 /*yield*/, writeFile(wanted, '')];

@@ -111,3 +111,4 @@ case 3:

paths = _a.sent();
assert_1.default.deepStrictEqual(paths, [wanted]);
normalizedPaths = paths.map(path_1.normalize);
assert_1.default.deepStrictEqual(normalizedPaths, [wanted]);
return [3 /*break*/, 7];

@@ -114,0 +115,0 @@ case 5: return [4 /*yield*/, rm(homeTmp, { recursive: true })];

@@ -148,3 +148,3 @@ "use strict";

_k = {
url: "/api/project/".concat(projectId, "/test-cycle")
url: "/api/project/".concat(projectId, "/cucumber-json")
};

@@ -173,3 +173,3 @@ _l = {

_m = {
url: "/api/project/".concat(projectId, "/test-cycle")
url: "/api/project/".concat(projectId, "/junit-xml")
};

@@ -198,3 +198,3 @@ _o = {

_p = {
url: "/api/project/".concat(projectId, "/test-cycle")
url: "/api/project/".concat(projectId, "/cucumber-messages")
};

@@ -223,3 +223,3 @@ _q = {

_r = {
url: "/api/project/".concat(projectId, "/test-cycle")
url: "/api/project/".concat(projectId, "/zip")
};

@@ -281,3 +281,3 @@ _s = {

{
url: "/api/project/".concat(projectId, "/test-cycle"),
url: "/api/project/".concat(projectId, "/zip"),
headers: {

@@ -291,3 +291,3 @@ 'content-type': 'application/zip',

{
url: "/api/project/".concat(projectId, "/test-cycle"),
url: "/api/project/".concat(projectId, "/zip"),
headers: {

@@ -342,3 +342,3 @@ 'content-type': 'application/zip',

}, {
message: "Unexpected status code 401\nPOST http://localhost:".concat(port, "/api/project/32C46057-0AB6-44E8-8944-0246E0BEA96F/test-cycle -d @test/fixtures/junit.xml\n> Content-Type: text/xml\n> Content-Length: 359\n> OneReport-SourceControl: https://github.com/SmartBear/one-report-publisher.git\n> OneReport-Revision: f7d967d6d4f7adc1d6657bda88f4e976c879d74c\n> OneReport-Branch: main\n\n< date: ").concat(responseDate, "\n< connection: close\n< content-length: 24\n\nYou need to authenticate\n"),
message: "Unexpected status code 401\nPOST http://localhost:".concat(port, "/api/project/32C46057-0AB6-44E8-8944-0246E0BEA96F/junit-xml -d @test/fixtures/junit.xml\n> Content-Type: text/xml\n> Content-Length: 359\n> OneReport-SourceControl: https://github.com/SmartBear/one-report-publisher.git\n> OneReport-Revision: f7d967d6d4f7adc1d6657bda88f4e976c879d74c\n> OneReport-Branch: main\n\n< date: ").concat(responseDate, "\n< connection: close\n< content-length: 24\n\nYou need to authenticate\n"),
})];

@@ -345,0 +345,0 @@ case 1:

@@ -12,6 +12,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

import * as os from 'os';
import path from 'path';
export function manyglob(globs) {
return __awaiter(this, void 0, void 0, function* () {
return (yield Promise.all(globs.reduce((prev, glob) => {
return prev.concat(fg(glob.replace(/^~/, os.homedir())));
// Globs must always use forward slashes - even on Windows
const homeDir = os.homedir().split(path.sep).join(path.posix.sep);
return prev.concat(fg(glob.replace(/^~/, homeDir)));
}, []))).flatMap((paths) => paths);

@@ -18,0 +21,0 @@ });

@@ -30,2 +30,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
const urlExtensionPath = {
'.xml': 'junit-xml',
'.json': 'cucumber-json',
'.ndjson': 'cucumber-messages',
'.zip': 'zip',
};
/**

@@ -52,3 +58,2 @@ * Publishes test results to OneReport

const authHeaders = authenticate();
const url = new URL(`/api/project/${encodeURIComponent(projectId)}/test-cycle`, baseUrl);
const ciEnv = ciEnvironment(env);

@@ -62,3 +67,3 @@ const paths = (yield manyglob(globs))

const publishPaths = zip ? yield zipPaths(paths) : paths;
return Promise.all(publishPaths.map((path) => publishFile(path, url, ciEnv, authHeaders, requestTimeout)));
return Promise.all(publishPaths.map((path) => publishFile(path, getUrl(path, baseUrl, projectId), ciEnv, authHeaders, requestTimeout)));
});

@@ -126,2 +131,10 @@ }

}
function getUrl(path, baseUrl, projectId) {
const ext = extname(path);
if (!extensions.includes(ext)) {
throw new Error(`Unsupported extension: ${ext}`);
}
const urlExtension = urlExtensionPath[ext];
return new URL(`/api/project/${encodeURIComponent(projectId)}/${encodeURIComponent(urlExtension)}`, baseUrl);
}
//# sourceMappingURL=publish.js.map

@@ -13,3 +13,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

import * as os from 'os';
import path from 'path';
import { join, normalize } from 'path';
import { promisify } from 'util';

@@ -27,9 +27,10 @@ import { manyglob } from '../src/manyglob.js';

const tmp = 'one-report-publisher-test-' + Date.now();
const homeTmp = path.join(os.homedir(), tmp);
const homeTmp = join(os.homedir(), tmp);
try {
yield mkdir(homeTmp, { recursive: true });
const wanted = path.join(homeTmp, 'file.txt');
const wanted = join(homeTmp, 'file.txt');
yield writeFile(wanted, '');
const paths = yield manyglob([`~/${tmp}/*.txt`]);
assert.deepStrictEqual(paths, [wanted]);
const normalizedPaths = paths.map(normalize);
assert.deepStrictEqual(normalizedPaths, [wanted]);
}

@@ -36,0 +37,0 @@ finally {

@@ -91,3 +91,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

{
url: `/api/project/${projectId}/test-cycle`,
url: `/api/project/${projectId}/cucumber-json`,
headers: {

@@ -106,3 +106,3 @@ 'content-type': 'application/json',

{
url: `/api/project/${projectId}/test-cycle`,
url: `/api/project/${projectId}/junit-xml`,
headers: {

@@ -121,3 +121,3 @@ 'content-type': 'text/xml',

{
url: `/api/project/${projectId}/test-cycle`,
url: `/api/project/${projectId}/cucumber-messages`,
headers: {

@@ -136,3 +136,3 @@ 'content-type': 'application/x-ndjson',

{
url: `/api/project/${projectId}/test-cycle`,
url: `/api/project/${projectId}/zip`,
headers: {

@@ -176,3 +176,3 @@ 'content-type': 'application/zip',

{
url: `/api/project/${projectId}/test-cycle`,
url: `/api/project/${projectId}/zip`,
headers: {

@@ -186,3 +186,3 @@ 'content-type': 'application/zip',

{
url: `/api/project/${projectId}/test-cycle`,
url: `/api/project/${projectId}/zip`,
headers: {

@@ -229,3 +229,3 @@ 'content-type': 'application/zip',

message: `Unexpected status code 401
POST http://localhost:${port}/api/project/32C46057-0AB6-44E8-8944-0246E0BEA96F/test-cycle -d @test/fixtures/junit.xml
POST http://localhost:${port}/api/project/32C46057-0AB6-44E8-8944-0246E0BEA96F/junit-xml -d @test/fixtures/junit.xml
> Content-Type: text/xml

@@ -232,0 +232,0 @@ > Content-Length: 359

{
"name": "@smartbear/one-report-publisher",
"version": "0.7.0",
"version": "0.8.0",
"description": "Publish Test Results to SmartBear OneReport",

@@ -5,0 +5,0 @@ "type": "module",

@@ -5,3 +5,3 @@ [![Run Tests](https://github.com/SmartBear/one-report-publisher/actions/workflows/test.yaml/badge.svg)](https://github.com/SmartBear/one-report-publisher/actions/workflows/test.yaml)

This is a tool that publishes test results to SmartBear OneReport. It is intended to be used in Continuous Integration workflows.
This is a tool that publishes test results (test cycles) to SmartBear OneReport. It is intended to be used in Continuous Integration workflows.

@@ -8,0 +8,0 @@ The tool supports the following file formats:

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc