jrainey
jrainey

Reputation: 19

newman, postman's cli runner, can not find a custom reporter

When I run newman with a custom reporter it can not find it, and the error states the reporter should be installed in the newman directory. I am on windows 10. It is named newman-reporter-csvconsole. Where is the newman default directory, to look for reporters?

the reporter package index.js

function csvconsole (emitter, reporterOptions, collectionRunOptions) {
emitter.on('start',function (err, args) 
{ // on start of run, log to console
    console.log('running a collection...');
});

} module.exports = csvconsole;

I then install a local package

C:\Users<user>\AppData\Roaming\npm\node_modules\newman\newman-reporter-csvconsole>npm init -w newman-reporter-csvconsole -S

C:\Users<user>\AppData\Roaming\npm\node_modules\newman\newman-reporter-csvconsole>npm pack

C:\Users<user>\AppData\Roaming\npm\node_modules\newman>npm install -S ./csvconsoleReporter/newman-reporter-csvconsole-1.0.0.tgz

The package and pack-lock files

C:\Users<user>\AppData\Roaming\npm\node_modules\newman\package.json

"dependencies": { ... "newman-reporter-csvconsole": "file:newman-reporter-csvconsole", ...

C:\Users<user>\AppData\Roaming\npm\node_modules\newman\package-lock.json

"dependencies": { ... "newman-reporter-csvconsole": "file:newman-reporter-csvconsole", ...

"newman-reporter-csvconsole": {
  "version": "1.0.0",
  "license": "ISC"
},

... "node_modules/newman-reporter-csvconsole": { "resolved": "newman-reporter-csvconsole", "link": true },
... "newman-reporter-csvconsole": { "version": "file:newman-reporter-csvconsole" },

Upvotes: 0

Views: 621

Answers (1)

jrainey
jrainey

Reputation: 19

module.exports = function csvconsole (emitter, reporterOptions, collectionRunOptions) 
{
  // emitter is is an event emitter that triggers the following events: https://github.com/postmanlabs/newman#newmanrunevents
  // reporterOptions is an object of the reporter specific options. See usage examples below for more details.
  // collectionRunOptions is an object of all the collection run options:
  // https://github.com/postmanlabs/newman#newmanrunoptions-object--callback-function--run-eventemitter
  
  emitter.on('start',function (err, args) 
  { // on start of run, log to console
    console.log('running a collection...');
  });
}

Upvotes: 0

Related Questions