#  How to retrieve collection path in custom reporter for newman 

**URL:** <https://community.postman.com/t/how-to-retrieve-collection-path-in-custom-reporter-for-newman/12013>\
**Category:** Help Hub\
**Tags:** newman-project, tests, collections, reporter\
**Created:** [April 17, 2020, 10:12am UTC](https://community.postman.com/t/how-to-retrieve-collection-path-in-custom-reporter-for-newman/12013 "2020-04-17T10:12:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![giomem33](https://avatars.discourse-cdn.com/v4/letter/g/b5ac83/32.png) [@giomem33](https://community.postman.com/u/giomem33)\
**Post date:** [April 17, 2020, 10:12am UTC](https://community.postman.com/t/how-to-retrieve-collection-path-in-custom-reporter-for-newman/12013/1 "2020-04-17T10:12:47Z")

</div>

> **Archived topic — this may be out of date.**  
> Newman has been replaced by the **[Postman CLI](https://learning.postman.com/docs/postman-cli/postman-cli-overview/)**, Postman’s official, signed command-line tool. It runs collections as Newman did, and also lints API specs, runs mocks and monitors, and syncs local files with Postman from your terminal, CI/CD pipeline or coding agent.  
> Working with an AI coding agent? The [Postman plugin](https://github.com/postmanlabs/postman-plugin) lets agents in Claude Code, Cursor, Codex and others design, mock, test and ship APIs with Postman.  
> For current help, see the [Postman docs](https://learning.postman.com/docs/), try the free [Postman tools](https://www.postman.com/tools) (no account needed), or join us on [Discord](https://discord.gg/58aNNsRBGR).

Hello everyone,  
I’ m writing a custom junit reporter for newman that should display the name of the collection as it is saved on the filesystem. I haven’t found a way yet, do you know if it is feasible? For now I’m only able to retrieve the name of the collection as it is specified inside the .json  
For example:  
I have one collection saved in the filesystem as collection1.json, i would like to retrieve not only the working directory, which I already have from the javascript, but also “collection1”.  
Thanks in advance 🙂

---

<div class="post-metadata">

**Author:** ![kevin.swiber](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/kevin.swiber/32/3820_2.png) [@kevin.swiber](https://community.postman.com/u/kevin.swiber)\
**Post date:** [April 17, 2020, 7:32pm UTC](https://community.postman.com/t/how-to-retrieve-collection-path-in-custom-reporter-for-newman/12013/2 "2020-04-17T19:32:56Z")

</div>

Hi, @giomem33,

You can actually re-parse the arguments coming into the command line. You need to use the `commander` module.

Example:

```auto
    const { program } = require('commander');

    let collectionSpecified;
    program
      .command('run <collection>')
      .allowUnknownOption()
      .action((collection) => {
        collectionSpecified = collection;
      });

    program.parse(process.argv);
    console.log('collection:', collectionSpecified);

```

_EDIT: Note that the collection specifier might be a file path or a URL._

Hope this helps.

Best,

Kevin
