Giter VIP home page Giter VIP logo

mochawesome's Introduction

mochawesome

npm Node.js CI Gitter

Mochawesome is a custom reporter for use with the Javascript testing framework, mocha. It runs on Node.js (>=10) and works in conjunction with mochawesome-report-generator to generate a standalone HTML/CSS report to help visualize your test runs.

Features

Mochawesome Report

  • Simple, clean, and modern design
  • Beautiful charts (via ChartJS)
  • Support for test and suite nesting
  • Displays before and after hooks
  • Review test code inline
  • Stack trace for failed tests
  • Support for adding context information to tests
  • Filters to display only the tests you want
  • Responsive and mobile-friendly
  • Offline viewing
  • Supports parallel mode

Usage

  1. Add Mochawesome to your project:

npm install --save-dev mochawesome

  1. Tell mocha to use the Mochawesome reporter:

mocha testfile.js --reporter mochawesome

  1. If using mocha programatically:
var mocha = new Mocha({
  reporter: 'mochawesome',
});

Parallel Mode

Since mocha@8 test files can be run in parallel using the --parallel flag. In order for mochawesome to work properly it needs to be registered as a hook.

mocha tests --reporter mochawesome --require mochawesome/register

Output

Mochawesome generates the following inside your project directory:

mochawesome-report/
├── assets
│   ├── app.css
│   ├── app.js
│   ├── MaterialIcons-Regular.woff
│   ├── MaterialIcons-Regular.woff2
│   ├── roboto-light-webfont.woff
│   ├── roboto-light-webfont.woff2
│   ├── roboto-medium-webfont.woff
│   ├── roboto-medium-webfont.woff2
│   ├── roboto-regular-webfont.woff
│   └── roboto-regular-webfont.woff2
├── mochawesome.html
└── mochawesome.json

The two main files to be aware of are:

mochawesome.html - The rendered report file

mochawesome.json - The raw json output used to render the report

Options

Options can be passed to the reporter in two ways.

Environment variables

The reporter will try to read environment variables that begin with MOCHAWESOME_.

$ export MOCHAWESOME_REPORTFILENAME=customReportFilename

Note that environment variables must be in uppercase.

Mocha reporter-options

You can pass comma-separated options to the reporter via mocha's --reporter-options flag. Options passed this way will take precedence over environment variables.

$ mocha test.js --reporter mochawesome --reporter-options reportDir=customReportDir,reportFilename=customReportFilename

Alternately, reporter-options can be passed in programatically:

var mocha = new Mocha({
  reporter: 'mochawesome',
  reporterOptions: {
    reportFilename: 'customReportFilename',
    quiet: true,
  },
});

Available Options

The options below are specific to the reporter. For a list of all available options see mochawesome-report-generator options.

Option Name Type Default Description
quiet boolean false Silence console messages
reportFilename string mochawesome Filename of saved report (html and json)
See notes for available token replacements.
html boolean true Save the HTML output for the test run
json boolean true Save the JSON output for the test run
consoleReporter string spec Name of mocha reporter to use for console output, or none to disable console report output entirely

reportFilename replacement tokens

Using the following tokens it is possible to dynamically alter the filename of the generated report.

  • [name] will be replaced with the spec filename when possible.
  • [status] will be replaced with the status (pass/fail) of the test run.
  • [datetime] will be replaced with a timestamp. The format can be - specified using the timestamp option.

For example, given the spec cypress/integration/sample.spec.js and the following config:

{
  reporter: "mochawesome",
  reporterOptions: {
    reportFilename: "[status]_[datetime]-[name]-report",
    timestamp: "longDate"
  }
}

The resulting report file will be named pass_February_23_2022-sample-report.html

Note: The [name] replacement only occurs when mocha is running one spec file per process and outputting a separate report for each spec. The most common use-case is with Cypress.

Adding Test Context

Mochawesome ships with an addContext helper method that can be used to associate additional information with a test. This information will then be displayed inside the report.

Please note: arrow functions will not work with addContext. See the example.

addContext(testObj, context)

