Skip to content

Commit

Permalink
test: ensure that the reporter is working correctly (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcschaller authored Jul 17, 2020
1 parent 026066a commit caaf11f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
language: node_js
node_js:
- '10.13'
before_script:
- export DISPLAY=:99.0
- export CHROME_PATH="$(pwd)/chrome-linux/chrome"
services:
- xvfb
addons:
chrome: stable
22 changes: 22 additions & 0 deletions __tests__/reporter.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const writeReport = require('../lib/lighthouse-reporter');

describe('Reporter', () => {
it('should launch Chrome and generate a report', async () => {
jest.setTimeout(20000); // Allows more time to run all tests
const result = await writeReport('http://www.google.com');
expect(result).toEqual(
expect.objectContaining({
categoryReport: {
performance: expect.any(Number),
accessibility: expect.any(Number),
'best-practices': expect.any(Number),
seo: expect.any(Number),
pwa: expect.any(Number),
},
budgetsReport: expect.any(Object),
htmlReport: expect.any(Object),
jsonReport: expect.any(Object),
}),
);
});
});

0 comments on commit caaf11f

Please sign in to comment.