Core: Implement a node stdout reporter#790
Conversation
|
Is the use of chalk the only thing specific to node? You might consider changing this from a node stdout reporter to a console reporter. |
|
The stdout reporter is also using Node's Maybe, it will be more clear to replace the My goal in this PR is to provide a full operational reporter for Node, so we may use QUnit without any adapter. |
|
The stdout reporter may be followed by a TAP reporter. The one at Mocha may be used as reference. I'll take another look to see if I detach this code from the build, and make it an individual module, so we can set it as an separate module and just |
|
The last commit changed this PR to use the stdout reporter feature from an external module. We can turn the module a jQuery project, as you prefer. |
There was a problem hiding this comment.
How do these tests get access to QUnit? We must be assigning global.QUnit somewhere for that to work, right?
There was a problem hiding this comment.
It will use the QUnit variable assigned above. This current file test/reporter-stdout.js will work as a context module for its following requirements.
There was a problem hiding this comment.
Required files in node don't have access to the scope of the file that is requiring it. So the only way for the required file to have QUnit in scope is for a global (right?). Where does the global come from?
There was a problem hiding this comment.
That var QUnit shouldn't be accessible in the scope of any other files required here. Its a local variable, not made global in any way.
There was a problem hiding this comment.
That's okay, but still doesn't explain why it was working before.
There was a problem hiding this comment.
as I told before, this looks like an undocumented feature. Node modules seems to be leaking the current file scope to their following required modules.
There was a problem hiding this comment.
Are you sure about that? QUnit does some crazy stuff with globals and different environments.
There was a problem hiding this comment.
No, I'm not. I'll check this out on an example repo.
There was a problem hiding this comment.
Looks like the this from outro.js refers in node to global, which we then alias as window, and in exports.js we then assign window.QUnit, which in node is the same as global.QUnit. Let's fix that.
|
bumped the reporter module to 0.2.0 where I included output tests. (the minor version was due to some differences on the stderr output on failing tests) |
Ref qunitjs#790 QUnit was found exported to the global object on Node environment
Ref qunitjs#790 QUnit was found exported to the global object on Node environment
|
By several arguments, I'm closing this PR. We are on the way to have a release of js-reporters, as many improvement ideas came after this PR and now rebasing this is not easy. |
Ref qunitjs#790 QUnit was found exported to the global object on Node environment
Ref qunitjs#790 Closes qunitjs#813 QUnit was found exported to the global object on Node environment
With this reporter we can use QUnit directly on npm environments:
The stdout reporter is only activated when called, this way we keep the retrocompatibility.
Log example: https://www.dropbox.com/s/07k3funzdwp0y7r/Screenshot%202015-03-19%2016.18.25.png?dl=0
The reporter function also accepts an object with the options, the only current available options is
output: