Testing your source code via the CLI

Snyk Code enables you to test the source code of your repositories via the Snyk CLI.

Notes:

When testing your repository code via the CLI, you can:

Testing a repository from its root folder

To test the current repository folder:

  • In the terminal, enter:

snyk code test

Note: No additional parameters are required for running Snyk Code to test a repository from its root folder.

Snyk Code tests the current folder, and displays the test results in the terminal.

For example:

To test the snyk-goof repository from its root folder, we first changed the directory to the root folder of the repository. Then, we enter:

snyk code test

Snyk Code tests the snyk-goof repository, and displays the vulnerability issue that were discovered in the terminal:

Testing a repository from a different location

To test a repository from another folder:

  • In the terminal, enter:

snyk code test <path/to/folder>

Where:

  • path/to/folder – the full path of the repository you want to test via Snyk Code.

For example:

To test the snyk-goof repository from another directory, we enter:

snyk code test /Users/username/Documents/Repositories/snyk-goof

Last updated

Was this helpful?

#4580: CLI: help, Ignore - support ticket 49463-add Iac examples

Change request updated