-
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(smokehouse): refactor to enable Smokerider #7284
Conversation
is it possible to make the brainstorming doc public? It would be nice to see the motivations/constraints before settling on a new design |
@@ -0,0 +1,224 @@ | |||
/* eslint-disable no-console */ |
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.
Only changes here are 1) module exports at the bottom and 2) using Smokehouse.
type definitions.
It's easier to share it individually. I sent @patrickhulce a link. I can do the same for anyone else who requests it. |
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.
I'm probably missing the bigger picture here how this helps. Doc you shared helped a lot :)
@@ -106,7 +35,7 @@ function displaySmokehouseOutput(result) { | |||
/** | |||
* Run smokehouse in child processes for selected smoketests | |||
* Display output from each as soon as they finish, but resolve function when ALL are complete | |||
* @param {Array<SmoketestDfn>} smokes | |||
* @param {Array<typeof SMOKETESTS[0]>} smokes |
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.
can we not use SmoketestDfn
directly somehow?
import('./smoke-test-dfn').SmoketestDefn
or better yet a new Smokehouse
namespace?
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.
Moved to the new .d.ts
.
const path = require('path'); | ||
|
||
/** | ||
* @typedef {object} SmoketestDfn |
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.
☠️ 1️⃣ ✉️ 🕐
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.
xD
return require(expectationsPath); | ||
} | ||
|
||
module.exports.getCompactSmokeTests = () => { |
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 don't typically do piecemeal exports as we go, and I must admit the explicit collection of what's exported at the bottom has somewhat grown on me.
anything in particular that prompted this style or just more used to it?
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.
also this function feels a little more like getUncompactedSmokeTests
, no?
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.
good point, changed to module.exports = {...}
.
Doh, that is a better name. Although I do not like the word 'compact' for this. Got any better ideas?
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.
resolved
, expanded
, loaded
... like any of those? I think that's all I got :)
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.
LGTM % last typedef
@@ -53,8 +56,8 @@ function processForProto(result) { | |||
audit.scoreDisplayMode = 'notApplicable'; | |||
} | |||
} | |||
// Drop raw values. #6199 | |||
if ('rawValue' in audit) { | |||
// Drop raw values. https://github.com/GoogleChrome/lighthouse/issues/6199 |
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.
🎉
@@ -139,7 +68,7 @@ async function runSmokehouse(smokes) { | |||
/** | |||
* Determine batches of smoketests to run, based on argv | |||
* @param {string[]} argv | |||
* @return {Map<string|undefined, Array<SmoketestDfn>>} | |||
* @return {Map<string|undefined, Array<typeof SMOKETESTS[0]>>} |
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.
upate this one?
@brendankenny any questions or concerns about these changes after reviewing how it's utilized in cl/234828413? |
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.
works for me. only small nits
const smokehouseDir = 'lighthouse-cli/test/smokehouse/'; | ||
|
||
/** @type {Array<Smokehouse.TestDfn>} */ | ||
const SMOKE_TESTS = [{ |
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.
rename to SMOME_TEST_DFNS ?
return require(expectationsPath); | ||
} | ||
|
||
function getUncompactedSmokeTests() { |
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.
This name is funny to me. It means the config/expectations are not filenames but the files are read as modules?
if we rename the above to DFNS, then this module can be getSmokeTests()
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.
LGTM!
@@ -0,0 +1,128 @@ | |||
'use strict'; |
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.
/**
* @license Copyright 2019 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.
*/
@@ -0,0 +1,229 @@ | |||
/* eslint-disable no-console */ |
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.
/**
* @license Copyright 2019 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.
*/
types/smokehouse.d.ts
Outdated
@@ -0,0 +1,30 @@ | |||
declare module Smokehouse { |
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.
/**
* @license Copyright 2019 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.
*/
A few refactors to enable running smoke tests against Lightrider. Namely:
keepRawValues
, since many smoke tests assert on that.See internal bug b/124882661.