Skip to content

Conversation

@merlinnot
Copy link
Contributor

Description

While adding some tests to the repository, I noticed it's required to register these in spec/index.spec.ts. I find that inconvenient, most often all test files are picked up automatically.

This PR introduces a Mocha configuration file (introduced in Mocha v6, supersedes now deprecated mocha.opts). It applies a sane configuration, with a few extras:

  • Since Realtime Database is left in a "dirty" state by some tests, I added an exit option which forces Mocha to force the process exit after all tests are finished. I'd treat it as a temporary fix, until the root cause is fixed. It will greatly speed up the CI too. For more information, see https://mochajs.org/#-exit
  • A setup file is extracted to mocha/setup.ts. I'm not sure if that's the most fortunate naming, but I didn't want to mix it with actual test files in the setup directory. I'm open to suggestions!
  • It specifies extensions, so a watch mode can be easily enabled.

Code sample

Not relevant.

@merlinnot
Copy link
Contributor Author

@thechenky

@thechenky
Copy link
Contributor

This is very nice, I like the exit, those database logs have been pretty annoying that keep printing after the tests finish. Can we change the config file to be json format instead of yaml? Since other files are using json, it would be good to be consistent.

@thechenky thechenky requested a review from kevinajian as a code owner July 11, 2019 22:25
@thechenky
Copy link
Contributor

@merlinnot can you resolve the conflicts so I can merge?

@thechenky
Copy link
Contributor

@patilharshal16 did you have some comments on this PR? I see you reviewed it....?

@thechenky thechenky merged commit 1f6499c into firebase:master Jul 12, 2019
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.

4 participants