Issue with custom reporters in Docker
See original GitHub issue-
Newman Version (can be found via
newman -v
): 4.6.0 -
OS details (type, version, and architecture): Linux (within a docker container, if that changes anything)
-
Are you using Newman as a library, or via the CLI? CLI
-
Did you encounter this recently, or has this bug always been there: Recently
-
Expected behaviour: Running correctly
-
Command / script used to run Newman: newman run /usr/<project_folder>/collections/SmokeTests.postman_collection.json -e /usr/<project_folder>/collections/environment.json -r <custom_reporter_name>
-
Sample collection, and auxiliary files (minus the sensitive details): The issue is not in the collection/environment files
-
Screenshots (if applicable): N/A
I have created a custom reporter. This reporter works fine when I run it locally on my machine having installed both newman and the reporter globally.
~ ❯ ls /usr/lib/node_modules/
newman newman-reporter-<custom_reporter_name> npm
However, when inside a docker container, it apparently fails. As you can see from the following logs, both newman and the reporter are installed globally as well, and appear in the same directory.
Step 14/20 : RUN npm install -g newman
/usr/bin/newman -> /usr/lib/node_modules/newman/bin/newman.js
+ newman@4.6.0
added 166 packages from 197 contributors in 12.175s
Step 15/20 :
RUN npm install -g /usr/<project_folder>/newman-reporter-<custom_reporter_name>
+ newman-reporter-<custom_reporter_name>@0.0.1
added 167 packages from 198 contributors in 7.742s
(...)
Step 17/20 : RUN ls /usr/lib/node_modules
newman
newman-reporter-<custom_reporter_name>
npm
Step 18/20 : RUN ls /usr/lib/node_modules/newman-reporter-<custom_reporter_name>
index.js
node_modules
package.json
When I launch the container, which contains a Python script executing the newman command posted above in CLI mode, I receive the following error:
container | newman: could not find "<custom_reporter_name>" reporter
container | ensure that the reporter is installed in the same directory as newman
container | please install reporter using npm
container |
Thanks in advance for your help
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
@shamasis I might have found the issue, but I’m struggling to reproduce it consistently.
In some cases, if the code of the custom reporter has some type of JS error, instead of failing explicitly and raising the JS error, newman says it can’t find the reporter.
Hope this helps somehow.
Nope. Very odd. Closing for now. Will look forward to know more as to why this happened. Meanwhile I will explore as well.