param type description
testObj object The test object
context string|object The context to be added to the test

Context as a string

Simple strings will be displayed as is. If you pass a URL, the reporter will attempt to turn it into a link. If the URL links to an image or video, it will be shown inline.

Context as an object

Context passed as an object must adhere to the following shape:

{
  title: 'some title'; // must be a string
  value: {
  } // can be anything
}

Example

Be sure to use ES5 functions and not ES6 arrow functions when using addContext to ensure this references the test object.

const addContext = require('mochawesome/addContext');

describe('test suite', function () {
  it('should add context', function () {
    // context can be a simple string
    addContext(this, 'simple string');

    // context can be a url and the report will create a link
    addContext(this, 'http://www.url.com/pathname');

    // context can be an image url and the report will show it inline
    addContext(this, 'http://www.url.com/screenshot-maybe.jpg');

    // context can be an object with title and value properties
    addContext(this, {
      title: 'expected output',
      value: {
        a: 1,
        b: '2',
        c: 'd',
      },
    });
  });
});

It is also possible to use addContext from within a beforeEach or afterEach test hook.

describe('test suite', () => {
  beforeEach(function () {
    addContext(this, 'some context');
  });

  afterEach(function () {
    addContext(this, {
      title: 'afterEach context',
      value: { a: 1 },
    });
  });

  it('should display with beforeEach and afterEach context', () => {
    // assert something
  });
});

Typescript

This project does not maintain its own type definitions, however they are available on npm from DefinitelyTyped.

$ npm install --save-dev @types/mochawesome

Related

mochawesome-report-generator

License

mochawesome is MIT licensed.

mochawesome's People

Contributors

adamgruber avatar aldarund avatar armno avatar benmagyar avatar dingoeatingfuzz avatar kolbasik avatar mpetrak avatar nkvp avatar ramiloif avatar scott2449 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mochawesome's Issues

Code block empty

Hi there!

I love the report 💯 , but one of its really useful features, "Show code", doesn't work in my project.
I think it might be related to the fact I'm using gulp-mocha and not mocha directly.

Would you have any idea?

Configuration

How do you configure it when used with MochaPhantomJS?

This is my gulp file:

gulp.task('test', function () {
    return gulp.src('tests/runner.html')
        .pipe( mochaPhantomJS({
            reporter: 'mochawesome'
        }) );
});

What do I have to drop into runner.html to make it work?

mocha.opts --reporter-options issue

I'm using a mocha.opts file for ease-of-use config of the CLI arguments that are passed to mocha.

I have discovered that, if for example I have a mocha.opts file like the following:

--reporter mochawesome --reporter-options reportDir=mocha-reports,reportName=ViewReport,reportTitle=Mocha Tests

it will fail because of the space in reportTitle=Mocha Tests.

reportTitle=MochaTests or reportTitle=Mocha-Tests works correctly.

It would be nice to be able to use spaces in the report title, reportName, reportDirparameters of the reporter.

Running mocha from the browser

Hi,

First of all - kudos for the great job on the project.
For one of my projects I'm having a setup similar to this one - https://gist.github.com/michaelcox/3800736 where I'm running mocha from the browser with requirejs. Is there any way to make mochawesome run as reporter when running mocha in the browser.

Thanks in advance

[mochawesome] Error: Unable to save mochawesome-reports/mochawesome.html

Hi

I am not able to get the json/html reports in the reports folder.
I run the tests using this command:
mocha test --reporter mochawesome (all my tests are inside the "test" folder)
And, I get this error:

[mochawesome] Error: Unable to save mochawesome-reports/mochawesome.json
Error: ENOENT: no such file or directory, open 'mochawesome-reports/mochawesome.json'
[mochawesome] Error: Unable to save mochawesome-reports/mochawesome.html
Error: ENOENT: no such file or directory, open 'mochawesome-reports/mochawesome.html'
[mochawesome] Report saved to mochawesome-reports/mochawesome.html

And the mochawesome-reports contains:

tree mochawesome-reports/
mochawesome-reports/
|-- css
|   |-- mochawesome-64.css
|   `-- mochawesome.css
|-- fonts
|   |-- mochawesome.eot
|   |-- mochawesome.svg
|   |-- mochawesome.ttf
|   |-- mochawesome.woff
|   |-- Roboto+Condensed_300_normal.ttf
|   |-- Roboto+Condensed_300_normal.woff
|   |-- Roboto+Condensed_400_normal.svg
|   |-- Roboto+Condensed_400_normal.ttf
|   |-- Roboto+Condensed_400_normal.woff
|   |-- Roboto+Condensed_700_normal.ttf
|   |-- Roboto+Condensed_700_normal.woff
|   |-- Roboto+Slab_400_normal.svg
|   |-- Roboto+Slab_400_normal.ttf
|   `-- Roboto+Slab_400_normal.woff
`-- js
    |-- mochawesome.js
    `-- vendor.js

3 directories, 18 files

How can i get this working?

Display is "ugly" after creating new report

It appears that all the css/font resources are not copied to output directory.

When I iniitally create a report, the report is "ugly". If I take the css/fonts directories from the node_modules/mocawesome/dist directory and move into the output directory, everything is gorgeous.

But, I have to do this EVERYTIME I generate a report. Is there a way to not delete these directories in the output directory?

ugly mochawesome.html

Haven't investigated why as this is the very first time I'm using this NPM in my project to generate "fancy" reports.
However, the generated mochawesome.html looks very odd.
Here my configuration:

OS X El Capitan v10.11.4

package.json:

  "devDependencies": {
    "chai": "^3.5.0",
    "mocha": "^2.3.4",
    "mochawesome": "^1.3.4",
    "xo": "^0.15.1"
  },
  "scripts": {
    "test": "xo src/**/* && mocha ./src/js/*.spec.js --recursive --reporter mochawesome"
  },

How to save try-catch exception into report

I want to do so:
try {
assert.equal(title, 'webdriver');
} catch (e) {

}
This is necessary, that test didn't come down, after 'assert'. But, in this case, report does not contain the error. How to save exception into report in this case? Please help me.

Table-of-contents sidebar?

I just had another enhancement idea: a sticky table-of-contents sidebar that lets you quickly jump to the test suite. Quicker than having to scroll all the time.

v2.0 Roadmap

There are some big changes planned for Version 2.0, including:

  • Break out the HTML report into a standalone package (Useful if you already have some saved test output JSON and just want to create the report.)
  • Rewrite the report using React components
  • Remove Bootstrap and only use select styles as needed
  • Remove jQuery
  • Add/Enhance tests
  • Switch from gulp to webpack
  • Rewrite CSS using css-modules and cssnext
  • Support showing of diffs
  • Support rendering of additional test information
  • Updated design

The standalone report package can be found here: mochawesome-report

Is there any plan to support react?

I am using enzyme-mocha for my react app testing. It's throwing some error. I guess it is jsx syntax error.
If it is the problem, is there any plan to include? If it's not the problem, please guide to resolve the same.
Thanks.

"Invalid string length" and memory issues

Hello,

We've been having issues where using mochawesome as a reporter causes the node process to run out of memory. We have a fairly large number of tests to run (~800), but when run with no reporter they work just fine.

After vastly reducing the number of tests (to ~40) I managed to get the following related error:

Problem with mochawesome: RangeError: Invalid string length
    at join (native)
    at Object.stringify (native)
    at stringify (/usr/lib/node_modules/mochawesome/node_modules/json-stringify-safe/stringify.js:5:15)
    at Runner.<anonymous> (/usr/lib/node_modules/mochawesome/lib/mochawesome.js:116:20)
    at emitNone (events.js:72:20)
    at Runner.emit (events.js:166:7)
    at /usr/lib/node_modules/mocha/lib/runner.js:791:12
    at /usr/lib/node_modules/mocha/lib/runner.js:644:9
    at next (/usr/lib/node_modules/mocha/lib/runner.js:284:14)
    at Immediate._onImmediate (/usr/lib/node_modules/mocha/lib/runner.js:320:5)
    at processImmediate [as _immediateCallback] (timers.js:383:17)

Reducing it further (to 12!) then works fine.

The problem seems to be that each hook in the allHooks part of the object being passed to stringify (lib/mochawesome.js:116) contains two circular references - stringify does detect some of this but it results in a huge amount of duplicated stuff in the output. This vastly multiplies the impact of having many hooks alongside tests with a large body of content. When running with a large number of tests, the process runs out of memory before it is able to produce the error.

Attached is a file that will reproduce the problem, at least on my machine. Since it's a memory issue YMMV! It's a bit contrived but the idea is simply to show how a large number of hooks, tests, or a large test code body all contribute. Making the code body smaller doesn't entirely solve the issue, it just prevents it from happening until the test count is higher.

Versions:
node v4.3.2
mocha 2.4.5
mochawesome 1.3.1
Running via command line.

Is this something fixable?

mochawesomeMemTest.zip

Safe directory creation

Library is throwing an error when one or more of the parent directories of the path passed to reportDir does not exist.

Gulp task call:

gulp.task('test:execute', mochaTest({
  sources: paths.mochaTests,
  mochaOptions: {
    reporter: 'mochawesome',
    reporterOptions: {
      reportDir: paths.mochaReport,
      reportTitle: 'Core Build',
      inlineAssets: true
    }
  }
}));

Gulp task source:

export const mochaTest = (options = {}) => {
  let {
    sources = [],
    mochaOptions = {}
  } = options;

  return () => gulp.src(sources).pipe(mocha(mochaOptions));
}

Ouptut:

[mochawesome] Generating report files...

[16:46:34] 'test:execute' errored after 226 ms
[16:46:34] Error in plugin 'gulp-mocha'
Message:
    ENOENT: no such file or directory, mkdir '/Users/patrickhousley/Documents/projects/github/core-build/reports/mochaReport'
Details:
    errno: -2
    code: ENOENT
    syscall: mkdir
    path: /Users/patrickhousley/Documents/projects/github/core-build/reports/mochaReport
Stack:
Error: ENOENT: no such file or directory, mkdir '/Users/patrickhousley/Documents/projects/github/core-build/reports/mochaReport'
    at Error (native)
    at Object.fs.mkdirSync (fs.js:842:18)
    at /Users/patrickhousley/Documents/projects/github/core-build/node_modules/mochawesome/lib/reportGenerator.js:51:10
    at Array.forEach (native)
    at createDirs (/Users/patrickhousley/Documents/projects/github/core-build/node_modules/mochawesome/lib/reportGenerator.js:49:8)
    at Array.async.auto.createDirs (/Users/patrickhousley/Documents/projects/github/core-build/node_modules/mochawesome/lib/reportGenerator.js:19:9)
    at /Users/patrickhousley/Documents/projects/github/core-build/node_modules/mochawesome/node_modules/async/lib/async.js:484:38
    at _each (/Users/patrickhousley/Documents/projects/github/core-build/node_modules/mochawesome/node_modules/async/lib/async.js:46:13)
    at Object.async.auto (/Users/patrickhousley/Documents/projects/github/core-build/node_modules/mochawesome/node_modules/async/lib/async.js:455:9)
    at generateReport (/Users/patrickhousley/Documents/projects/github/core-build/node_modules/mochawesome/lib/reportGenerator.js:15:9)
[16:46:34] 'test' errored after 528 ms
[16:46:34] Error in plugin 'run-sequence'
Message:
    An error occured in task 'test:execute'.

extra slash for fonts ==> fonts not working on S3

when posting the nicely generated reports to S3, fonts break down due to an extra slash showing up.
i.e. fonts//Roboto+Condensed_300_normal.woff

This was not noticed on local machine, but S3 is more restrictive and breaks.

Error Sending to VALID addresses

Is anyone having the issue where some jobs in Jenkins are sending emails out and then other jobs with same email list are getting the error "Error sending to the following VALID addresses:"?? The console log for the job at the top is cutting part of it off with "Skipping 1,363 KB.. Full Log". Is the log too long so errors on sending the emails?

