Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 24 2020 17:07
    nicojs synchronize #4234
  • Apr 24 2020 16:55
    juergba unlabeled #4251
  • Apr 24 2020 15:47
    Daniel0113 edited #4219
  • Apr 24 2020 15:45
    Daniel0113 edited #4219
  • Apr 24 2020 15:11
    Daniel0113 synchronize #4219
  • Apr 24 2020 14:01
    juergba labeled #4227
  • Apr 24 2020 14:01
    juergba unlabeled #4227
  • Apr 24 2020 14:01
    juergba unlabeled #4227
  • Apr 24 2020 13:58
    juergba edited #4251
  • Apr 24 2020 13:33
    juergba labeled #4251
  • Apr 24 2020 12:52
    juergba milestoned #4251
  • Apr 24 2020 12:52
    juergba labeled #4251
  • Apr 24 2020 12:52
    juergba labeled #4251
  • Apr 24 2020 12:52
    juergba labeled #4251
  • Apr 24 2020 12:51
    juergba assigned #4251
  • Apr 24 2020 12:51
    juergba review_requested #4251
  • Apr 24 2020 12:51
    juergba opened #4251
  • Apr 24 2020 12:37

    juergba on karma

    type check before calling retri… (compare)

  • Apr 24 2020 06:26
    juergba labeled #4250
  • Apr 24 2020 06:26
    juergba labeled #4250
Dmytro Kuznetsov
@dkuznetsov21
image.png
Juerg B.
@juergba
@dkuznetsov21 you can try global-fixtures.
Dmytro Kuznetsov
@dkuznetsov21
thank u
Arjun Biju
@Arrow66
hi all
i am trying to do test using mocha on create react app with craco and antd
throwing this error You are using a whole package of antd, please use https://www.npmjs.com/package/babel-plugin-import to reduce app bundle size.
my configuration is -
{ "diff": true, "extension": ["js"], "package": "./package.json", "reporter": "mocha-sonarqube-reporter", "reporter-option":["output=xunit.xml"], "slow": 75, "timeout": 2000, "spec": ["src/**/*.test.js"], "ui": "bdd", "watch-files": ["src/**/*.test.js"], "watch-ignore": ["lib/vendor","node_modules/*"], "recursive":true, "color":true, "require":["jsdom-global/register","@babel/register","ignore-styles"] }
already added plugins to babel.config.js
module.exports = {presets: ["@babel/preset-react"],plugins:[ ["module-resolver", { "root": ["./src"], "alias": { "test-utils":"./src/utils/testutils/index.js" } }],["@babel/plugin-transform-modules-commonjs"],["import", { "libraryName": "antd", "style": true }]]}
Arjun Biju
@Arrow66
i dont know where did i go wrong ?
someone help
Dmytro Kuznetsov
@dkuznetsov21
hey
How to find a state about a test?
const state = this.currentTest.state; doesn't works in the new mocha (
Dmytro Kuznetsov
@dkuznetsov21
            const title = this.test.ctx.currentTest.title;
            const state = this.test.ctx.currentTest.state;
ganesh-kashid
@ganesh-kashid

I am facing below issue post executing "mocha tests/_suite.js". Any help would be greatly appreciated. Not much help available over google.

Sample task tests
Downloading file: https://nodejs.org/dist/v10.21.0/win-x64/node.exe
1) should succeed with simple inputs
Downloading file: https://nodejs.org/dist/v10.21.0/win-x64/node.exe
2) it should fail if tool returns 1

0 passing (2m)
2 failing

1) Sample task tests
should succeed with simple inputs:
Error: connect ETIMEDOUT 104.20.22.46:443
at extractValue (node_modules\sync-rpc\lib\index.js:165:19)
at D:\Office Work\Tasks\CreateAzurePipelineTask\BizTalkDeploymentReleaseTask\node_modules\sync-rpc\lib\index.js:175:12
at Function.request [as default] (node_modules\sync-request\lib\index.js:28:15)
at MockTestRunner.downloadFile (node_modules\azure-pipelines-task-lib\mock-test.js:240:44)
at MockTestRunner.downloadNode (node_modules\azure-pipelines-task-lib\mock-test.js:220:22)
at MockTestRunner.getNodePath (node_modules\azure-pipelines-task-lib\mock-test.js:151:25)
at new MockTestRunner (node_modules\azure-pipelines-task-lib\mock-test.js:29:30)

