-
Notifications
You must be signed in to change notification settings - Fork 56
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
test: test ux improvements #1652
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
0bc007c
test: remove reference to removed 'tear_down' module
owenpearson 8e971a6
test: if no log level set, only log failed tests
owenpearson 96f250b
test: use mocha CLI directly for node tests
owenpearson 86f8293
test: no explicit logLevel
owenpearson 659ddd3
test: ensure realtime clients are disposed correctly
owenpearson d553b22
test: force close all realtime clients after each test
owenpearson 92e7e49
test: use source map for node tests
owenpearson 3066804
build: cleanup unused grunt tasks
owenpearson 535f066
test: convert test webserver to module
owenpearson 7dd2adc
test: dynamically add mocha config specs if no specs passed via args
owenpearson 019de8c
test: use root_hooks.js for new hooks and fix browser not loading them
owenpearson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const config = { | ||
require: ['source-map-support/register', 'test/support/modules_helper.js', 'test/support/test_helper.js'], | ||
file: ['test/support/root_hooks.js'], | ||
reporter: 'test/support/mocha_reporter.js', | ||
}; | ||
|
||
// mocha has a ridiculous issue (https://github.com/mochajs/mocha/issues/4100) that command line | ||
// specs don't override config specs; they are merged instead, so you can't run a single test file | ||
// if you've defined specs in your config. therefore we work around it by only adding specs to the | ||
// config if none are passed as arguments | ||
if (!process.argv.slice(2).some(isTestFile)) { | ||
config.spec = ['test/realtime/*.test.js', 'test/rest/*.test.js']; | ||
} | ||
|
||
function isTestFile(arg) { | ||
return arg.match(/\.test.js$/); | ||
} | ||
|
||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
grunt-mocha.js
previously also hadtest/support/root_hooks.js
.Do we not need it anymore?
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! these hooks weren't being run in the browser at all so i made a commit to move them into shared_helper.js in another branch (359c514), i might just rebase this PR onto that one for the sake of simplicity rather than duplicating the commit
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.
cool, yeah i'm gonna wait for #1645 to land on the integration branch and rebase this PR (which will resolve this comment) so we can hold off merging until then
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.
Oh, I see!
I've noticed those new
afterEach
hooks in shared_helper and was wondering if that was a replacement for root_hooks.js, and turns out it is.Now, I believe root_hooks.js was never registered in browser tests, because even though it is listed in
browser_file_list.js
, inbrowser_setup.js
there are TEST_REGEXP and TEAR_DOWN_REGEXP regexps that filter out anything that is not*.test.js
or*tear_down.js
->root_hooks.js
doesn't match. And there is no other place whereroot_hooks.js
would be imported in browser setup, so I guess that was the culprit.I feel like separate
root_hooks.js
file was a better place for hooks like these, they seem a bit out of place forshared_helper.js
.That being said, current browser test setup is a maze and I don't want to drag on this PR for much longer. I believe Unified Test Suite will be the opportunity for us to re-implement browser tests with more modern setup.
So we can leave this as it is.
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.
yeah i agree it's not ideal, we can file an issue to come up with something better but i think this pr is an overall improvement so i agree it's okay to leave it for now 👍