Mocha: 2.5.3
Mochawesome: [email protected]
Using npm script to call mocha ... --reporter

Any help would be great, thanks.

Report index file generation fails

Reporter cannot generate index file, and I got this exception:

Problem with mochawesome: TypeError: this.runnable is not a function
    at Object.ret [as title] (/project/node_modules/selenium-webdriver/testing/index.js:120:25)
    at Object.Handlebars.registerPartial.Handlebars.template.main (/project/node_modules/mochawesome/lib/templates.js:443:156)
    at ret (/project/node_modules/handlebars/dist/cjs/handlebars/runtime.js:159:30)
    at Object.invokePartial (/project/node_modules/handlebars/dist/cjs/handlebars/runtime.js:218:12)
    at Object.invokePartialWrapper [as invokePartial] (/project/node_modules/handlebars/dist/cjs/handlebars/runtime.js:61:39)
    at Object.Handlebars.registerPartial.Handlebars.template.26 (/project/node_modules/mochawesome/lib/templates.js:349:23)
    at prog (/project/node_modules/handlebars/dist/cjs/handlebars/runtime.js:193:15)
    at execIteration (/project/node_modules/handlebars/dist/cjs/handlebars/base.js:155:19)
    at Object.each (/project/node_modules/handlebars/dist/cjs/handlebars/base.js:164:11)
    at Suite.<anonymous> (/project/node_modules/handlebars/dist/cjs/handlebars/base.js:104:33)

I didn't play much with it, but if I change this line (mochawesome/lib/templates.js:443:156):
+ alias3(((helper = (helper = helpers.title || (depth0 != null ? depth0.title : depth0)) != null ? helper : alias1),(typeof helper === alias2 ? helper.call(depth0,{"name":"title","hash":{},"data":data}) : helper)))

to this:
+ alias3(((helper = (helper = helpers.title || (depth0 != null ? depth0.title : depth0)) != null ? helper : alias1),(typeof helper === alias2 ? helper : helper)))

everything looks fine

I'm using [email protected], [email protected], [email protected], [email protected]
please tell me if you need more information

Suggestion : Callback when done.

It would be realy nice if we would be able to return the html result after the test are run and the file is generated. I think saveToFile is Async so i cannot tell when the html is available for return.

Going crazy with --watch

If i add --watch flag, the reporter is going crazy.
It looks like he is doing all tests multiple times and adds and removes the css several times.
Sometimes they are missing at the end of the crazy-going-session.

licence

Under which licence the lib is released ? MIT?

Not working with mocha's --recursive option?

Ubuntu 12.04
Mocha 2.4.5
Mochawesome 1.3.2

This works fine:
mocha test/rsp/date-spec.js --reporter mochawesome
This runs the tests, but fails on file generation:
mocha test --recursive --reporter mochawesome
With this error:

Problem with mochawesome: TypeError: string is not a function
    at cleanTest (/home/iharrison/Projects/modules/node_modules/mochawesome/lib/mochawesome.js:252:21)
    at arrayMap (/home/iharrison/Projects/modules/node_modules/mochawesome/node_modules/lodash/index.js:1406:25)
    at Function.map (/home/iharrison/Projects/modules/node_modules/mochawesome/node_modules/lodash/index.js:6710:14)
    at cleanSuite (/home/iharrison/Projects/modules/node_modules/mochawesome/lib/mochawesome.js:162:22)
    at traverseSuites (/home/iharrison/Projects/modules/node_modules/mochawesome/lib/mochawesome.js:139:7)
    at Runner.<anonymous> (/home/iharrison/Projects/modules/node_modules/mochawesome/lib/mochawesome.js:77:9)
    at Runner.emit (events.js:129:20)
    at /usr/local/lib/node_modules/mocha/lib/runner.js:791:12
    at /usr/local/lib/node_modules/mocha/lib/runner.js:644:9
    at next (/usr/local/lib/node_modules/mocha/lib/runner.js:284:14)
    at Immediate._onImmediate (/usr/local/lib/node_modules/mocha/lib/runner.js:320:5)
    at processImmediate [as _immediateCallback] (timers.js:367:17)

