Skip to content
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

add tests for several packages #1024

Merged
merged 20 commits into from
Apr 3, 2020

Conversation

43081j
Copy link
Contributor

@43081j 43081j commented Mar 21, 2020

self-isolation lead to me writing some tests for you.

if they need changing any way just let me know.

cc @e111077

I'll fix the lint error tomorrow, failing ci atm

@43081j 43081j force-pushed the more-tests branch 2 times, most recently from 76bc6e6 to bb3436a Compare March 21, 2020 22:42
@e111077
Copy link
Member

e111077 commented Mar 21, 2020

lint errors can be fixed via npm run lint:typescript -- --fix

Copy link
Member

@e111077 e111077 left a comment

Choose a reason for hiding this comment

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

There is a lot of excellent work that I didn't comment on because then you'd have to "resolve" the comment. Very very excellent work!

A few standardization comments. I really wish we could keep you locked up after all this stuff ends because you just saved me so much time haha!

packages/drawer/src/test/mwc-drawer.test.ts Outdated Show resolved Hide resolved
packages/drawer/src/test/mwc-drawer.test.ts Outdated Show resolved Hide resolved
packages/fab/src/test/mwc-fab.test.ts Show resolved Hide resolved
packages/menu/src/test/mwc-menu-surface.test.ts Outdated Show resolved Hide resolved
packages/menu/src/test/mwc-menu.test.ts Outdated Show resolved Hide resolved
packages/menu/src/test/mwc-menu.test.ts Outdated Show resolved Hide resolved
packages/menu/src/test/mwc-menu.test.ts Show resolved Hide resolved
packages/slider/src/test/mwc-slider.test.ts Outdated Show resolved Hide resolved
packages/slider/src/test/mwc-slider.test.ts Outdated Show resolved Hide resolved
@e111077 e111077 self-assigned this Mar 21, 2020
@e111077
Copy link
Member

e111077 commented Mar 21, 2020

What was your dev setup btw? I need to write a contributing / developing doc soon. I usually have 4 terminal windows running:

npm run watch
npm run watch:tests
npm run test:debug -- --packages <package name>

and an empty one to run whatever command like npm run format or npm run lint -- --fix

@43081j
Copy link
Contributor Author

43081j commented Mar 21, 2020

I have my pixel book at the min so had to fiddle with the setup a bit to get Chrome to launch (I installed puppeteer and set CHROME_BIN to its executable path).

But other than that, I have been running a build and test manually:

npm run build:typescript && npm run test -- --packages=THE_ONE_IM_WORKING_ON

i didn't realise a watch script was already set up as I wasn't running the commands much. I'd use that just the way you've said now that I know

And before committing, I'd run format and lint (though clearly I forgot in my last push 😂)

@43081j 43081j force-pushed the more-tests branch 2 times, most recently from 6aba529 to 854037e Compare March 22, 2020 16:00
@43081j 43081j force-pushed the more-tests branch 2 times, most recently from 0ebcabd to fdcdf64 Compare March 22, 2020 17:10
@43081j
Copy link
Contributor Author

43081j commented Mar 23, 2020

FYI @e111077 i dropped sinon but kept their timers package (as you can use it standalone) for mocking setTimeout. but it turns out their build isn't a valid ES module even though its in the "module" field of their package.json, so ill push it in a branch on top of this branch until sinonjs/fake-timers#320 is merged.

Copy link
Member

@e111077 e111077 left a comment

Choose a reason for hiding this comment

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

REALLY excellent work, again

