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

reporter output to a file #2

Closed
ayhid opened this issue Jun 22, 2016 · 14 comments
Closed

reporter output to a file #2

ayhid opened this issue Jun 22, 2016 · 14 comments

Comments

@ayhid
Copy link

ayhid commented Jun 22, 2016

I am trying to use circle ci with my meteor app, however I need the reporter to write its output to a file, any clues how to accomplish this?
Thanks

@aldeed
Copy link
Contributor

aldeed commented Jun 23, 2016

Maybe this would work? https://www.npmjs.com/package/reporter-file

You can specify the "reporter-file" reporter for dispatch:mocha as explained here: https://github.com/DispatchMe/meteor-mocha#run-with-a-different-reporter

@ayhid
Copy link
Author

ayhid commented Jun 23, 2016

thanks @aldeed for your reply
I added reporter file to my project devDependencies but when running tests with this command:

SERVER_TEST_REPORTER='xunit-file' meteor test  --once --driver-package dispatch:mocha

I got this error Error: invalid reporter "xunit-file"
It seems that the mocha driver can not 'see' the new reporter

@aldeed
Copy link
Contributor

aldeed commented Jun 23, 2016

@ayhid I haven't tried, but the way I read the docs, the command should be:

MOCHA_REPORTER=XUnit SERVER_TEST_REPORTER=reporter-file meteor test --once --driver-package dispatch:mocha

And you can also add MOCHA_REPORTER_FILE=something.xml if you don't want the default filename of xunit.xml in the current directory

I you just want xunit file, you could also use https://www.npmjs.com/package/xunit-file package and then SERVER_TEST_REPORTER='xunit-file' would work.

@ayhid
Copy link
Author

ayhid commented Jun 24, 2016

@aldeed I tried the command you suggested but I still have Error: invalid reporter "reporter-file" exception for some reason the "reporter-file" module is not "seen" by dispatch:mocha.

@aldeed
Copy link
Contributor

aldeed commented Jun 24, 2016

OK, I wasn't sure. We can accept a PR for this or look into it when there's time.

@ayhid
Copy link
Author

ayhid commented Jun 24, 2016

added xunit-file as a dependency for practicalmeteor:mocha-core and with this command

MOCHA_REPORTER=XUnit SERVER_TEST_REPORTER=xunit-file XUNIT_FILE=/home/optimus/cleanio/orders-microservice/output/xunit.xml  meteor test --once --driver-package dispatch:mocha

I finally got my report on a file.
I would like to make a PR but I have to admit I don't know where to start, any help is much appreciated.
Thanks

@jeffryan
Copy link

jeffryan commented Sep 7, 2016

@aldeed thanks for this package! It seems to work fine for standard console output which is a big step up for us as spacejam has been broken for us for quite a while.

We too are interested in using an xunit file reporter as we have xunit parsers in our CI environment. I've read through your discussion above and tried a number of things but cannot seem to get the underlying practicalmeteor:mocha-core to see the new reporter.

@ayhid would you mind describing further how you added xunit-file as a dependency for practicalmeteor:mocha-core? Did you actually clone the repo locally and add the dependency to the package.js file?

I am doing package testing and am pulling dispatch:mocha-phantomjs in as a test dependency in our project. I'm not sure how to add the said dependency outside cloning the repo and modifying it. Not an ideal solution but if thats what it takes...

@ayhid
Copy link
Author

ayhid commented Sep 8, 2016

hey @jeffryan , like you said I just added the package to my fork dependecies.

And I added it locally as a submodule, it's not the cleanest solution ever, but it does the job for now.

@jeffryan
Copy link

jeffryan commented Sep 8, 2016

Hey thanks @ayhid - I'm just going to use your fork then ;)

@jmblanc
Copy link

jmblanc commented Nov 10, 2016

Hello,

i am concerned about Continus Integration, and I also failed to get a xunit file. but I dont know how to apply your solution, I mean pratically. Is it possible that you add some explanations ? Thanks.

@thebarty
Copy link

Hi guys,

can you please post an update on this? Any news?

I am trying to output a CircleCi compatible xml, but am getting a Error: invalid reporter "xunit-file" error, if I run something like MOCHA_REPORTER=XUnit SERVER_TEST_REPORTER=xunit-file XUNIT_FILE=xunit.xml meteor test --once --driver-package dispatch:mocha.

This is a more detailed description of my usecase https://forums.meteor.com/t/enhanced-but-simply-stupid-circleci-setup-that-first-runs-unit-integration-tests-and-then-chimp-acceptance-tests/35086

Thanks a lot for your help!

@thebarty
Copy link

@jeffryan @ayhid : Can please share a step-by-step instruction on how to do this? This would be really awesome!!!

@thebarty
Copy link

ok this is what worked out for me:

meteor add practicalmeteor:mocha  # we'll use this package to generate CircleCi compatible xml-files
meteor remove practicalmeteor:mocha;  # cleanup for `dispatch:mocha` (otherwise we'll get a version-constraint)
meteor add practicalmeteor:chai
cd packages; git clone https://github.com/ayhid/meteor-mocha-core.git
# finally create the xml file
targetXmlFilePath="$(pwd)/unit.xml"; MOCHA_REPORTER=XUnit SERVER_TEST_REPORTER=xunit-file XUNIT_FILE=$targetXmlFilePath meteor test --once --driver-package dispatch:mocha

@aldeed : How about getting a CircleCi-compatible reporter build right into this package to make it easy for future users?

@aldeed aldeed closed this as completed in 86bde24 Mar 29, 2017
@aldeed
Copy link
Contributor

aldeed commented Mar 29, 2017

@thebarty Just published 0.3.0, which should let you do SERVER_TEST_REPORTER=xunit XUNIT_FILE=$PWD/unit.xml without needing the forked core or any other workarounds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants