A lovely javascript testing framework -- want to contribute? join us in https://gitter.im/mochajs/contributors
juergba on karma
type check before calling retri… (compare)
{
"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"]
}
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 }]]}
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)
ENV=test nyc mocha --recursive --require ./test/global.js --timeout 1000000 --exit
test/cases/business
.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?
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.
8.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)
beforeAll
property, not a before
one.
--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.