feat: Implement JavaScript Coverage (#1673)

This patch introduces a new `page.coverage` namespace with two methods:
- `page.coverage.startJSCoverage` to initiate JavaScript coverage
  recording
- `page.coverage.stopJSCoverage` to stop JavaScript coverage and get
  results
This commit is contained in:
Andrey Lushnikov
2018-01-02 19:53:53 -08:00
committed by GitHub
parent bd73e4b7b8
commit d062381978
14 changed files with 366 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
<script>
function foo() {
if (1 > 2)
console.log(1);
if (1 < 2)
console.log(2);
let x = 1 > 2 ? 'foo' : 'bar';
let y = 1 < 2 ? 'foo' : 'bar';
let z = () => {};
let q = () => {};
q();
}
foo();
</script>

View File

@@ -0,0 +1,2 @@
<script src='script1.js'></script>
<script src='script2.js'></script>

View File

@@ -0,0 +1,2 @@
<script>
function unused(){}console.log('used!');</script>

View File

@@ -0,0 +1 @@
console.log(3);

View File

@@ -0,0 +1 @@
console.log(3);

View File

@@ -0,0 +1,2 @@
<script>
function foo() {function bar() { } console.log(1); } foo(); </script>

View File

@@ -0,0 +1,4 @@
<script>
console.log(1);
//# sourceURL=nicename.js
</script>

View File

@@ -0,0 +1 @@
<script>function foo() { }</script>