Skip to content

Commit

Permalink
Merge pull request #1380 from snyk/feat/smoke-test
Browse files Browse the repository at this point in the history
Pin needle dependency and add smoke test for monitor command
  • Loading branch information
JackuB committed Sep 1, 2020
2 parents a99ac29 + 53e40e5 commit 6b262ed
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -69,7 +69,7 @@
"debug": "^4.1.1",
"diff": "^4.0.1",
"glob": "^7.1.3",
"needle": "^2.5.0",
"needle": "2.5.0",
"open": "^7.0.3",
"os-name": "^3.0.0",
"proxy-agent": "^3.1.1",
Expand Down
3 changes: 2 additions & 1 deletion test/smoke/README.md
Expand Up @@ -40,7 +40,8 @@ CI=1 SMOKE_TESTS_SNYK_TOKEN=$SNYK_API_TOKEN shellspec -f d
- [x] test [--json][npm project]
- [ ] test [--json][java-goof]
- [ ] policy, ignore
- [ ] monitor
- [x] monitor [--json][npm project]
- [ ] monitor [--json][java-goof]
- [ ] wizard - possibly impossible? (maybe a basic test that it even loads)

### Missing environments
Expand Down
47 changes: 47 additions & 0 deletions test/smoke/spec/snyk_monitor_spec.sh
@@ -0,0 +1,47 @@
#shellcheck shell=sh

Describe "Snyk monitor command"
Before snyk_login
After snyk_logout

Describe "monitor npm project"
run_monitor_in_subfolder() {
cd ../fixtures/basic-npm || return
snyk monitor
}

It "monitors a project in the same folder"
When run run_monitor_in_subfolder
The status should be success
The output should include "Explore this snapshot at https://app.snyk.io/org/"
The output should include "Notifications about newly disclosed issues related to these dependencies will be emailed to you."
The stderr should equal ""
End

It "monitors a project when pointing to a folder"
When run snyk monitor ../fixtures/basic-npm
The status should be success
The output should include "Explore this snapshot at https://app.snyk.io/org/"
The output should include "Notifications about newly disclosed issues related to these dependencies will be emailed to you."
The stderr should equal ""
End

It "monitors a project when pointing to a file"
When run snyk monitor --file=../fixtures/basic-npm/package.json
The status should be success
The output should include "Explore this snapshot at https://app.snyk.io/org/"
The output should include "Notifications about newly disclosed issues related to these dependencies will be emailed to you."
The stderr should equal ""
End
End

Describe "monitor npm project with JSON output"
It "monitors a project and outputs a valid JSON"
When run snyk monitor ../fixtures/basic-npm --json
The status should be success # issues found
The output should include '"ok": true,'
The stderr should equal ""
The result of function check_valid_json should be success
End
End
End

0 comments on commit 6b262ed

Please sign in to comment.