mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +03:00
chore(ci, console): Prioritize the Chromatic diagnostic file over the CLI error
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8090 GitOrigin-RevId: 557c051bd0d0706897c08163bfbefaf9d0fe546c
This commit is contained in:
parent
f45928b03b
commit
926b8c272e
@ -49,65 +49,7 @@ _Sent with 💌 from the frontenders of the Hasura Platform team_.
|
||||
expect(result).toEqual(expected);
|
||||
});
|
||||
|
||||
it('When passed with an uncaught error from Chromatic, it should return the "uncaughtChromaticError" comment strategy', () => {
|
||||
const params = produce(happyPathParams, draft => {
|
||||
draft.uncaughtChromaticError = new Error('Something bad happened');
|
||||
});
|
||||
|
||||
const result = generateCommentStrategy(params);
|
||||
|
||||
expect(result.status).toEqual('uncaughtChromaticError');
|
||||
expect(result.comment).toEqual(
|
||||
expect.stringContaining('### ❌ Chromatic Visual Regression Report')
|
||||
);
|
||||
expect(result.comment).toEqual(
|
||||
expect.stringContaining('Something bad happened to the Chromatic build.')
|
||||
);
|
||||
expect(result.error).toEqual(new Error('Something bad happened'));
|
||||
});
|
||||
|
||||
it('When passed with something strange from Chromatic, it should return the "uncaughtChromaticError" comment strategy', () => {
|
||||
const params = produce(happyPathParams, draft => {
|
||||
draft.uncaughtChromaticError = 'a Strange Chromatic CLI error';
|
||||
});
|
||||
|
||||
const result = generateCommentStrategy(params);
|
||||
|
||||
expect(result.status).toEqual('uncaughtChromaticError');
|
||||
expect(result.comment).toEqual(
|
||||
expect.stringContaining('### ❌ Chromatic Visual Regression Report')
|
||||
);
|
||||
expect(result.comment).toEqual(
|
||||
expect.stringContaining('Something bad happened to the Chromatic build.')
|
||||
);
|
||||
expect(result.error).toEqual(
|
||||
new Error(
|
||||
'Something bad happened to the Chromatic build with an unexpected error (a Strange Chromatic CLI error)'
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
it('When passed with something strange from Chromatic, it should return the "uncaughtChromaticError" comment strategy', () => {
|
||||
const params = produce(happyPathParams, draft => {
|
||||
draft.uncaughtChromaticError = 'a Strange Chromatic CLI error';
|
||||
});
|
||||
|
||||
const result = generateCommentStrategy(params);
|
||||
|
||||
expect(result.status).toEqual('uncaughtChromaticError');
|
||||
expect(result.comment).toEqual(
|
||||
expect.stringContaining('### ❌ Chromatic Visual Regression Report')
|
||||
);
|
||||
expect(result.comment).toEqual(
|
||||
expect.stringContaining('Something bad happened to the Chromatic build.')
|
||||
);
|
||||
expect(result.error).toEqual(
|
||||
new Error(
|
||||
'Something bad happened to the Chromatic build with an unexpected error (a Strange Chromatic CLI error)'
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
describe('No diagnostic file', () => {
|
||||
it('When passed without a diagnostic file, it should return the "noDiagnosticFile" comment strategy', () => {
|
||||
const params = produce(happyPathParams, draft => {
|
||||
draft.diagnosticFile = undefined;
|
||||
@ -131,6 +73,52 @@ _Sent with 💌 from the frontenders of the Hasura Platform team_.
|
||||
);
|
||||
});
|
||||
|
||||
it('When passed without a diagnostic file and an uncaught error from Chromatic, it should return the "uncaughtChromaticError" comment strategy', () => {
|
||||
const params = produce(happyPathParams, draft => {
|
||||
draft.diagnosticFile = undefined;
|
||||
draft.uncaughtChromaticError = new Error('Something bad happened');
|
||||
});
|
||||
|
||||
const result = generateCommentStrategy(params);
|
||||
|
||||
expect(result.status).toEqual('uncaughtChromaticError');
|
||||
expect(result.comment).toEqual(
|
||||
expect.stringContaining('### ❌ Chromatic Visual Regression Report')
|
||||
);
|
||||
expect(result.comment).toEqual(
|
||||
expect.stringContaining(
|
||||
'Something bad happened to the Chromatic build.'
|
||||
)
|
||||
);
|
||||
expect(result.error).toEqual(new Error('Something bad happened'));
|
||||
});
|
||||
|
||||
it('When passed without a diagnostic file and something strange from Chromatic, it should return the "uncaughtChromaticError" comment strategy', () => {
|
||||
const params = produce(happyPathParams, draft => {
|
||||
draft.diagnosticFile = undefined;
|
||||
draft.uncaughtChromaticError = 'a Strange Chromatic CLI error';
|
||||
});
|
||||
|
||||
const result = generateCommentStrategy(params);
|
||||
|
||||
expect(result.status).toEqual('uncaughtChromaticError');
|
||||
expect(result.comment).toEqual(
|
||||
expect.stringContaining('### ❌ Chromatic Visual Regression Report')
|
||||
);
|
||||
expect(result.comment).toEqual(
|
||||
expect.stringContaining(
|
||||
'Something bad happened to the Chromatic build.'
|
||||
)
|
||||
);
|
||||
expect(result.error).toEqual(
|
||||
new Error(
|
||||
'Something bad happened to the Chromatic build with an unexpected error (a Strange Chromatic CLI error)'
|
||||
)
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Invalid diagnostic file', () => {
|
||||
it('When passed with an invalid diagnostic file, it should return the "wrongDiagnosticFile" comment strategy', () => {
|
||||
const params = produce(happyPathParams, draft => {
|
||||
draft.diagnosticFile = {};
|
||||
@ -179,6 +167,7 @@ _Sent with 💌 from the frontenders of the Hasura Platform team_.
|
||||
)
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('When passed with a PENDING diagnostic file, it should return the "pending" comment strategy', () => {
|
||||
const params = produce(happyPathParams, paramsDraft => {
|
||||
@ -275,6 +264,7 @@ _Sent with 💌 from the frontenders of the Hasura Platform team_.
|
||||
const params = produce(happyPathParams, paramsDraft => {
|
||||
paramsDraft.diagnosticFile = produce(happyPathDiagnosticFile, draft => {
|
||||
draft.build.status = 'BROKEN';
|
||||
draft.build.errorCount = 3;
|
||||
});
|
||||
});
|
||||
|
||||
@ -285,13 +275,11 @@ _Sent with 💌 from the frontenders of the Hasura Platform team_.
|
||||
expect.stringContaining('### ❌ Chromatic Visual Regression Report')
|
||||
);
|
||||
expect(result.comment).toEqual(
|
||||
expect.stringContaining(
|
||||
'Chromatic build is broken, maybe something is wrong with some stories.'
|
||||
)
|
||||
expect.stringContaining('Chromatic reported 3 errors with this PR')
|
||||
);
|
||||
expect(result.error).toEqual(
|
||||
new Error(
|
||||
'Chromatic build is broken, maybe something is wrong with some stories. You can view them [here](https://www.chromatic.com/build?appId=614d7904644d03004addd43b&number=8192).'
|
||||
'There are 3 errors reported by Chromatic with this PR. You can view them [here](https://www.chromatic.com/build?appId=614d7904644d03004addd43b&number=8192).'
|
||||
)
|
||||
);
|
||||
});
|
||||
|
@ -53,6 +53,7 @@ _Sent with 💌 from the frontenders of the Hasura Platform team_.
|
||||
`;
|
||||
}
|
||||
|
||||
if (!diagnosticFile) {
|
||||
if (uncaughtChromaticError) {
|
||||
const error =
|
||||
uncaughtChromaticError instanceof Error
|
||||
@ -65,14 +66,13 @@ _Sent with 💌 from the frontenders of the Hasura Platform team_.
|
||||
status: 'uncaughtChromaticError',
|
||||
error,
|
||||
comment: `
|
||||
### ❌ Chromatic Visual Regression Report
|
||||
Something bad happened to the Chromatic build.
|
||||
### ❌ Chromatic Visual Regression Report
|
||||
Something bad happened to the Chromatic build.
|
||||
|
||||
${signature}`,
|
||||
${signature}`,
|
||||
};
|
||||
}
|
||||
|
||||
if (!diagnosticFile) {
|
||||
return {
|
||||
status: 'noDiagnosticFile',
|
||||
error: new Error(
|
||||
@ -178,11 +178,11 @@ ${signature}`,
|
||||
return {
|
||||
status: 'broken',
|
||||
error: new Error(
|
||||
`Chromatic build is broken, maybe something is wrong with some stories. You can view them [here](${diagnosticData.build.webUrl}).`
|
||||
`There are ${diagnosticData.build.errorCount} errors reported by Chromatic with this PR. You can view them [here](${diagnosticData.build.webUrl}).`
|
||||
),
|
||||
comment: `
|
||||
### ❌ Chromatic Visual Regression Report
|
||||
Chromatic build is broken, maybe something is wrong with some stories. You can view them [here](${diagnosticData.build.webUrl}).
|
||||
Chromatic reported ${diagnosticData.build.errorCount} errors with this PR. You can view them [here](${diagnosticData.build.webUrl}).
|
||||
|
||||
${signature}`,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user