-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests: move cli/core to jest #5386
Changes from 10 commits
2214c12
c4309a7
40a762c
d1339b3
cd618db
43337b3
45b60bc
069e272
8b6b695
efea9df
db79786
1c51e6e
373b161
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* @license Copyright 2018 Google Inc. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. | ||
*/ | ||
'use strict'; | ||
|
||
module.exports = { | ||
collectCoverage: true, | ||
coverageReporters: ['none'], | ||
collectCoverageFrom: [ | ||
'**/lighthouse-core/**/*.js', | ||
'**/lighthouse-cli/**/*.js', | ||
'!**/test/', | ||
'!**/scripts/', | ||
], | ||
testEnvironment: 'node', | ||
testMatch: [ | ||
'**/lighthouse-core/**/*-test.js', | ||
'**/lighthouse-cli/**/*-test.js', | ||
], | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's set the timeout to 2000ms, since that's what we use in mocha. (otherwise it'll default to 5000ms) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how important is this one? do we think 2s was a good feature? :) in jest you do this via There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oic. hmmmmmmmm well nevermind then. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -288,12 +288,16 @@ class Util { | |
* @return {{file: string, hostname: string, origin: string}} | ||
*/ | ||
static parseURL(url) { | ||
const parsedUrl = new URL(url); | ||
return { | ||
file: Util.getURLDisplayName(parsedUrl), | ||
hostname: parsedUrl.hostname, | ||
origin: parsedUrl.origin, | ||
}; | ||
try { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why was this needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well we only need this or a fix on the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm, but why was it needed for this PR? If it's throwing shouldn't it have caused a failure before, too? Or is the problem something else. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well again it isn't strictly needed, but seemed like a good idea anyhow. full details: this isn't needed anymore because along the way I turned off default jsdom environment, but it seemed like a good idea to keep, it seems like you don't think so though so I'll revert :) |
||
const parsedUrl = new URL(url); | ||
return { | ||
file: Util.getURLDisplayName(parsedUrl), | ||
hostname: parsedUrl.hostname, | ||
origin: parsedUrl.origin, | ||
}; | ||
} catch (_) { | ||
return {file: 'Unknown', hostname: 'Unknown', origin: 'Unknown'}; | ||
} | ||
} | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gotta disable eslint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could go for
/* eslint-env jest */
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ya @wardpeet I made that change 👍 :)