Wrong unit test command in webapp documentation.
Created by: Tirokk
Authored by DriesCruyskens Closed
💬 Issue
Hi all,
I think the third option/command for running a single unit test in the webapp should be
yarn test path/to/component.spec.js
instead of
yarn run path/to/component.spec.js
I got neither to work on windows but the 'run' command does at least run using WSL. The fact that it doesn't work on windows isn't too bad but documentation should be fixed if this is indeed a typo. I will gladly create a pull request if assigned to me.
Here is the link to the actual location: https://github.com/Human-Connection/Human-Connection/blob/master/webapp/testing.md#unit-tests
command line outputs: WSL
$ yarn run pages/post/_id/_slug/index.spec.js
yarn run v1.22.4
error Command "pages/post/_id/_slug/index.spec.js" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
$ yarn test pages/post/_id/_slug/index.spec.js
yarn run v1.22.4
$ jest pages/post/_id/_slug/index.spec.js
PASS pages/post/_id/_slug/index.spec.js (10.164s)
<omitted>
Powershell:
PS> yarn run .\pages\post\_id\_slug\index.spec.js
yarn run v1.22.4
error Command ".\\pages\\post\\_id\\_slug\\index.spec.js" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
PS> yarn test .\pages\post\_id\_slug\index.spec.js
yarn run v1.22.4
$ jest .\pages\post\_id\_slug\index.spec.js
No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In C:\Users\dries\Documents\open source\Human-Connection\webapp
367 files checked.
testMatch: **/?(*.)+(spec|test).js?(x) - 82 matches
testPathIgnorePatterns: \\node_modules\\ - 367 matches
testRegex: - 0 matches
Pattern: .\pages\post\_id\_slug\index.spec.js - 0 matches
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.