Skip to content

Commit

Permalink
Added test for two inline scripts
Browse files Browse the repository at this point in the history
Co-authored-by: Robert Altman <rjaltman04@gmail.com>
  • Loading branch information
vkoves and rjaltman committed Feb 25, 2018
1 parent ad9c2c1 commit f909546
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/output-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class OutputFiles {

// Special case: when html present, strip and return specialized string
if (truncatedPath.includes('.html')) {
truncatedPath = './coverage/js/puppeteerTemp-inline.js'
truncatedPath = './coverage/js/puppeteerTemp-inline'
} else {
truncatedPath = truncatedPath.split('.js')[0]
truncatedPath = './coverage/js/' + truncatedPath
Expand Down
8 changes: 8 additions & 0 deletions test/output-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ describe('puppeteer-to-v8', () => {
coverageInfo[1].url.should.include('puppeteerTemp-inline.js')
})

it('appropriately handles two cases of inline JavaScript', () => {
const fixture = require('./fixtures/two-inline.json')
const coverageInfo = OutputFiles(fixture).output()

coverageInfo[0].url.should.include('puppeteerTemp-inline.js')
coverageInfo[1].url.should.include('puppeteerTemp-inline-1.js')
})

after(cleanupCoverage)

function cleanupCoverage () {
Expand Down

0 comments on commit f909546

Please sign in to comment.