generators/component/templates/__component__.visual.js
const path = require('path');const support = require(path.resolve(process.env.PWD, 'test/browser.visual.js')); let page;let browser;const width = 1024;const height = 768; beforeAll(async() => { const res = await support.openPage(width, height); page = res.page; browser = res.browser; const props = {}; await page.evaluate(function (props) { window.changeComponent('<%= props.componentName %>', props); }, props); }); afterAll(async() => { await page.close(); await browser.close(); }); Identical blocks of code found in 2 locations. Consider refactoring.describe('visual: index', () => { it('should have matching image snapshot', async() => { const screenshot = await page.screenshot(); expect(screenshot).toMatchImageSnapshot(); }); });