-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: JSON being output was not valid
👍 thanks for the fix @SanterreJo.
- Loading branch information
1 parent
c57bd74
commit de9109c
Showing
3 changed files
with
30 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,25 @@ | ||
// /* globals describe, it, before */ | ||
|
||
// var PuppeteerToIstanbul = require('../lib/puppeteer-to-istanbul')() | ||
|
||
// require('chai').should() | ||
|
||
// describe('puppeteer-to-istanbul', () => { | ||
|
||
// const fixture = require('./fixtures/function-coverage-missing.json') | ||
|
||
// before(() => { | ||
|
||
// }) | ||
|
||
// it('translates ranges into lines for istanbul', () => { | ||
|
||
// }) | ||
|
||
// }) | ||
/* globals describe, it */ | ||
|
||
const should = require('chai').should() | ||
const fs = require('fs') | ||
|
||
var PuppeteerToIstanbul = require('../lib/puppeteer-to-istanbul') | ||
|
||
describe('puppeteer-to-istanbul', () => { | ||
it('outputs a valid out.json file', () => { | ||
const fixture = require('./fixtures/two-inline.json') | ||
const pti = PuppeteerToIstanbul(fixture) | ||
pti.writeIstanbulFormat() | ||
const content = fs.readFileSync('.nyc_output/out.json', 'utf8') | ||
const jsonObject = JSON.parse(content) | ||
should.exist(jsonObject) | ||
fs.unlinkSync('.nyc_output/out.json') | ||
}) | ||
|
||
it('correctly sets coverage info', () => { | ||
const fixture = require('./fixtures/two-inline.json') | ||
const pti = PuppeteerToIstanbul(fixture) | ||
pti.setCoverageInfo(fixture) | ||
pti.coverageInfo.should.eql(fixture) | ||
}) | ||
}) |