This very well could be something else that's my fault... let me know if it is.

Thanks!

Anchor #links in the test headings

That would make it easier to navigate or refer someone to a particular test result. Like how Github and npm do to the headings in README files.

Reporter Not Found since this morning

Since this morning, i got this error when running
with mochawesome 1.4.0

mocha --timeout 5000 tests/stats --reporter mochawesome
"mochawesome" reporter not found
/Users/qwerty/npm/lib/node_modules/mocha/lib/mocha.js:164
      throw new Error('invalid reporter "' + reporter + '"');
      ^

Error: invalid reporter "mochawesome"
    at Mocha.reporter (/Users/qwerty/npm/lib/node_modules/mocha/lib/mocha.js:164:13)
    at Object.<anonymous> (/Users/qwerty/npm/lib/node_modules/mocha/bin/_mocha:207:7)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.runMain (module.js:575:10)
    at run (bootstrap_node.js:352:7)
    at startup (bootstrap_node.js:144:9)
    at bootstrap_node.js:467:3

Sending mochawesome report as Jenkins email attachment

I have written mocha smoke test cases to run on Jenkins every hour.
I also have intergrated the mochawesome report.The report gets generated every time inside the workspace>>mochawesome folder.
I wanted to have a way to send this report through the email functionality of jenkins whenever the build fails.

Pass/Fail filters

It looks like the JS code allows for filters to stack or some such nonsense 😈

  1. If I click on fail number and that removes all the tests, and then I click on success which shows me 50% of the tests. If keep clicking on success it toggles between 50% and 0% instead of 50% and 100% which is what I would expect.

  2. A visual indication of what filters are in play would also be awesome.

Enhancement: Auto open with Nightwatch Mocha

Versions:

Windows 8
Nightwatch: 0.8.18
Mocha-nightwatch: 2.2.7
Mochawesome 1.3.3

Could an additional option to auto-open the HTML report be added to the config? This could be achieved with the use of Open in the saveToFile callback:

eg. in mochawesome.js - Line 112

saveToFile(stringify(obj, null, 2), config.reportJsonFile, function(){});
        saveToFile(templates.mochawesome(obj), config.reportHtmlFile, function() {
          console.log('\n[' + chalk.gray('mochawesome') + '] Report saved to ' + config.reportHtmlFile + '\n\n');

if(config.openReport){
          open(config.reportHtmlFile);
}        
});

stop before copy css/font/js finished

Hi, I use the mochawesome and find that css & font & js file always size 0 (very little time some of them 64KB). I track for the process and find that mochawesome finished before ncp copy finished and it makes copy process stop.

PS: use inlineAssets=true can avoid this temporary.

Generate mochawesome from Karma

Is there any way to generate mochawesome report from karma?
I tried to use "client:mocha:reporter" option from "karma-mocha", but not works =/.

TypeError: test.fullTitle is not a function

hi there,