Dani
@butterywombat
Hi all, I am running all my test suites with parallel and it seems like there are race conditions involved (one test suite affecting the other)- my understanding was in parallel each test suite is run in a separate child process then terminates. Is that the case? I guess I have to assume otherwise and the worker pool is doing something else, didn't have time to fully understand
Tal
@t1a2l
Hey all, for some reason mocha is looking in the wrong folder
mocha is looking for a file inside the workspaceFolder, but i want it to look at workspaceFolder/server
Dmytro Kuznetsov
@dkuznetsov21
How to stop "describe" and go to the next spec if one "it" goes failed?
Eckersleyful
@Eckersleyful
How can I get my failed tests to not exit with code 1? I want to see my coverage through coveralls but if any failed test crashes the whole build, there is no point.
not sure is it babel issue or mocha issue?
Dan Čermák
@dcermak
Anyone knows if custom timeouts are not honored in hooks in mocha?
Jonas Amundsen
@badeball
With mocha.optsI could configure a default pattern where mocha would look for files. Is there a similar, non-deprecated alternative to that?
Jonas Amundsen
@badeball
@Munter, aha, thanks a lot!
Anders Langballe Jakobsen
@anderslangballe
Is it possible to run tests within a single file in parallel?
@anderslangballe no
aurdevv
@aurdevv
Just curious, does Mocha searches for '.mocharc' too?
Without .yml or .js
Valentin Mikhailov
@m1khaylov
Hello everyone! Please advise how to test different path? For example: it('it should GET all courts', function (done) {
chai.request(server)
.get('/courts')
.end((err, res) => {
console.log('GET ALL COURTS:', res.body);
res.should.have.status(200);
});
});
it('it should GET all courts', function (done) {
chai.request(server)
.get('/teams')
.end((err, res) => {
console.log('GET ALL COURTS:', res.body);
res.should.have.status(200);
res.body.should.be.a('object');
}); });
dhuang612
@dhuang612
don't you need to use something like supertest?
https://rahmanfadhil.com/test-express-with-supertest/
Urigee
@another_malcolm_twitter
Hey! Does anyone know if there any reporter that produces JUnit XML with mocha --parallel? Seems like all JUnit reporters I could find are not supporting parallel run yet.
Alex Graveley
@orph
Hi there, I'm trying to use mocha from a webpack bundle. Wondering how to do that? The webpack mocha-loader seems deprecated? But more importantly I can't figure out how to add tests without adding individual files!
alellison
@alellison
Hello, I'm trying to run a suite of mocha tests in a jenkins pipeline. I have gotten the tests to run, but it fails the entire pipeline if any tests fail. It doesn't send slack notifications to notify anyone of the failure or complete any post build steps.. it just bombs entirely. Does anyone have any advice on how to get this to work and if anyone is using mocha in a Jenkins pipeline, what are you using for reporting? I still want the build to fail, but I need it to notify us in slack when it fails.
Bruno Cechet
@brunocechet
Hey guys, where I can find the docs for the version 6 ?
Kirill Korchagin
@Whytecrowe
hey guys! can anyone help? I have a script for mocha that worked and supposed to, but it fails in CI. Does anybody what that could be?
This is the original script ENV=test nyc mocha --recursive --require ./test/global.js --timeout 1000000 --exit
the other script calls the original through yarn and then adds test/cases/business.
I have two other scripts exactlky like this and they work, but one fails in CI (works locally)
Andrej Leitner
@andrejleitner
Hey folks, I'm trying to use root level hooks for some async initialization. I defined it in separate file using module.exports.mochaHooks = async function () { ...}. Then in .mocharc.js I placed that file under require list. However I'm getting the error on mocha start: ✖ ERROR: ReferenceError: before is not defined. What's wrong with that?
Juerg B.
@juergba
@andrejleitner I think the root hook should be beforeAll, not before.
alisman
@alisman
I have the following problem with Mocha. If a beforeEach hook fails in a describe block, it only reports failure of first test. This throws off the final count of errors. I would expect it to report errors for each of the tests within that block (even if it doesn't actually execute subsequent tests).
Juerg B.
@juergba
@alisman yes, Mocha's hook pattern is as described by you. There are already some open issues about that topic, but without any activity.
alisman
@alisman
Thanks Juerg. I'm hoping there might be away to listen to some suite fail event and then monkey with state. But I'm not finding anything in documentation. Do you think it's feasible? Any hints would be much appreciated. Or if it's not possible, that would save me a lot of time to hear.
Juerg B.
@juergba
@alisman you could listen for the suite end event and then check for the test's state. In the event object there must be an array containing all suite's tests . Mochawesome is doing something similar, I think. You find all the available events and states in lib/runner.js. As long as you don't use skip and grep function, it may work that way. A suite does not fail, it just starts and ends.
Andrej Leitner
@andrejleitner
@juergba I’m getting the same with beforeAll.
Juerg B.
@juergba
@andrejleitner which Mocha version do you use?
Does it work, when you --require via CLI (not in mocharc.js)?
Andrej Leitner
@andrejleitner
v8.1.3 and it's the same with --require test/mocha.hooks defined in package.json test command. I forgot to mention my project is in typescript. Btw, before and beforeEach works fine under describe-s in all my test suites. Here is the full error:
ERROR: ReferenceError: before is not defined
    at exports.mochaHooks (~/myproj/test/mocha.hooks.ts:55:3)
    at ~/myproj/node_modules/mocha/lib/cli/run-helpers.js:125:65
    at Array.map (<anonymous>)
    at exports.loadRootHooks (~/myproj/node_modules/mocha/lib/cli/run-helpers.js:125:15)
    at ~/myproj/node_modules/mocha/lib/cli/run.js:347:34
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
Juerg B.
@juergba
@andrejleitner please cross-check your function with our docs-example.
You have to return an object with a beforeAll property, not a before one.
Andrej Leitner
@andrejleitner
Thanks @juergba, I defined mochaHooks as function but didn't return my hooks definition packed in an object. Now it just works.
Mario Gersbach
@mger
Hey guys! I have a somewhat large test suite (~110 tests) which I am running in parallel using the --parallel option. Unfortunately, the number of tests which are executed across runs varies, and only rarely are all tests executed. For the tests that aren't executed, using my logs, I see that execution stops in the beforeAll root hook. However, it stops without an error and there is no indication that anything in the code went wrong (no errors/exceptions logged). It's obviously hard to tell without having seen the code, but any idea what this could be due to, or which avenues I should look into for debugging? It is always the tests of the test files with the lexicographically greatest file name that aren't executed in a run of the suite. It's been really puzzling me.