In a bash terminal I like to use the double dash. Using VS Code, you can right click on the spec file in the explorer, or on the open tab. Then select 'Copy Relative Path'. Run the command below pasting the relative path in from the clipboard.
npm t -- --include relative/path/to/file.spec.ts
The double dash signals the end of your command options for npm t
and passes anything after that to the next command which is pointing to ng t
. It's doesn't require any modification and quickly gives desired results.