Skip to content

Conversation

@brad-decker
Copy link
Contributor

@brad-decker brad-decker commented Mar 15, 2021

Moves test files to be colocated with the code under test, without nesting in test folders.

what do we do with test specific code shared across multiple test files?

A: Put it in test/helpers/, test/mocks/ or test/stubs/ -- whichever is most relevant

@Gudahtt
Copy link
Member

Gudahtt commented Mar 15, 2021

Keeping the test folder around for test helpers, mocks, and the e2e test makes sense to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I straight-up murdered this test cause I couldn't figure out wtf it was trying to do or why it had a mock store.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and there was already a test file with test cases for this component in the directory in question

@metamaskbot
Copy link
Collaborator

Builds ready [d19d046]
Page Load Metrics (653 ± 25 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint49715763
domContentLoaded5987706525125
load6007716535125
domInteractive5987696525125

@brad-decker brad-decker force-pushed the colocate-flat-tests branch 3 times, most recently from 4dd7dcb to 080898e Compare March 15, 2021 21:55
@brad-decker brad-decker marked this pull request as ready for review March 15, 2021 22:10
@brad-decker brad-decker requested a review from a team as a code owner March 15, 2021 22:10
@metamaskbot
Copy link
Collaborator

Builds ready [080898e]
Page Load Metrics (623 ± 35 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint47905895
domContentLoaded4247786217435
load4257796237335
domInteractive4237786217435

@brad-decker brad-decker force-pushed the colocate-flat-tests branch from 080898e to 3d22d39 Compare March 16, 2021 17:29
@metamaskbot
Copy link
Collaborator

Builds ready [3d22d39]
Page Load Metrics (734 ± 78 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint4613365199
domContentLoaded369107673216378
load370107773416378
domInteractive368107573216378

@@ -0,0 +1,82 @@
import assert from 'assert';
import freeze from 'deep-freeze-strict';
import reducers from '../ducks';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be testing the reducers more than the action constants 🤔

This is definitely a huge improvement from how these were organized before though!

"test:unit:global": "mocha --exit --require test/env.js --require test/setup.js --recursive test/unit-global/*.test.js",
"test:unit:lax": "mocha --exit --require test/env.js --require test/setup.js --recursive \"test/unit/{,**/!(permissions)}/*.test.js\" \"ui/app/**/*.test.js\" \"shared/**/*.test.js\"",
"test:unit:strict": "mocha --exit --require test/env.js --require test/setup.js --recursive \"test/unit/**/permissions/*.test.js\"",
"test:unit:lax": "mocha --exit --require test/env.js --require test/setup.js --recursive './{ui,app,shared}/{,**/!(permissions)}/*.test.js'",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could exclude other directories named "permissions" as well. I don't think we have any right now, but that's an unfortunate foot-fun to leave laying around.

I'll try to think of an alternative syntax, and we can fix it in a follow-up PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the follow-up to this: #10661

Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@brad-decker brad-decker merged commit 5a233e4 into develop Mar 16, 2021
@brad-decker brad-decker deleted the colocate-flat-tests branch March 16, 2021 21:00
@github-actions github-actions bot locked and limited conversation to collaborators Mar 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants