File tree Expand file tree Collapse file tree 4 files changed +47
-38
lines changed Expand file tree Collapse file tree 4 files changed +47
-38
lines changed Original file line number Diff line number Diff line change 1
1
# Dependency directories
2
- . /node_modules
2
+ node_modules
3
+ * .log
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env node
2
+
3
+ const ltClient = require ( "@lambdatest/node-rest-client" ) ;
4
+ const fetchSession = async ( options ) => {
5
+ // read credentials from env
6
+
7
+ if ( ! process . env . LT_ACCESS_KEY || ! process . env . LT_USERNAME ) {
8
+ console . log ( "Access and username is required" ) ;
9
+ throw new Error ( "User name and Access is required parameter" ) ;
10
+ }
11
+
12
+ // read build name from env
13
+ if ( ! process . env . LT_BUILD ) {
14
+ console . log ( " Please set Build name to env" ) ;
15
+ throw new Error ( "Build name is required" ) ;
16
+ }
17
+
18
+ const autoClient = ltClient . AutomationClient ( {
19
+ username : process . env . LT_USERNAME ,
20
+ accessKey : process . env . LT_ACCESS_KEY ,
21
+ } ) ;
22
+
23
+ if ( ! options ) {
24
+ // using default options
25
+ console . log ( "Setting default configurations" ) ;
26
+ options = {
27
+ buildLimt : 20 ,
28
+ buildName : process . env . LT_BUILD ,
29
+ sessionParams : {
30
+ limit : 10000 ,
31
+ } ,
32
+ } ;
33
+ }
34
+ const data = await autoClient . getSessionsOfBuild ( options ) ;
35
+ console . log ( JSON . stringify ( data ) ) ;
36
+ return ;
37
+ } ;
38
+
39
+ fetchSession ( ) ;
40
+ module . exports = fetchSession ;
Original file line number Diff line number Diff line change 3
3
"version" : " 1.0.0" ,
4
4
"description" : " This plugin fetches session details based on build name" ,
5
5
"main" : " LTresults.js" ,
6
+ "bin" : {
7
+ "fetch-LT-sessions" : " ./index.js"
8
+ },
6
9
"scripts" : {
7
10
"test" : " echo \" Error: no test specified\" && exit 1"
8
11
},
20
23
" lambdatest" ,
21
24
" automation" ,
22
25
" browser" ,
23
- " testing"
26
+ " testing" ,
27
+ " cli"
24
28
],
25
29
"dependencies" : {
26
30
"@lambdatest/node-rest-client" : " ^1.0.4"
You can’t perform that action at this time.
0 commit comments