Is it possible to get diffs and full stack trace with Mocha in the browser?

Viewed 8

I'm trying to run mocha in the browser. I'm bundling the whole thing using webpack, and I have the following files:

// index.js
const mocha = require('mocha')

mocha.setup({
  retries: 3,
  timeout: '5000',
  ui: 'bdd',
  inlineDiffs: true,
  diff: true,
  fullTrace: true,
})

require('./parameters.test')

mocha.run()

And an actual test:

// parameters.test.js
const chai = require('chai')

describe('Parameters', () => {
  // doesn't really matter what it does
  it('should test if path parameters were properly deserialized', async () => {
    const path = randomPathParameters()
    const response = await parametersSdk.simplePathParameters({ path })
    chai.expect(response.body).to.deep.equal(path)
  })
})

The problem is, that even though I think I'm configuring mocha.setup according to the docs: https://mochajs.org/api/mocha, I get this kind of output, which is absolutely useless, as I have no way of determining where the issue was:

Mocha output

So my question is:

  • Is it possible for the the browser UI, to show the proper stack trace, and proper diffs
  • If so, how?
0 Answers
Related