[go: nahoru, domu]

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

clients(lightrider): serialize errors in artifacts #9410

Merged
merged 13 commits into from
Jul 24, 2019
Prev Previous commit
Next Next commit
tst
  • Loading branch information
connorjclark committed Jul 23, 2019
commit 0836365498e37b3e81355a4ceb1798dbc99a8674
27 changes: 27 additions & 0 deletions clients/test/lightrider-entry-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,32 @@ describe('lightrider-entry', () => {

runStub.mockRestore();
});

it('exposes artifacts when logAssets is true', async () => {
const originalRun = Runner.run;
Runner.run = jest.fn().mockReturnValue(Promise.resolve({
lhr: {},
artifacts: {
Artifact: new Error('some error'),
},
}));
afterEach(() => {
Runner.run = originalRun;
});

const mockConnection = {};
const url = 'https://example.com';
const lrFlags = {
logAssets: true,
};
const resultJson = await lhBackground.runLighthouseInLR(mockConnection, url, {}, lrFlags);
const result = JSON.parse(resultJson);
expect(result.artifacts).toMatchObject({
Artifact: {
sentinel: '__ErrorSentinel',
message: 'some error',
},
});
});
});
});