Skip to content

Commit

Permalink
feat: Print links to assets (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexplischke authored Jun 8, 2023
1 parent 77d54a4 commit 5131fd2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ module.exports = function () {
.write(`* ${browserTestRun.browser}: ${this.chalk.blue.underline(job.url)}`)
.newline();

if (job.assets.length > 0) {
this.write(` ${this.chalk.bold('Assets:')}`)
.newline();
}
for (const asset of job.assets) {
this.write(` - ${this.chalk.blue.underline(asset)}`);
}

await this.reporter.reportTestRun(fixture, browserTestRun, job.id);
resolve(job.id);
} catch (e) {
Expand Down
10 changes: 10 additions & 0 deletions src/job-reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ const { TestComposer } = require('@saucelabs/testcomposer');
const { TestRuns: TestRunsAPI } = require('./api');
const { CI } = require('./ci');

const assetsURLMap = new Map([
['us-west-1', 'https://assets.saucelabs.com'],
['eu-central-1', 'https://assets.eu-central-1.saucelabs.com'],
['staging', 'https://assets.staging.saucelabs.net']
]);

class JobReporter {
constructor (logger = console, opts = {}) {
this.log = logger;
Expand Down Expand Up @@ -147,8 +153,12 @@ class JobReporter {
browserVersion: session.browserVersion,
platformName: session.platformName,
});
job.assets = [];
const baseURL = assetsURLMap.get(this.region);

const assets = session.assets.map((a) => {
job.assets.push(`${baseURL}/jobs/${job.id}/${a.name}`);

return {
filename: a.name,
data: fs.createReadStream(a.localPath)
Expand Down

0 comments on commit 5131fd2

Please sign in to comment.