loadText, and NiceEval includes the file contents in that eval’s fingerprint. Change one byte and the next run reruns this eval automatically while other evals keep using their cache.
Reading the same content with fs.readFile leaves NiceEval unaware that the read happened. Change the test file and the cache still hits, so you see a conclusion made against the old test.
Steps
-
Keep the criteria files in the repository with the eval:
-
Read them at the module top level of the
.eval.tsfile:A project-root-relative string works too:loadText("evals/fixtures/react-datepicker/pr-6058/tests/run-tests.sh").loadTextaccepts aURLdirectly; you do not need to importnode:url. -
Write the files into the Sandbox and execute them in
test(t):
datepicker_test.test.tsx and run the same command again. Only this eval reruns, which verifies that the fingerprint took effect.
Notes
loadTextmust be at module top level. Cache reuse is decided before execution. Reading it insidetest(t)happens too late, so NiceEval reports an error telling you to move it to the top level.- Read Agent output with
t.sandbox, notloadText. Files created by the Agent inside the Sandbox are evidence for this run and vary each time; they do not belong in the fingerprint. Read them withawait t.sandbox.readText(path), then pass the returned string tot.check. - Use
loadYaml/loadJsonwhen criteria are structured data such as a case table. See Data-driven Testing.