Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 08:26

    juergba on next

    (compare)

  • 08:24

    juergba on suppress-deprecation-for-coffeescript

    (compare)

  • 08:21

    juergba on 2352

    (compare)

  • 08:20

    juergba on 2383

    (compare)

  • Aug 23 08:33
    geigerzaehler synchronize #3980
  • Aug 23 07:18

    Munter on check-doc-links

    (compare)

  • Aug 23 00:45
    zhuguocheng29 edited #3998
  • Aug 22 17:36
    geigerzaehler synchronize #3980
  • Aug 22 17:14

    Munter on master

    Add link checking to docs build… (compare)

  • Aug 22 17:14
    Munter closed #3972
  • Aug 22 14:57
    Munter synchronize #3972
  • Aug 22 14:57

    Munter on check-doc-links

    Make hyperlink skipfilter argum… (compare)

  • Aug 22 02:26
    gwh-cpnet closed #3997
  • Aug 22 00:46
    zhuguocheng29 labeled #3998
  • Aug 22 00:46
    zhuguocheng29 opened #3998
  • Aug 22 00:17
    gwh-cpnet edited #3997
  • Aug 21 22:27
    New Donation: Matter gave USD 2 to MochaJS! [Thank that person on Twitter]
  • Aug 21 12:06
    gwh-cpnet edited #3997
  • Aug 21 10:13
    gwh-cpnet labeled #3997
  • Aug 21 10:13
    gwh-cpnet opened #3997
KiT-Maverik
@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-Maverik
@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.
Tural Sadık
@tsadigov
Yesterday I solved my problem
It was because of the ts-node I am using
if there is a js file with the same name as ts file, ts-node assumes that it is ready for usage and does not transcompile using existing file. I could not find an option in ts-node to override this and I modified ts-node to match my need.
philicia
@tirzahtoh_twitter
Hi I have 2 test.spec.js tc1.spec.js and tc2.spec.js, then I do npm test, it only run tc1.spec.js not tc2.spec.js, how to make mocha run all the spec.js file? in my package.json, I have this "scripts": {
"test": "mocha --reporter mocha-teamcity-reporter $(find test -name '*.spec.js')"
}
Craig Taub
@craigtaub
@tirzahtoh_twitter try mocha --reporter mocha-teamcity-reporter *.spec.js.
Anders Moberg
@AndersMoberg

Should I be able to pass along Promises to Mocha and have the fulfillment / rejection of said Promise be used as the result for the it? Because the below testing is appearntly succeeding, whilst giving me UnhandledPromiseRejectionWarning in Node.. My presumption is that a rejection of a Promise should be a failing test.

it("should fail", function () { return Promise.reject(); })

Craig Taub
@craigtaub
tried on node v12.2 + mocha v6 and 1 failing
Anders Moberg
@AndersMoberg
@craigtaub I'm on node 10 with mocha v7 and that is failing (as in, test succeeds, Node assertion) for me.. I guess our Babel setup might be a bit busted.
Craig Taub
@craigtaub
@AndersMoberg to check with a working babel example pull https://github.com/mochajs/mocha-examples/tree/master/babel and add your test.
KiT-Maverik
@KiT-Maverik

Hey guys!
In Chrome 76 they disabled 'disable-infobars' flag.
I found and replacement for this,

https://cloud.google.com/docs/chrome-enterprise/policies/?policy=CommandLineFlagSecurityWarningsEnabled

...but can't get how can I pass this in chrome args. Can anybody advise?