DannyDainton / newman-reporter-htmlextra

A HTML reporter for Postman's Command Line Runner, Newman. Includes Non Aggregated Runs broken down by Iterations, Skipped Tests, Console Logs and the handlebars helpers module for better custom templates.
Apache License 2.0
357 stars 139 forks source link

while executing Newman as Library, getting error #244

Closed svarshney2311 closed 4 years ago

svarshney2311 commented 4 years ago

Hi,

I am trying to execute below Node library, but getting error.

const newman = require('newman')

Below is my app.js:

newman.run({ collection: './Digital_API.postman_collection.json', IterationData : '/TestData_SIT.json', IterationCount : 1, d: '/TestData_SIT.json', reporters: 'htmlextra', reporter: { htmlextra: { template: '/Report.hbs', export:'Desktop/SmokeReport.html'

} } })

Getting below error:

C:\Users\SVarshney\OneDrive - Shaw Communications Inc\Project\Postman\Collection>node app.js internal/modules/cjs/loader.js:969 throw err; ^

Error: Cannot find module 'newman' Require stack:

C:\Users\SVarshney\OneDrive - Shaw Communications Inc\Project\Postman\Collection\app.js �[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)�[39m �[90m at Function.Module._load (internal/modules/cjs/loader.js:842:27)�[39m �[90m at Module.require (internal/modules/cjs/loader.js:1026:19)�[39m �[90m at require (internal/modules/cjs/helpers.js:72:18)�[39m at Object. (C:\Users\SVarshney\OneDrive - Shaw Communications Inc\Project\Postman\Collection\app.js:1:16) �[90m at Module._compile (internal/modules/cjs/loader.js:1138:30)�[39m �[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)�[39m �[90m at Module.load (internal/modules/cjs/loader.js:986:32)�[39m �[90m at Function.Module._load (internal/modules/cjs/loader.js:879:14)�[39m �[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)�[39m { code: �[32m'MODULE_NOT_FOUND'�[39m, requireStack: [ �[32m'C:\Users\SVarshney\OneDrive - Shaw Communications Inc\Project\Postman\Collection\app.js'�[39m ] } Note: My Postman collection and Json Data file and temorary report are stored in C:\Users\SVarshney\OneDrive - Shaw Communications Inc\Project\Postman\Collection\ path. Nwman version 5.1.0 Node version: v12.18.0

DannyDainton commented 4 years ago

This is not a htmlextra specific issue.

You need to install Newman as a library into that node project and have it as a dependence in a package.json file.

svarshney2311 commented 4 years ago

Could you please elabroarte how to do this

DannyDainton commented 4 years ago

I've done that for you already:

https://github.com/DannyDainton/newman-reporter-htmlextra/issues/238#issuecomment-649700690

These are not reporter specific issues, please only create issues that are directly related to a problem that you're having with the reporter.

There are a number of resources available to teach you about basic JavaScript and how to create node projects.

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.