packages/button/src/test/mwc-button.test.ts Outdated Show resolved Hide resolved
packages/drawer/src/test/mwc-drawer.test.ts Outdated Show resolved Hide resolved
packages/menu/src/test/mwc-menu.test.ts Show resolved Hide resolved
packages/menu/src/test/mwc-menu.test.ts Show resolved Hide resolved
export const waitForEvent = (el: Element, ev: string) => new Promise((res) => {
el.addEventListener(ev, () => {
res();
}, {once: true});
Copy link
Member

Choose a reason for hiding this comment

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

also surprised this is compiled out correctly by es-dev-server

Copy link
Member

@e111077 e111077 left a comment

Choose a reason for hiding this comment

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

brilliant, brilliant, brilliant, absolutely brilliant work!

Approving, but I just want some clarification on the sinon part

@e111077
Copy link
Member

e111077 commented Mar 30, 2020

migrating internally to run google-wide tests

@43081j
Copy link
Contributor Author

43081j commented Mar 31, 2020

here you are. i added sinon to the one test, ill do a new pr once my sinon one gets merged (which reminds me i need to go finish it...)

@e111077
Copy link
Member

e111077 commented Mar 31, 2020

LGTM. Need to make some build changes internally to make this work. Requesting a code freeze on this PR in the meanwhile. Thanks!

Copy link
Member

@e111077 e111077 left a comment

Choose a reason for hiding this comment

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

Heya, sorry to double back. I think for the sake of getting this submitted can you please remove sinon fake timers? The internal build system does not like it and cannot actually find SinonFakeTimers. It seems for some reason sinon types never actually resolve in our tests and just use the untyped js file.

@e111077
Copy link
Member

e111077 commented Apr 1, 2020

Thanks!

@43081j
Copy link
Contributor Author

43081j commented Apr 1, 2020

@e111077 thats too bad. though it doesn't surprise me, their 'browser bundle' is a little hacked together i'd say...

i just deleted sinon to solve it. i think we should still make sure we introduce a utility function at least for mocking timers, but this can probably do for now.

@e111077
Copy link
Member

e111077 commented Apr 1, 2020

can you please file an issue asking for the timers helper so we make sure it doesn't slip through the cracks

@e111077
Copy link
Member

e111077 commented Apr 2, 2020

had to make a few IE-specific changes. Have to figure out why IE tests aren't running externally.

Copybara service will forward these changes when it is merged internally. It usually closes this PR as well. If it doesn't it should still carry your authored commits into master.

copybara-service bot pushed a commit that referenced this pull request Apr 2, 2020
self-isolation lead to me writing some tests for you.

if they need changing any way just let me know.

cc @e111077

I'll fix the lint error tomorrow, failing ci atm

FUTURE_COPYBARA_INTEGRATE_REVIEW=#1024 from 43081j:more-tests 6be632d
PiperOrigin-RevId: 304055332
copybara-service bot pushed a commit that referenced this pull request Apr 2, 2020
self-isolation lead to me writing some tests for you.

if they need changing any way just let me know.

cc @e111077

I'll fix the lint error tomorrow, failing ci atm

FUTURE_COPYBARA_INTEGRATE_REVIEW=#1024 from 43081j:more-tests 6be632d
PiperOrigin-RevId: 304055332
copybara-service bot pushed a commit that referenced this pull request Apr 2, 2020
self-isolation lead to me writing some tests for you.

if they need changing any way just let me know.

cc @e111077

I'll fix the lint error tomorrow, failing ci atm

FUTURE_COPYBARA_INTEGRATE_REVIEW=#1024 from 43081j:more-tests 6be632d
PiperOrigin-RevId: 304055332
copybara-service bot pushed a commit that referenced this pull request Apr 2, 2020
self-isolation lead to me writing some tests for you.

if they need changing any way just let me know.

cc @e111077

I'll fix the lint error tomorrow, failing ci atm

FUTURE_COPYBARA_INTEGRATE_REVIEW=#1024 from 43081j:more-tests 6be632d
PiperOrigin-RevId: 304055332
copybara-service bot pushed a commit that referenced this pull request Apr 2, 2020
self-isolation lead to me writing some tests for you.

if they need changing any way just let me know.

cc @e111077

I'll fix the lint error tomorrow, failing ci atm

FUTURE_COPYBARA_INTEGRATE_REVIEW=#1024 from 43081j:more-tests 6be632d
PiperOrigin-RevId: 304055332
copybara-service bot pushed a commit that referenced this pull request Apr 2, 2020
self-isolation lead to me writing some tests for you.

if they need changing any way just let me know.

cc @e111077

I'll fix the lint error tomorrow, failing ci atm

FUTURE_COPYBARA_INTEGRATE_REVIEW=#1024 from 43081j:more-tests 6be632d
PiperOrigin-RevId: 304055332
copybara-service bot pushed a commit that referenced this pull request Apr 2, 2020
self-isolation lead to me writing some tests for you.

if they need changing any way just let me know.

cc @e111077

I'll fix the lint error tomorrow, failing ci atm

FUTURE_COPYBARA_INTEGRATE_REVIEW=#1024 from 43081j:more-tests 6be632d
PiperOrigin-RevId: 304055332
copybara-service bot pushed a commit that referenced this pull request Apr 2, 2020
self-isolation lead to me writing some tests for you.

if they need changing any way just let me know.

cc @e111077

I'll fix the lint error tomorrow, failing ci atm

FUTURE_COPYBARA_INTEGRATE_REVIEW=#1024 from 43081j:more-tests 6be632d
PiperOrigin-RevId: 304055332
copybara-service bot pushed a commit that referenced this pull request Apr 2, 2020
self-isolation lead to me writing some tests for you.

if they need changing any way just let me know.

cc @e111077

I'll fix the lint error tomorrow, failing ci atm

FUTURE_COPYBARA_INTEGRATE_REVIEW=#1024 from 43081j:more-tests 6be632d
PiperOrigin-RevId: 304055332
copybara-service bot pushed a commit that referenced this pull request Apr 3, 2020
self-isolation lead to me writing some tests for you.

if they need changing any way just let me know.

cc @e111077

I'll fix the lint error tomorrow, failing ci atm

FUTURE_COPYBARA_INTEGRATE_REVIEW=#1024 from 43081j:more-tests 6be632d
PiperOrigin-RevId: 304055332
copybara-service bot pushed a commit that referenced this pull request Apr 3, 2020
self-isolation lead to me writing some tests for you.

if they need changing any way just let me know.

cc @e111077

I'll fix the lint error tomorrow, failing ci atm

FUTURE_COPYBARA_INTEGRATE_REVIEW=#1024 from 43081j:more-tests 6be632d
PiperOrigin-RevId: 304055332
@copybara-service copybara-service bot merged commit 6b94609 into material-components:master Apr 3, 2020
@43081j 43081j deleted the more-tests branch April 4, 2020 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants