Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 08:14
    juergba synchronize #4070
  • 08:14

    juergba on mocha-browser

    browser setup functions adapt existing test additional tests (compare)

  • Oct 20 08:20
    juergba edited #4070
  • Oct 20 08:01
    juergba synchronize #4070
  • Oct 20 08:01

    juergba on mocha-browser

    browser setup functions adapt existing test (compare)

  • Oct 19 23:01
    wnghdcjfe synchronize #4069
  • Oct 19 22:59
    wnghdcjfe synchronize #4069
  • Oct 19 22:58
    wnghdcjfe synchronize #4069
  • Oct 19 22:56
    wnghdcjfe synchronize #4069
  • Oct 19 22:37
    wnghdcjfe edited #4069
  • Oct 19 17:04
    craigtaub milestoned #4077
  • Oct 19 17:04

    craigtaub on master

    2595 Changed runMocha to runMoc… (compare)

  • Oct 19 17:04
    craigtaub closed #4077
  • Oct 19 17:02
    craigtaub labeled #4077
  • Oct 19 17:01
    craigtaub labeled #4077
  • Oct 19 12:42
    HyunSangHan edited #4076
  • Oct 19 12:42
    HyunSangHan edited #4076
  • Oct 19 11:00
    soobing edited #4077
  • Oct 19 10:33
    wnghdcjfe synchronize #4069
  • Oct 19 10:32
    wnghdcjfe edited #4069
Javier Pons
@JavierPons
@Munter I want to access to the data that I get in terminal. I need info from that after running a test. I want to manipulate/use that info.
Mansi Jain
@supermansi
What could be the reason my mocha tests pass when individual files are run but fail when run concurrently?
dhuang612
@dhuang612
@supermansi could you provide more information there could be a ton of reasons for that.
Which tests are failing when you run them together?
Peter Müller
@Munter
@supermansi sounds like accidental shared state across tests
raghanag
@raghanag
HI All
Can you let me know how to write unit tests for typescript classes
NGUYEN Chi Thanh
@ctnguyen
Hi all
can we specify modules path dynamically with mocha?
I have a test.js, and a required module in /my/module/directory/mymodule.js
how would I run test.js with import of mymodule.js? knowing that the directory would change, so I'll need to specify the directory in mocha comnand line
is that possible to do so? something like "mocha --module-path=/my/module/directory test.js"
Peter Müller
@Munter
@ctnguyen why does a normal node require not work for you?
@nriesco you set up typescript compiling yourself, then you make you're tests like you normally would in mocha
NGUYEN Chi Thanh
@ctnguyen
@Munter because mine is not a standalone javascript project. I build js from webassembley, those js file are built and stored in the build directory. The test.js are stored in the source code directory. I need a way to tell test.js where to find my compiled asm.js
Peter Müller
@Munter
@ctnguyen so you can't just require your build artefact?
NGUYEN Chi Thanh
@ctnguyen
@Munter I guess I'll need to give the path to tell mocha where it is?
Peter Müller
@Munter
@ctnguyen No. You require in your build artifact, which is hopefully a node compatible module. Just do that in your test, just like when you test any other module
NGUYEN Chi Thanh
@ctnguyen
oh thanks @Munter . I'll try it now
Vishal Biradar
@vishalbiradar
What is the formula, used by mocha to calculate the code coverage
?
Peter Müller
@Munter
Mocha doesn't calculate code coverage
Vishal Biradar
@vishalbiradar
we use nyc along with mocha to generate the code coverage report
Peter Müller
@Munter
If I've understood nyc correctly, it processes your source code to inject new lines for each statement, which increment some counters. Then if looks at the counters for each line of each file to check coverage. I'm not sure how it handles single line logic branches, like longer boolean expressions etc
Mocha has nothing to do with this. It just runs the javascript provided by nyc
Vishal Biradar
@vishalbiradar
OK
Thanks
Suresh Salloju
@sallojusuresh
Is "async-only" mocha command modified to "asyncOnly"?
Craig Taub
@craigtaub
former for cli usage, latter for use in config
Suresh Salloju
@sallojusuresh
we have created mocha.opt file with --async-only command
it was working fine
but in recentime getting failures at before all hooks

"before all" hook
Error: Timeout of 120000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (C:\git\vista\ui\UI_Framework_Hyd\test\specFile\assign_and_unassign_policy_from_group_spec.js)
Peter Müller
@Munter
I recommend switching to the json configuration if you can
Suresh Salloju
@sallojusuresh
any help to resolve above issue
?
This iw my mocha.opt file:
--async-only
-R mochawesome --reporter-options reportFilename=report
--timeout 120000
any help?
Craig Taub
@craigtaub
we recommend you move to json config (example https://github.com/mochajs/mocha/blob/master/example/config/.mocharc.json). mocha.opts is considered legacy and removed in future versions (so worth updating to new config when you can).
Suresh Salloju
@sallojusuresh
ok
Craig Taub
@craigtaub
if persists pls post before all hook code. error suggests not running async code correctly
Suresh Salloju
@sallojusuresh
before(async function () {
await browserSetup.createBrowser(properties["browserName"]);
});
async createBrowser(browsername = "chrome") {
global.browser = webdriverio.remote({
desiredCapabilities: {
browserName: browsername,
acceptSslCerts: true
},
logLevel: 'verbose',
logOutput: './logs'
});
await browser.init();
await browser.windowHandleMaximize();
}
we are just calling createBrowser in before() method
Craig Taub
@craigtaub
hmm looks ok, possible webdriver issue?
try replacing webdriver parts with basic async to confirm e.g
const createBrowser = async () => Promise.resolve();,
and see if same issue.
Suresh Salloju
@sallojusuresh
@craigtaub thank you
i will try
Vishal Biradar
@vishalbiradar
@Munter yes, I got it. how nyc framework is calculating the code coverage percentage.
Mason Rhodes
@solaris765

I'm having an issue where mocha --watch is only loading changes to the actual *.test.js files in my test folder, but not the supporting files in my src. After searching a bit I'm lead to believe this is due to require caching my src. Is this expected behaviour? And how do I best work around it / the correct way to watch files.

Thanks

Juerg B.
@juergba
@solaris765 we have refactored our --watch feature just a few days ago. It will be published with release v7 (no date available) or you can download our master branch to use it. With a new option --watch-files you determine the files to be watched.