Skip to content

Commit

Permalink
Fixed issues from standard
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 38a6949 commit 6ca119f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
8 changes: 3 additions & 5 deletions lib/output-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,17 @@ class OutputFiles {

// Get the last element in the path name
var truncatedPath = path.split('/')[path.split('/').length - 1]
truncatedPath = truncatedPath.split(".js")[0]
truncatedPath = truncatedPath.split('.js')[0]
truncatedPath = './coverage/js/' + truncatedPath
mkdirp.sync('./coverage/js')
if (fs.existsSync(truncatedPath + '.js')) {
if (fs.existsSync(truncatedPath + '.js')) {
this.iterator++
str = `${truncatedPath}-${this.iterator}.js`
return str
}
else {
} else {
str = `${truncatedPath}.js`
return str
}
return str
}

parseAndIsolate () {
Expand Down
14 changes: 5 additions & 9 deletions test/output-files.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
/* globals describe, it */
/* globals describe, it, beforeEach, after */

const OutputFiles = require('../lib/output-files')
const rimraf = require('rimraf')
const fs = require('fs')

require('chai').should()

describe('puppeteer-to-v8', () => {
describe('filename generation', () => {

beforeEach(() => {
rimraf.sync('./coverage');
rimraf.sync('./coverage')
})

// we can use path.basename(path[, ext]).
it('exposes a handler that appropriately handles colliding names', () => {
const outputFiles = OutputFiles(require('./fixtures/block-else-not-covered.json'))
console.log('Test');
console.log('Test')
var a = outputFiles.rewritePath('./sample_js/block-else-not-covered-1.js')
a.should.eql('./coverage/js/block-else-not-covered-1.js')
})
Expand All @@ -33,13 +31,11 @@ describe('puppeteer-to-v8', () => {

// call it something like indexHTML-inline-1.js
it('appropriately handles inline JavaScript', () => {

})

after(() => {
rimraf.sync('./coverage');
rimraf.sync('./coverage')
})


})
})

0 comments on commit 6ca119f

Please sign in to comment.