I have several mocha & chakram test case files, located on current directory:
test1.js
test2.js
test3.js
..and so on
I want to run a mocha test sequentially and generate a JSON reports for every test case.
What I want
Test1.json (result of test1.js)
Test2.json (result of test2.js)
Test3.json (result of test3.js)
..and so on
What I have tried
Create a batch file which contains:
mocha test1.js --reporter json > Test1.json mocha test2.js --reporter json > Test2.json mocha test3.js --reporter json > Test3.json
When I run it, it runs only the first line
Modified the batch file to be only one line
mocha test1.js --reporter json > Test1.json test2.js --reporter json > Test2.json test3.js --reporter json > Test3.json
This generates only one file 'Test3'.json. or
mocha "./testfolder/*.js" --reporter json > Test.json
This generates only one file.
Using mocha --recursive
mocha --recursive *.js --reporter > test1.json
It goes to all subfolders. Even if this works, it will only generate one file. Reorganizing the folders is probably not an option.
I have tried using mochawesome too.However, in this case, I want JSON file as the result / reporter.
How can I achieve this?