Is it possible to use local js files in Bruno? #657
-
I am trying to use a simple js file from the request folder and use it in the script section, but the file is not loaded. In the same way, I would like to create another script outside Bruno that can log the requests and responses, just calling the function from a js file, how the picture shows. Is it possible to execute this strategy? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
This is possible in Bruno :) const helloWorld = require("./test");
helloWorld(); You can also checkout #385 for some script inspirations. |
Beta Was this translation helpful? Give feedback.
-
Thank you @helloanoop, it has worked. |
Beta Was this translation helpful? Give feedback.
-
Hello, im facing a problem that i can't seem to understand. I'm trying to use a custom libraries im making to do my testing and all. I built a parent folder that hold all my custom code, inside that folder i will have all my constants (e.g:: json schema) and also have an utils folder for function that i will use, so my problem is, i made a function to validate my json schema, and im trying to export it. whenever i launch my test it fail because it couldnt find my validate function. I manage to export string, number, object but i can't seem to be able to export an function. Any help pls ? "ValidateJsonSchema.js" function validateJsonSchema() { module.exports = { module.exports = { Libraries/index.js ` module.exports = { |
Beta Was this translation helpful? Give feedback.
This is possible in Bruno :)
I think there is a typo. Your pre-request script should be more like
You can also checkout #385 for some script inspirations.