mochasome looks really cool.
i just tried to run it for the first time but straight run in an error :(

Environment Information

npm: 3.10.7
node: v6.5.0
mocha: 3.0.2
mochasome: 1.5.2

Problem with mochawesome: TypeError: test.fullTitle is not a function
    at cleanTest (fullstack/npm/modules/array-numbers/node_modules/mochawesome/lib/mochawesome.js:256:21)
    at arrayMap (fullstack/npm/modules/array-numbers/node_modules/mochawesome/node_modules/lodash/index.js:1406:25)
    at Function.map (fullstack/npm/modules/array-numbers/node_modules/mochawesome/node_modules/lodash/index.js:6710:14)
    at cleanSuite (fullstack/npm/modules/array-numbers/node_modules/mochawesome/lib/mochawesome.js:166:22)
    at traverseSuites (fullstack/npm/modules/array-numbers/node_modules/mochawesome/lib/mochawesome.js:143:7)
    at Runner.<anonymous> (fullstack/npm/modules/array-numbers/node_modules/mochawesome/lib/mochawesome.js:78:9)
    at emitNone (events.js:91:20)
    at Runner.emit (events.js:185:7)
    at /Users/fullstackx/.nvm/versions/node/v6.5.0/lib/node_modules/mocha/lib/runner.js:798:12
    at /Users/fullstackx/.nvm/versions/node/v6.5.0/lib/node_modules/mocha/lib/runner.js:646:9
    at next (/Users/fullstackx/.nvm/versions/node/v6.5.0/lib/node_modules/mocha/lib/runner.js:285:14)
    at Immediate.<anonymous> (/Users/fullstackx/.nvm/versions/node/v6.5.0/lib/node_modules/mocha/lib/runner.js:327:5)
    at runCallback (timers.js:574:20)
    at tryOnImmediate (timers.js:554:5)
    at processImmediate [as _immediateCallback] (timers.js:533:5)

HTML Reports Problem

I am trying to run my mocha test cases and reporting output with mochawesome but i endup with a error

137 passing (184ms)
24 pending

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
Aborted (core dumped)

mochawesome-reports folder is generated and inside it i have

css
fonts
js

folders but HTML reports are not generated.

Could you please suggest me the solution

i have tried spec,dot and various other reporter they are running perfectly over the stdout but i want HTML reports.

This is more a question than an issue

How do I set the report title that shows on to of the html page?
Right now it seems that reportName is really the name of the html page that will be outputted. For example if i put reportName='index', it outputs index.html
but the title of the report on the actual page seem to always be the name of the root directory (I loko at your code and actually that is how you are getting the reportTitle)

Could you kindly update that to use reportTitle if specified with the reportOptions?

That way we can do simply:

mocha({
reporter: 'mochawesome',
reporterOptions: {
reportDir: reportDir,
reportName: reportName,
reportTitle: reportTitle
}
}

Thank you so much for your greta work with this package!
Damiano

option to inline external dependencies?

Hello!

This report looks ace, but I'd quite like a way to bundle everything into a single file - rather than having to zip the report up to move it around.

Is that something you'd be open to exposing as an option?

I can probably provide a PR if you're on board with the idea.

If a test fails, Print some text

For example if a test fails and a status code it isn't 200 as we want, if i want to output status code together with Response Body would be very helpful in a reporter like MochAwesome.

.end(function(err, res){
               expect(res.statusCode).to.equal(200, 'Status Code: ' + res.statusCode + '\n' + 
                                       'Response message: ' + res.body);
               done();

Thanks for the great work you do btw.

is there a way i can use mochawesome reporter instead of Jenkins reporter

First of all, i really like this reporter. It's really awesome. I just implemented it for my current project.

I had couple of questions, if you could advise with -

Firstly, i m passing the reporter name, dynamic reporter path with timestamp from command line while running my mocha scripts, and i have all this done in a shell script. We were planning to integrate the test suite with Jenkins. Im totally new to Jenkins, so i was wondering is there a way i can use mochawesome reporter to be created when running scripts from Jenkins, instead of Jenkins reporter?

Secondly is there a way i can pass custom variable values to the HTML report? Like im using chakram for API automation and was wondering if there is any way i can pass the response to the HTML report?

Thirdly im using Selenium's function to take screenshot, is there a way i can pass that screenshot to the test case like with a hyperlink to the HTML report? Just like how Protractor Jasmine reporter has?

Mochawesome for Continuous Integration?

This is awesome! I'm trying to figure out how I could use this as a DYI substitute for a CI service like Travis. Mainly, I'd need a way to auto-publish the results (maybe git hooks + Github pages?) but ideally it would show the git branch name, git commit #, and keep a history of the test results. Yay? Nay? Thoughts?

Invalid report "mochawesome"

Hi! Could you tell me please what am I doing wrong?

  1. I added in package.json next
    image
  2. Run the command
    mocha protractor conf.js --reporter mochawesome
  3. And I have an error
    image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.