-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Handle logging in async function #2007
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
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.
@rynop, looks valid, but could you add a test for that ?
unknown filename case somewhere around here:
Detox/detox/src/utils/customConsoleLogger.test.js
Lines 50 to 56 in f853298
console.__log(''); | |
expect(bunyanLogger.mock).toHaveBeenCalledWith(ignored(), expect.stringContaining(expectedOrigin), ignored(), ignored()); | |
}); | |
it('should use relative file-name rather than absolute in origin', () => { | |
const expectedOrigin = `at ${path.normalize('src/utils/customConsoleLogger.test.js')}:`; |
I must emphasize what @noomorph is asking regarding tests. This is TDD code -- need to add a failing test that acknowledges this specific case. Also, please don't use Other than that: thank you for this! 😄 |
Fixed up and test added! |
@rynop, I am sorry for the delay - the last update from you somehow slipped between the cracks, and I have not noticed it. I'll review your PR soon. |
@noomorph no worries! |
@rynop, thank you! Great job! 👍 |
Description:
Sorry I didn't file an issue cuz this was such a small change.
When using mocha, and trying to log within a hook/test
detox/src/utils/customConsoleLogger.js:: getOrigin()
blows up becauseuserCallsite.getFileName()
isundefined
and thereforepath.relative()
explodes.Simple reproduce:
PR is not the most elegant solution, but not sure there is much that can be done when using https://github.com/sindresorhus/callsites
Without this fix, I can not use Detox (and I want to, cuz really like it :)