Questions tagged [mocha.js]

Mocha.js is a feature-rich JavaScript test framework running on Node.js and the browser.

Mocha is a feature-rich test framework running on and the browser, making asynchronous testing simple and fun. Mocha tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases.

There is also a (completely separate) "mocha" library for Ruby, which is about mocking for tests. Searches for "mocha" will find both things, so check your results for and to get the one you are looking for!

8538 questions
3
votes
1 answer

How to start node server before running end to end tests using npm run?

I'm writing end to end tests for an express site, and I want to add a "test" command into package.js This command needs to: run eslint compile typescript start node server run unit tests against that server and show output. once done testing,…
Rainer Plumer
  • 3,693
  • 2
  • 24
  • 42
3
votes
0 answers

webpack with DefinedPlugin and Mocha unit test

I am using DefinedPlugin() to set global staging variables inside webpack.config.js. This is working and I am able to retrieve these variables in my app files. The issue I have is when I run the unit test with Mocha it throws an error…
user742736
  • 2,629
  • 5
  • 30
  • 40
3
votes
1 answer

No coverage information was collected, istanbul coverage. (answer for similar issues in page is not work for me)

i user this command: set CODACY_PROJECT_TOKEN=my_token&& istanbul cover --report lcov node_modules/mocha/bin/_mocha -- -r babel-register -r ./test_helper.js \"test/**/*@(.js|.jsx)\" Then i take passed in all test case but "No coverage information…
Thanh Tài
  • 31
  • 2
3
votes
3 answers

TypeError: expect.createSpy is not a function

Trying to use properties of spy and end up with this error. var spy = expect.createSpy(); spy(); expect(spy).toHaveBeenCalled(); Error : TypeError: expect.createSpy is not a function
Adil Chowdhury
  • 335
  • 1
  • 5
  • 18
3
votes
1 answer

How can I use Perl's 'prove' with TAP producers in other languages?

I'm a Perl dev working with a multi-language project, including python, node.js and C. Thankfully all of these languages have TAP producer libraries. For example, I can use the mocha command to run Node.js scripts and get TAP output. However, how…
user3243135
  • 800
  • 1
  • 7
  • 28
3
votes
1 answer

How do I execute different Testcases with different structure through NodeJS and Mocha

How do I execute different Testcases with different structure through NodeJS and Mocha. Moving forward I intend to integrate Selenium + NodeJS + Mocha I have just started to explore NodeJS with Mocha and need some help. Installed…
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
3
votes
2 answers

Multiple Sinon stubs against global window not working as expected

I'm using Karma with Mocha, Chai and Sinon to test code in a project using this boilerplate. The Subject Under Test uses the Speech Synthesis API. I start by establishing window.speechSynthesis.getVoices in a beforeEach method beforeEach(() => { …
quickshiftin
  • 66,362
  • 10
  • 68
  • 89
3
votes
2 answers

How to replace mocha UTF8 checkmark symbol in jenkins

When I run the mocha tests in jenkins, on the console output I can see â insetad of the ✓ (CHECK MARK) utf-8 character. How can I replace these symbols to human readable format
Gergely Fehérvári
  • 7,811
  • 6
  • 47
  • 74
3
votes
1 answer

is there any way to unit test a Vue.js transition

I have a Vue component with a transition with a dynamic name. I'm trying to find a way to test that the transition name is set properly based on the props I pass into the component. Here's the component.