Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding prodBuild param for scanner alt env #1830

Open
wants to merge 1 commit into
base: CS_snapshot_queue_1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/client/src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ export class PercyClient {
partial: this.env.partial,
tags: tagsArr,
'cli-start-time': cliStartTime,
source: source
source: source,
'prod-build': this.config.percy?.prodBuild
},
relationships: {
resources: {
Expand Down
45 changes: 45 additions & 0 deletions packages/client/test/client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ describe('PercyClient', () => {

describe('#createBuild()', () => {
let cliStartTime = new Date().toISOString();
beforeEach(() => {
delete process.env.PERCY_AUTO_ENABLED_GROUP_BUILD;
});

it('creates a new build', async () => {
await expectAsync(client.createBuild()).toBeResolvedTo({
data: {
Expand Down Expand Up @@ -384,6 +388,47 @@ describe('PercyClient', () => {
}
}));
});

it('creates a new build with prodBuild config', async () => {
client = new PercyClient({
token: 'PERCY_TOKEN',
config: { percy: { prodBuild: true } }
});
await expectAsync(client.createBuild({ projectType: 'web' })).toBeResolvedTo({
data: {
id: '123',
attributes: {
'build-number': 1,
'web-url': 'https://percy.io/test/test/123'
}
}
});

expect(api.requests['/builds'][0].body.data)
.toEqual(jasmine.objectContaining({
attributes: {
branch: client.env.git.branch,
type: 'web',
'target-branch': client.env.target.branch,
'target-commit-sha': client.env.target.commit,
'commit-sha': client.env.git.sha,
'commit-committed-at': client.env.git.committedAt,
'commit-author-name': client.env.git.authorName,
'commit-author-email': client.env.git.authorEmail,
'commit-committer-name': client.env.git.committerName,
'commit-committer-email': client.env.git.committerEmail,
'commit-message': client.env.git.message,
'pull-request-number': client.env.pullRequest,
'parallel-nonce': client.env.parallel.nonce,
'parallel-total-shards': client.env.parallel.total,
'cli-start-time': null,
source: 'user_created',
partial: client.env.partial,
'prod-build': true,
tags: []
}
}));
});
});

describe('#getBuild()', () => {
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export const configSchema = {
},
labels: {
type: 'string'
},
prodBuild: {
type: 'boolean',
default: false
}
}
},
Expand Down
Loading