npm has an interesting flag called --prefix that can be useful when you have multiple package.json files in the same project.
A practical example is the following structure:
project-root/
package.json
tests/ package.json
In the project root, you may have a package.json dedicated to development-related packages, such as build tools, linting, formatting, or other general project scripts.
Separately, the project may contain a tests folder with its own package.json, dedicated to test-related packages. For example, this is where you might keep dependencies and scripts for Playwright, Cypress, or other automated testing tools.
Both package.json files can define their own scripts.
For example, in tests/package.json, you might have:

A commonly used approach, when running the command from the project root, is:
cd tests && npm run e2e
This works, but it requires changing the current directory before running the script.
An alternative approach is to use --prefix directly from the project root:
npm --prefix tests run e2e
In the example above, tests is the path to the folder that contains the target package.json, and e2e is the script defined inside tests/package.json.
In other words, you are telling npm: “run this command in the context of this folder.”
One benefit is that you can also expose this from the root package.json:

Then, from the project root, you can simply run:
npm run e2e
and npm will execute the e2e script defined in tests/package.json.
It is a small detail, but a useful one, especially in projects where automated tests are organized as a separate sub-project with their own dependencies and scripts.