Skip to content

Grader: file-contains

Property Value
Determinism static
Cost low
Reference reference-free
Temporal scope trajectory-level
Score kind code
graders:
- type: file-contains
config:
path: "add.test.js"
value: "expect"
Field Type Required Description
path string Yes File path (or glob) to check
value string Yes Text that must appear in the file
negate boolean No When true, passes when the value is NOT found

Use file-not-contains as a shorthand for negate: true:

graders:
- type: file-not-contains
config:
path: "*.csproj"
value: "packages.config"

This is equivalent to type: file-contains with negate: true.

  1. Finds files matching path in the workspace using glob
  2. Reads file contents
  3. Checks if the file contains value (case-sensitive)

Passes when the value is found in at least one matching file (or NOT found if negated). Fails otherwise.

✔ 'expect' found in add.test.js
✘ 'expect' NOT found in add.test.js
✘ No files matching 'add.test.js' found