0

I want to use absolute path in k6 js script file. Can someone please help in how to do this?

Instead of this

import {getAddCookieInfoPayLoad} from "../../../scripts/oAuth/addCookieInfoScript.js";
import {getQueryCookieInfoPayLoad} from "../../../scripts/oAuth/queryCookieInfoScript.js";

I want this:

import {getAddCookieInfoPayLoad} from "scripts/oAuth/addCookieInfoScript.js";

import {getQueryCookieInfoPayLoad} from "scripts/oAuth/queryCookieInfoScript.js";
Ravinder Kumar
  • 7,407
  • 3
  • 28
  • 54
Sanjay
  • 59
  • 1
  • 8

1 Answers1

1

You can use absolute paths:

import {getAddCookieInfoPayLoad} from "/absolute/path/to/scripts/oAuth/addCookieInfoScript.js";

and you can also import them with the file:// schema:

import {getAddCookieInfoPayLoad} from "file:///absolute/path/to/scripts/oAuth/addCookieInfoScript.js";

Though in general I find relative paths to be more usable and be more reliable when multiple people are working on the scripts, possibly across different OSes.

na--
  • 1,016
  • 7
  • 9