Fix Error 1001: JavaScript profiling failed (#197)

Fix for Error 1001: JavaScript profiling failed
This commit is contained in:
Gaël Métais
2016-12-20 12:21:20 +08:00
parent db5632d3ba
commit 50eacba438
3 changed files with 44 additions and 8 deletions
+15
View File
@@ -109,6 +109,21 @@ describe('index.js', function() {
});
});
it('should succeed on try-catch.html', function(done) {
this.timeout(15000);
var url = 'http://localhost:8388/try-catch.html';
ylt(url)
.then(function(data) {
data.toolsResults.phantomas.metrics.should.have.a.property('jsErrors').that.equals(0);
done();
}).fail(function(err) {
console.log.restore();
done(err);
});
});
it('should take a screenshot', function(done) {
this.timeout(15000);
+21
View File
@@ -0,0 +1,21 @@
<html>
<head>
<title>Testing getElementById with a try catch statement</title>
</head>
<body>
<div id="foo">Some text</div>
<script>
try {
document.getElementById(undefined);
document.getElementsByClassName(undefined);
document.getElementsByTagName(undefined);
} catch(err) {
console.log('Error found: ' + err);
throw new Error("I detect an error!");
}
document.getElementById('foo');
</script>
</body>
</html>