Skip to content

Which path to use when using the "file:" to load files? #368

Answered by thim81
thim81 asked this question in Q&A
Discussion options

You must be logged in to vote

Portman supports the loading of JS files content for:

  • extendTests
  • operationPreRequestScripts
  • collectionTestScripts
  • collectionPreRequestScripts

By using the file: setting, you can define a JS file, which will be read as-is and injected in the wanted Postman Tests.

Example:

{
  "version": 1,
  "globals": {
    "stripResponseExamples": true,
    "collectionPreRequestScripts": [
      "file:configs/scripts/prerequest.js"
    ]
  }
}

The file path can be relative or absolute to the local system.
When using a relative path, it should be relative to the location from where Portman is executed.

The above example has a JS file with PreRequest code, located in:

app
├── ...
├── configs            …

Replies: 1 comment

Comment options

thim81
Jul 13, 2022
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by thim81
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant