Repository: promptfoo/promptfoo
Issue: `fs is not defined` in inline js
Root cause: Documentation Deficiency

**Describe the bug**
Inspired by [Transforming input variables docs](https://www.promptfoo.dev/docs/configuration/guide/#transforming-input-variables) I was trying to specify the inline js for `transformVars`, which also included `fs` module, similar to the example provided in the docs:

```yaml
defaultTest:
  options:
    transformVars: |
      return {
        uppercase_topic: vars.topic.toUpperCase(),
        topic_length: vars.topic.length,
        file_content: fs.readFileSync(vars.file_path, 'utf-8')
      };
``` 

**To Reproduce**
Below is my config, which allows to reproduce the bug:
```yaml
description: "bug demo"

prompts:
  - "summarize the text: {{ text }}"

providers:
  - openai:gpt-4o

defaultTest:
  options:
    transformVars: |
      return {
        text: fs.readFileSync('file.txt', 'utf-8')
      };
  assert:
    - type: not-contains
      value: AI language model

tests:
  - vars:
      text: It's been a lovely day, the sun was shining and the birds were singing.
```

As a result of running `promptfoo eval --verbose`, I got the following error:
```
[DB Migrate] Running migrations from /Users/user/PycharmProjects/ml-sandbox/node_modules/promptfoo/dist/drizzle...-bug.yaml
[DB Migrate] Migrations completed
Reading prompts from ["summarize the text: {{ text }}"]
Starting filterTests with options: {}
Initial test count: 1
Inserting prompt dfcd48fda5861b8445a861b456363a166d1de403371e117df16ba7ad8c654824
Inserting dataset 1574863ba69ddefde548baceaa83e7725fc9d0869f8e93ba1c8eac014ae1506b
undefined:4
  text: fs.readFileSync('file.txt', 'utf-8')
        ^

ReferenceError: fs is not defined
    at eval (eval at getInlineTransformFunction (/Users/user/PycharmProjects/ml-sandbox/node_modules/promptfoo/dist/src/util/transform.js:81:12), <anonymous>:4:9)
    at transform (/Users/user/PycharmProjects/ml-sandbox/node_modules/promptfoo/dist/src/util/transform.js:111:39)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Evaluator.evaluate (/Users/user/PycharmProjects/ml-sandbox/node_modules/promptfoo/dist/src/evaluator.js:520:45)
    at async runEvaluation (/Users/user/PycharmProjects/ml-sandbox/node_modules/promptfoo/dist/src/commands/eval.js:201:21)
    at async doEval (/Users/user/PycharmProjects/ml-sandbox/node_modules/promptfoo/dist/src/commands/eval.js:388:12)
```

**Expected behavior**
Few alternatives:
1. the documentation does not provide examples that don't work
2. the `fs` module is available in inline js
3. at least allow to write `const fs = require('fs')`, since `require` itself is also not defined

**System information:**

<details><summary>Debug output</summary>
<pre>
<code>
=========================================================================================================================================================================================================================
Promptfoo Debug Information
=========================================================================================================================================================================================================================
{
  "version": "0.103.16",
  "platform": {
    "os": "darwin",
    "release": "24.2.0",
    "arch": "arm64",
    "nodeVersion": "v20.18.0"
  },
  "env": {},
  "configInfo": {
    "defaultConfigPath": "/Users/user/PycharmProjects/ml-sandbox/promptfooconfig.yaml",
    "specifiedConfigPath": "promptfooconfig-bug.yaml",
    "configExists": true,
    "configContent": {
      "config": {
        "tags": {},
        "description": "bug demo",
        "prompts": [
          "summarize the text: {{ text }}"
        ],
        "providers": [
          "openai:gpt-4o"
        ],
        "tests": [
          {
            "vars": {
              "text": "It's been a lovely day, the sun was shining and the birds were singing."
            }
          }
        ],
        "scenarios": [],
        "env": {},
        "sharing": true,
        "defaultTest": {
          "options": {
            "transformVars": "return {\n  text: fs.readFileSync('file.txt', 'utf-8')\n};\n"
          },
          "assert": [
            {
              "type": "not-contains",
              "value": "AI language model"
            }
          ],
          "vars": {},
          "metadata": {}
        },
        "outputPath": [],
        "extensions": [],
        "metadata": {}
      },
      "testSuite": {
        "description": "bug demo",
        "tags": {},
        "prompts": [
          {
            "raw": "summarize the text: {{ text }}",
            "label": "summarize the text: {{ text }}"
          }
        ],
        "providers": [
          {
            "env": {},
            "modelName": "gpt-4o",
            "config": {
              "basePath": "."
            },
            "label": ""
          }
        ],
        "providerPromptMap": {},
        "tests": [
          {
            "vars": {
              "text": "It's been a lovely day, the sun was shining and the birds were singing."
            }
          }
        ],
        "scenarios": [],
        "defaultTest": {
          "metadata": {},
          "options": {
            "transformVars": "return {\n  text: fs.readFileSync('file.txt', 'utf-8')\n};\n"
          },
          "assert": [
            {
              "type": "not-contains",
              "value": "AI language model"
            }
          ],
          "vars": {}
        },
        "nunjucksFilters": {},
        "extensions": []
      },
      "basePath": "."
    }
  }
}
</code>
</pre>
</details> 


Thanks for reporting this issue @mshavliuk! You're absolutely right - the documentation shouldn't include examples that don't work. I've updated the docs in #2887 to remove the `fs.readFileSync` example and replace it with a more appropriate one using string manipulation.  For file operations and other complex transformations, we recommend using external transform files as documented in the "Input transforms from separate files" section. 

Semi-related - I'm currently working on reviewing and improving more of our documentation in https://github.com/promptfoo/promptfoo/pull/2885 - If you have more thoughts on how to improve the docs please feel free to leave comments or open new issues.