Skip to content

Commit 6b262ed

Browse files
authored
Merge pull request #1380 from snyk/feat/smoke-test
Pin needle dependency and add smoke test for monitor command
2 parents a99ac29 + 53e40e5 commit 6b262ed

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"debug": "^4.1.1",
7070
"diff": "^4.0.1",
7171
"glob": "^7.1.3",
72-
"needle": "^2.5.0",
72+
"needle": "2.5.0",
7373
"open": "^7.0.3",
7474
"os-name": "^3.0.0",
7575
"proxy-agent": "^3.1.1",

test/smoke/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ CI=1 SMOKE_TESTS_SNYK_TOKEN=$SNYK_API_TOKEN shellspec -f d
4040
- [x] test [--json][npm project]
4141
- [ ] test [--json][java-goof]
4242
- [ ] policy, ignore
43-
- [ ] monitor
43+
- [x] monitor [--json][npm project]
44+
- [ ] monitor [--json][java-goof]
4445
- [ ] wizard - possibly impossible? (maybe a basic test that it even loads)
4546

4647
### Missing environments

test/smoke/spec/snyk_monitor_spec.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#shellcheck shell=sh
2+
3+
Describe "Snyk monitor command"
4+
Before snyk_login
5+
After snyk_logout
6+
7+
Describe "monitor npm project"
8+
run_monitor_in_subfolder() {
9+
cd ../fixtures/basic-npm || return
10+
snyk monitor
11+
}
12+
13+
It "monitors a project in the same folder"
14+
When run run_monitor_in_subfolder
15+
The status should be success
16+
The output should include "Explore this snapshot at https://app.snyk.io/org/"
17+
The output should include "Notifications about newly disclosed issues related to these dependencies will be emailed to you."
18+
The stderr should equal ""
19+
End
20+
21+
It "monitors a project when pointing to a folder"
22+
When run snyk monitor ../fixtures/basic-npm
23+
The status should be success
24+
The output should include "Explore this snapshot at https://app.snyk.io/org/"
25+
The output should include "Notifications about newly disclosed issues related to these dependencies will be emailed to you."
26+
The stderr should equal ""
27+
End
28+
29+
It "monitors a project when pointing to a file"
30+
When run snyk monitor --file=../fixtures/basic-npm/package.json
31+
The status should be success
32+
The output should include "Explore this snapshot at https://app.snyk.io/org/"
33+
The output should include "Notifications about newly disclosed issues related to these dependencies will be emailed to you."
34+
The stderr should equal ""
35+
End
36+
End
37+
38+
Describe "monitor npm project with JSON output"
39+
It "monitors a project and outputs a valid JSON"
40+
When run snyk monitor ../fixtures/basic-npm --json
41+
The status should be success # issues found
42+
The output should include '"ok": true,'
43+
The stderr should equal ""
44+
The result of function check_valid_json should be success
45+
End
46+
End
47+
End

0 commit comments

Comments
 (0)