Skip to content

Commit

Permalink
chore(report-portal): run reports only when env is setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Birkbjo committed Dec 11, 2023
1 parent dadd613 commit c2bda74
Showing 1 changed file with 32 additions and 25 deletions.
57 changes: 32 additions & 25 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
const reportPortalConfig = [
'@reportportal/agent-js-jest',
{
apiKey: process.env.REPORTPORTAL_API_KEY,
endpoint: process.env.REPORTPORTAL_ENDPOINT,
project: process.env.REPORTPORTAL_PROJECT,
launch: 'aggregate_data_entry_app_master',
attributes: [
{
key: 'version',
value: 'master',
},
{
key: 'app_name',
value: 'aggregate_data_entry_app',
},
{
key: 'test_level',
value: 'unit/integration',
},
],
description: '',
debug: true,
},
]

const isReportPortalSetup =
process.env.REPORTPORTAL_API_KEY !== undefined &&
process.env.REPORTPORTAL_ENDPOINT !== undefined &&
process.env.REPORTPORTAL_PROJECT !== undefined

module.exports = {
setupFilesAfterEnv: ['<rootDir>/src/test-utils/setup-tests.js'],
collectCoverageFrom: ['src/**/*.{js,jsx}'],
Expand All @@ -12,30 +43,6 @@ module.exports = {
testRunner: 'jest-circus/runner',
reporters: [
'default',
[
'@reportportal/agent-js-jest',
{
apiKey: process.env.REPORTPORTAL_API_KEY,
endpoint: process.env.REPORTPORTAL_ENDPOINT,
project: process.env.REPORTPORTAL_PROJECT,
launch: 'aggregate_data_entry_app_master',
attributes: [
{
key: 'version',
value: 'master',
},
{
key: 'app_name',
value: 'aggregate_data_entry_app',
},
{
key: 'test_level',
value: 'unit/integration',
},
],
description: '',
debug: true,
},
],
...(isReportPortalSetup ? [reportPortalConfig] : []),
],
}

0 comments on commit c2bda74

Please sign in to comment.