https://promptfoo.dev/ logo
startsWith error
# 💬|general
j
Hi all, thanks a lot for building promptfoo, it's such a great library. I have several questions since I am operationalizing it for one customer presently. First question is : is it possible to pass typescript tests ? Other question : has some people experienced the following issue
Copy code
TypeError: Cannot read properties of undefined (reading 'startsWith')
while passing javascript file on a custom export?
i
are you able to share the javascript file?
and do you have a stack trace or just more debug output for the error?
j
Hi Ian, thanks for asking for some more info, I finally made it work. There was something misleading in doc, it says the js file should look like:
Copy code
// Named exports
module.exports.customFunction = (output, context) => {
  return output.includes('specific text');
};
and I finally made it work with something like this
Copy code
// Named exports
module.exports = {
 customFunction: (output, context) => {
  return output.includes('specific text');
  },
}