Skip to content

Commit 3cea643

Browse files
committed
🔥 phantomjs
1 parent 3de8600 commit 3cea643

File tree

5 files changed

+283
-515
lines changed

5 files changed

+283
-515
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env node
22

3-
process.bin = process.title = 'css-coverage';
3+
process.bin = process.title = 'css-coverage'
44

55
require('../src/runCoverage')

format.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"name": "css-coverage",
33
"version": "1.2.1",
44
"scripts": {
5-
"test": "./bin/css-coverage --cover-declarations --html ./test/test.html --css ./test/test.css --lcov ./test/test.lcov",
6-
"test-debug": "node --inspect-brk ./bin/css-coverage --cover-declarations --html ./test/test.html --css ./test/test.css --lcov ./test/test.lcov",
5+
"test": "./bin/css-coverage.js --cover-declarations --html ./test/test.html --css ./test/test.css --lcov ./test/test.lcov",
6+
"test-debug": "node --inspect-brk ./bin/css-coverage.js --cover-declarations --html ./test/test.html --css ./test/test.css --lcov ./test/test.lcov",
77
"posttest": "standard --fix"
88
},
99
"dependencies": {
@@ -12,16 +12,14 @@
1212
"commander": "2.17.0",
1313
"css-tree": "1.0.0-alpha25",
1414
"dotenv": "^6.0.0",
15-
"phantomjs-prebuilt": "2.1.16",
1615
"puppeteer": "^1.5.0",
1716
"sizzle": "2.3.3",
1817
"source-map": "0.7.3",
1918
"standard": "^12.0.0"
2019
},
2120
"bin": {
22-
"css-coverage": "bin/css-coverage"
21+
"css-coverage": "bin/css-coverage.js"
2322
},
24-
"preferGlobal": true,
2523
"keywords": [
2624
"css",
2725
"coverage",
@@ -30,7 +28,7 @@
3028
"source-map"
3129
],
3230
"main": "index.js",
33-
"repository": "https://github.com/philschatz/css-coverage.js.git",
31+
"repository": "https://github.com/openstax/css-coverage.js.git",
3432
"author": "Philip Schatz <phil@cnx.org>",
3533
"license": "MIT"
3634
}

src/runCoverage.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const BunyanFormat = require('bunyan-format')
1212
const log = bunyan.createLogger({
1313
name: 'css-coverage',
1414
level: process.env.LOG_LEVEL || 'info',
15-
stream: new BunyanFormat({outputMode: process.env.LOG_FORMAT || 'short'})
15+
stream: new BunyanFormat({ outputMode: process.env.LOG_FORMAT || 'short' })
1616
})
1717

1818
function parseFileName (filePath) {
@@ -97,7 +97,7 @@ async function initializeSourceMapConsumer () {
9797

9898
// sourceMapConsumer.eachMapping(function (m) { console.log(m.generatedLine, m.source); });
9999

100-
return {sourceMapConsumer, sourceMapPath}
100+
return { sourceMapConsumer, sourceMapPath }
101101
}
102102
}
103103

@@ -116,7 +116,7 @@ async function runCoverage () {
116116
await page.goto(url)
117117
log.debug(`Opened "${url}"`)
118118

119-
const browserLog = log.child({browser: 'console'})
119+
const browserLog = log.child({ browser: 'console' })
120120
page.on('console', msg => {
121121
switch (msg.type()) {
122122
case 'error':
@@ -257,7 +257,7 @@ async function generateLcovStr (coverageOutput) {
257257
if (!files[fileName]) {
258258
files[fileName] = []
259259
}
260-
files[fileName].push({startLine: startLine, endLine: endLine, count: count})
260+
files[fileName].push({ startLine: startLine, endLine: endLine, count: count })
261261
}
262262

263263
let i = -1
@@ -286,7 +286,7 @@ async function generateLcovStr (coverageOutput) {
286286
for (let parseLine = origStart.line; parseLine <= origEnd.line; parseLine++) {
287287
const curLineText = cssLines[parseLine - 1]
288288
for (let curColumn = parseColumn - 1; curColumn < curLineText.length; curColumn++) {
289-
const info = sourceMapConsumer.originalPositionFor({line: parseLine, column: curColumn})
289+
const info = sourceMapConsumer.originalPositionFor({ line: parseLine, column: curColumn })
290290
// stop processing when we hit origEnd
291291
if (parseLine === origEnd.line && curColumn >= origEnd.column) {
292292
break
@@ -302,15 +302,15 @@ async function generateLcovStr (coverageOutput) {
302302
console.error('BUG: Could not look up source for this range:')
303303
console.error('origStart', origStart)
304304
console.error('origEnd', origEnd)
305-
console.error('currIndexes', {line: parseLine, column: curColumn})
305+
console.error('currIndexes', { line: parseLine, column: curColumn })
306306
}
307307
}
308308
}
309309
parseColumn = 1
310310
}
311311
} else {
312312
// Just cover the selectors
313-
const startInfo = sourceMapConsumer.originalPositionFor({line: origStart.line, column: origStart.column - 1})
313+
const startInfo = sourceMapConsumer.originalPositionFor({ line: origStart.line, column: origStart.column - 1 })
314314
// const endInfo = sourceMapConsumer.originalPositionFor({line: origEnd.line, column: origEnd.column - 2})
315315

316316
// When there is no match, startInfo.source is null

0 commit comments

Comments
 (0)