From 259a09a9c0bd2a52df84ef77394597f17e617726 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 1 Nov 2026 22:50:26 +0000 Subject: [PATCH] docs: warn against nyc instrument --in-place (#861) `nyc instrument --in-place` overwrites the source files with instrumented code. The HTML reporter reads sources from disk, so the report then shows instrumented code. Recommend instrumenting into a separate folder instead. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WUv8r4ToKpF6R8iwcic9CU --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 68b01a6d..6f4f8523 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,8 @@ This plugin **DOES NOT** instrument your code. You have to instrument it yoursel Please see the [Test Apps](#internal-test-apps) section below. You can find a linked project matching your situation to see how to instrument your application's source code before running end-to-end tests to get the code coverage. +If you instrument ahead of time with `nyc instrument`, write the output to a separate folder, for example `nyc instrument src dist-instrumented`, and serve that folder. Don't use `--in-place`. It overwrites your source files with instrumented code, and the HTML report shows the source files as they are on disk, so the report would show instrumented code instead of your own source. + If your application has been instrumented correctly, you should see additional counters and instructions in the application's JavaScript resources, as the image below shows. ![Instrumented code](images/instrumented-code.png)