Comments (14)
What do you have so far? What isn't working?
from mocha-multi.
Currently i am using the below code,
var config = {
mochaTest: {}
};
config.mochaTest[name] = {
options: {
reporter: 'mocha-allure-reporter',
reporterOptions: {
targetDir: allureReportFolderName
},
timeout: 60000,
logErrors: true,
captureFile: directories.target + '/' + name + '/test-results.txt'
},
src: grunt.option("mochatestspecs").split(",")
};
from mocha-multi.
You should be able to use something like this https://github.com/glenjamin/mocha-multi#using-mocha-multi-programmatically
reporter: "mocha-multi",
reporterOptions: {
"mocha-allure-reporter": {
options: { "targetDir": allureReportFolderName }
}
"xml": {
// ...
}
}
from mocha-multi.
how to use other reporter, example i need BOTH allure reporter and tap reporter:
reporter: "mocha-multi",
reporterOptions: {
"mocha-allure-reporter": {
options: { "targetDir": allureReportFolderName }
}
"tap": {
// ...
}
"nyan" :{
// ..
}
}
from mocha-multi.
that example looks right to me, each key in the reporterOptions names another reporter to use.
from mocha-multi.
Error :
Running "mochaTest:endtoend" (mochaTest) task
Mocha exploded!
TypeError: path must be a string
at TypeError (native)
at Object.fs.openSync (fs.js:584:18)****
from mocha-multi.
Sounds like you need to pass a filename to one of your reporters using its reporter options - as it doesn't write to stdout the file handling code from this lib won't affect its destination.
from mocha-multi.
can you explain ?
This is my Grunt file:
module.exports = function webdriverTestSuite(name, grunt, directories) {
'use-strict';
require('grunt-mocha-test/tasks/mocha-test')(grunt);
process.env.BROWSER = grunt.option("browser") || "phantomjs";
process.env.ENVIRONMENT = grunt.option("environment") || "dev1";
process.env.PLATFORM = grunt.option("platform") || "desktop"
process.env.RESULTSDIRSUFFIX = grunt.option("resultsdirsuffix") || "gird";
var tasks = process.env.ENVIRONMENT === "local-unknown" ? ["copy:dist", "build:app-config", "connect:dist"] : ["mochaTest:" + name];
var d = new Date();
var allureReportFolderName = 'allure-results' + grunt.option("resultsdirsuffix");
var config = {
mochaTest: {}
};
config.mochaTest[name] = {
options: {
reporter: 'mocha-multi',
reporterOptions: {
"mocha-allure-reporter": {
options: { "targetDir": allureReportFolderName }
}
},
timeout: 60000,
logErrors: true,
captureFile: directories.target + '/' + name + '/test-results.txt'
},
src: grunt.option("mochatestspecs").split(",")
};
console.log("mocha grep config=" + config.mochaTest[name]['options']['grep']);
grunt.event.once("connect.dist.listening", function() {
grunt.task.run("mochaTest:" + name);
});
grunt.registerTask('test:' + name, 'runs the ' + name + ' selenium tests', tasks);
grunt.config.merge(config);
}
from mocha-multi.
I can see nothing obviously wrong with that, although it looks like you're only actually doing one output format, so mocha-multi
isn't really doing anything useful for you there.
Is that stack trace you provided the full one? it would be helpful to know exactly what was passed to that openSync
call which failed.
from mocha-multi.
Running "mochaTest:endtoend" (mochaTest) task
>> Mocha exploded!
>> TypeError: path must be a string
>> at TypeError (native)
>> at Object.fs.openSync (fs.js:584:18)
>> at Object.fs.writeFileSync (fs.js:1224:33)
>> at resolveStream (/../node_modules/mocha-multi/mocha-multi.js:162:6)
>> at /../node_modules/mocha-multi/mocha-multi.js:91:18
>> at Array.map (native)
>> at initReportersAndStreams (/../node_modules/mocha-multi/mocha-multi.js:86:16)
>> at new MochaMulti (/../node_modules/mocha-multi/mocha-multi.js:42:17)
>> at MochaWrapper.run (/../node_modules/grunt-mocha-test/tasks/lib/MochaWrapper.js:56:27)
>> at /../node_modules/grunt-mocha-test/tasks/mocha-test.js:86:20
Warning: Task "mochaTest:endtoend" failed. Use --force to continue.
Aborted due to warnings.
Generating Allure Report at location './allure-reports'...
allure generate allure-results-firefox/
cp: allure-results-firefox: No such file or directory
ERROR: Report directory <allure-results-firefox/> is missing.
./runtestsuite: line 9: /../allure-commandline/bin/allure.bat: No such file or directory
from mocha-multi.
Ah ok, you have to specify a target for the reporter being passed to multi
, even though allure
won't use it:
Try this
"mocha-allure-reporter": {
stdout: "-",
options: { "targetDir": allureReportFolderName }
}
from mocha-multi.
@glenjamin Like a Boss 👏 👏 👏
from mocha-multi.
Hey quick info :
"mocha-allure-reporter": {
stdout: "-",
options: { "targetDir": allureReportFolderName }
}
targetDir is not working,
the reports is generated in one particular location: it dont care about the path we are providing ;allureReportFolderName;
from mocha-multi.
That looks like a bug in mocha-allure-reporter
, I think this line https://github.com/allure-framework/mocha-allure-reporter/blob/master/index.js#L18 should just be opts
.
You can work around it for now by doing:
"mocha-allure-reporter": {
stdout: "-",
options: {
reporterOptions: {
"targetDir": allureReportFolderName
}
}
}
from mocha-multi.
Related Issues (20)
- make process.exit hack tidier HOT 3
- release 0.12.0 HOT 9
- Deprecated dependencies HOT 3
- have another go at upstreaming into mocha
- peer dep missing HOT 3
- Release v1.0.1 to npm HOT 3
- Only one report (doc) generated instead of 3 HOT 3
- mocha 6 support: process never ends (grunt) HOT 2
- mocha-junit-reporter programatically
- Versions differ on npm and github HOT 3
- Releases that tell the news HOT 4
- Can't view test output in file and console output together using mocha and mocha-multi HOT 1
- Cannot read property 'tests' of undefined Error when using mocha-multi
- Latest patch 1.1.1 introduces a breaking change and runtime error when running mocha tests HOT 19
- Support relative path as a reporter name HOT 2
- Latest version of mocha-v7.0.0 seems to be breaking mocha-multi HOT 2
- npm ERR! peer dep missing: mocha@>=2.2.0 <7.0.0, required by [email protected] HOT 6
- Patch 1.1.4 update seems to be breaking mocha dependency HOT 8
- Update version of mkdirp HOT 4
- Cannot resolved peer dep for mocha 10 , npm Err mocha@">=2.2.0 <7 || ^9" from [email protected] HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mocha-multi.