Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Feb 24 22:36
    juergba closed #3703
  • Feb 24 22:30

    juergba on node-esm-support

    (compare)

  • Feb 24 22:30

    juergba on copy-esm

    (compare)

  • Feb 24 22:02

    juergba on master

    Add support for Node.JS native … (compare)

  • Feb 24 22:02
    juergba closed #4038
  • Feb 24 21:35
    juergba unlabeled #4038
  • Feb 24 21:22

    juergba on node-esm-support

    add support for Node.JS native … (compare)

  • Feb 24 21:04
    juergba synchronize #4038
  • Feb 24 17:52
    juergba review_requested #4190
  • Feb 24 17:48
    juergba labeled #4181
  • Feb 24 17:47
    juergba labeled #2188
  • Feb 24 17:45

    juergba on retries

    (compare)

  • Feb 24 17:18

    juergba on master

    Fix: programmatic API cannot ac… (compare)

  • Feb 24 17:18
    juergba closed #4181
  • Feb 24 17:18
    juergba closed #2188
  • Feb 24 16:24
    New Donation: anonymous gave USD 5 to MochaJS!
  • Feb 23 11:52
    outsideris labeled #4183
  • Feb 23 09:27

    juergba on node-esm-support

    add support for Node.JS native … remove mocha.runAsync code review (compare)

  • Feb 23 09:13
    juergba closed #4191
  • Feb 23 08:50
    juergba synchronize #4038
Nitesh Pandey
@saiyeek
Hi, I am trying to create a custom mocha reporter with typescript, but seems like I am unable to set types correctly, has anyone written a custom mocha reporter with typescript?
Nitesh Pandey
@saiyeek
Getting something like Could not find a declaration file for module 'mocha/lib/reporters/base'. '/Users/abc/projects/opensource/remote-mocha-reporter/node_modules/mocha/lib/reporters/base.js' implicitly has an 'any' type. Try `npm install @types/mocha` if it exists or add a new declaration (.d.ts) file containing `declare module 'mocha/lib/reporters/base';`ts(7016)
Javier Pons
@JavierPons
@craigtaub Im running an api test with Mocha Chai. at the same time I have Front page done with React. Is it possible to show/run the test, done in the api( that shows in terminal), in the Front Page (React)? I don't want to test React components, that it is what Enzyme is for.
Craig Taub
@craigtaub
@JavierPons are you talking about automated testing on a real browser? i.e. karma/selenium/cypress?
@saiyeek could u supply the code for your reporter pls?
Javier Pons
@JavierPons
@craigtaub thanks for the help
menendezau
@menendezau
Hey guys! Could anyone point me to a getting started guide where I can get to know how to setup testing for browser-based javascript, but to be run locally (nodejs)?
^ Complications come when browser-side code is required to do an exports.something which is not browser-compatible
Craig Taub
@craigtaub
@menendezau we have a working example of Karma here (https://github.com/mochajs/mocha-examples/tree/master/karma). Run on Nodejs but testing browser app.
We also have a Selenium example there.
Hope that helps
KiT
@KiT-Maverik
Hey guys
Does anybody know, is it possible to assign custom statuses to tests?
For instance, I wanna conditionally fail test, and that failed test should receive "onditionally failed" status.
Craig Taub
@craigtaub
@KiT-Maverik does this entry in the Wiki on conditionally failing help https://github.com/mochajs/mocha/wiki/HOW-TO:-Conditionally-fail-a-test-after-completion ?
KiT
@KiT-Maverik
@craigtaub no. this is about conditionally failing tests. And I want to conditionally set STATUS of failed tests.
I have custom functional in my framework. It fails all tests in set if hook is broken. Currently all those tests come with "failed" status. So, i'm wondering, is it possible to force change their status to "unknown"/"cancelled" or smth like this
philicia
@tirzahtoh_twitter
sorry, I got it
Adiel Hercules
@adielhercules
Hello! I'm pretty sure not the first to ask about this, but I wanted to know if someone can help me out with this, I have my specs written in es6 but mocha is still not working, I was using v6 of babel but I had to upgrade to v7 and then the issue started, my command is: "mocha --require @babel/register --require @babel/polyfill "./spec/*/.spec.js*" --recursive"
Craig Taub
@craigtaub
@adielhercules are you missing a star before .spec i.e. "./spec/*/*.spec.js*"? I just tried this and worked ok.
We have a live example with mocha v6 + babel v7 here https://github.com/mochajs/mocha-examples/tree/master/babel.
if no luck what are you seeing, an error? no specs run? etc.
Adiel Hercules
@adielhercules
@craigtaub it is very weird but I got it working after I changed the command to just mocha and put all the config of the requires and pattern into a mocha yaml config file. I still dont get why but at least it is working now! Thanks for the help, I based my config from that example.
Craig Taub
@craigtaub
great :)
apert
@apert4160
hello guys , i was wondering domocha enable to comply "list tests without actually executing them" , like a --collect-only option in pytest.Thank you
Craig Taub
@craigtaub
@apert4160 AFAIK that does not exist in mocha, you could write a custom reporter (i.e. https://github.com/mochajs/mocha/wiki/Third-party-reporters) to just print the test name without result, but it would still execute them under-the-hood.
apert
@apert4160
Thanks for your reply
Automation125
@Automation125
hello guys, is there any way to define all hooks/listeners in another file and attach to config file in mocha , which i can do in jasmine
I am using wdio with mocha
Craig Taub
@craigtaub
@Automation125 i believe you can set all hooks inside a file and call it with —file. Example here https://github.com/mochajs/mocha-examples/tree/master/async-setup-with-file
Automation125
@Automation125
@craigtaub is it even possible for wdio, becoz it's not working for me
kiranmai1202
@kiranmai1202
if there is an array[] having elemens as {10.2, 20.5,80.9}
how can we get sum of the array elements which is 10.2+20.5+80.9
ramukarnati
@ramukarnati
hello
if execution is sent to some util function from IT block which handles some common actions -- is there way to handle promises in the util function without being "return" ?
Sampson Crowley
@SampsonCrowley
I'm having issues with the spec report showing tests under the wrong describe block. Anyone have ideas?
CalendarElement (<calendar-element></calendar-element>)
    Attributes
      .labelFormat
        ✔ is EEEE by defaultis is bound to the `label-format` attribute
        when a valid format is entered
          ✔ is reset back to default
        when an invalid format is entered
          ✔ is reset back to default
          ✔ Logs a RangeError
      .headerStyle
        ✔ is an empty string by defaultis is bound to the `header-style` attribute
        ✔ is cooerced to an unvalidated stringis rendered in the section header
      .headerFormat
        ✔ is MMMM yyyy by defaultis is bound to the `header-format` attribute
        when a valid format is entered
          ✔ is reset back to default
        when an invalid format is entered
          ✔ is reset back to default
          ✔ Logs a RangeError
    Events
      date-change
        ✔ is fired when .selectedDate changes
        Properties
          .bubbles
            ✔ is true
          .composed
            ✔ is true
          .cancelable
            ✔ is true
          .detail
            ✔ is an object
            Properties
              value
                when .selectedDate is setis a String
                  ✔ is the current .selectedDate in ISO 8601 format (yyyy-MM-dd)
                when .selectedDate is unset
                  ✔ is null
              date
                when .selectedDate is setis a Date
                  ✔ is the current .selectedDate
                when .selectedDate is unset
                  ✔ is null
// EVERYTHING BELOW IS ACTUALLY IN THE `Attributes` BLOCK
      .selectedDate
        ✔ is empty by defaultis is bound to the `selected-date` attribute
        ✔ is set by clicking a date cell
        when an invalid date is entered
          ✔ sets the value to NULL
          ✔ Logs the invalid date as an Error
      .dayFormat
        ✔ is d by defaultis is bound to the `day-format` attribute
        when a valid format is entered
          ✔ is reset back to default
        when an invalid format is entered
          ✔ is reset back to default
          ✔ Logs a RangeError
Craig Taub
@craigtaub
@ramukarnati using a callback is only other way (i.e. done)
Craig Taub
@craigtaub
@kiranmai1202 not sure thats mocha-related question. try array.reduce((acc, curr) => acc + curr))
Mike Chen
@mike442144
Hey, where can I checkout the break API changes from version 2 to latest?
Paweł Kiełb
@Gieted
This problem is caused by mocha, when I run code directly it works as expected
My .mocharc.json:
{ "require": ["@babel/register", "core-js/stable", "regenerator-runtime/runtime"] }
Another thing is when I change import axios from 'axios' to const axios = require('axios'), it's also working (axios isn't undefined at function execution)
c0ncentus
@c0ncentus
Hello :)
someone have idea with "--reporter-option" command line ? the doc say "reporterOption" ? -_-'' I want to put output on specific folder : /
c0ncentus
@c0ncentus
nevermind : /
Craig Taub
@craigtaub
@Gieted your example works fine for me. Perhaps try with our working babel example here https://github.com/mochajs/mocha-examples/tree/master/babel. Update the config and index and try it. Be sure to install core-js + axios.
GURU KIRAN
@AutomationGuru
Hello is there anyways i can retry the complete test suite including the before hooks ?
Craig Taub
@craigtaub
@AutomationGuru see https://mochajs.org/#retry-tests for help there. Unfortunately does not include before hook. Perhaps try —retries flag.
GURU KIRAN
@AutomationGuru
:+1: @craigtaub
pratikt1988
@pratikt1988

I've a test where:
1st process time completion time : 2019-12-08 00:00:10.000
2nd process time completion time : 2019-12-08 00:00:20.000

I've to validate if the timestamp b/w two process should be close with each other or in between? is there any way i can acheive this?

Tural Sadık
@tsadigov
for typescript or any transcompiled language, if there is a js version of the file does mocha use the existing file or does it transcompile any way?
Craig Taub
@craigtaub
@tsadigov not sure i follow, but we have an example Typescript setup https://github.com/mochajs/mocha-examples/tree/master/typescriptl have a look and see if that answers your question.
Tural Sadık
@tsadigov
thanks a lot @craigtaub . I change my moduleloader in tsconfig using AMD for using in browser and common for running node/mocha tests. Noticed that if I have my AMD/compiled js files in the directory mocha does not use transcompiler and tries to use those files with error ReferenceError: define is not defined.
When I delete generated files and npm test it runs ok
it kind of makes sense to load the file if it already exists to save computing/time. But I want to disable this. By the after successful test execution there are no transcompiled files in the directory, so probably everything is done in memory.