-
Notifications
You must be signed in to change notification settings - Fork 5.5k
colocate tests in flat structure #10655
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
Conversation
|
Keeping the |
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 straight-up murdered this test cause I couldn't figure out wtf it was trying to do or why it had a mock store.
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.
and there was already a test file with test cases for this component in the directory in question
Builds ready [d19d046]
Page Load Metrics (653 ± 25 ms)
|
4dd7dcb to
080898e
Compare
Builds ready [080898e]
Page Load Metrics (623 ± 35 ms)
|
080898e to
3d22d39
Compare
Builds ready [3d22d39]
Page Load Metrics (734 ± 78 ms)
|
| @@ -0,0 +1,82 @@ | |||
| import assert from 'assert'; | |||
| import freeze from 'deep-freeze-strict'; | |||
| import reducers from '../ducks'; | |||
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 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'", |
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 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.
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.
Here's the follow-up to this: #10661
Gudahtt
left a comment
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!
Moves test files to be colocated with the code under test, without nesting in
testfolders.A: Put it in
test/helpers/,test/mocks/ortest/stubs/-- whichever is most relevant