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 11# 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 33 "version" : " 1.0.0" ,
44 "description" : " This plugin fetches session details based on build name" ,
55 "main" : " LTresults.js" ,
6+ "bin" : {
7+ "fetch-LT-sessions" : " ./index.js"
8+ },
69 "scripts" : {
710 "test" : " echo \" Error: no test specified\" && exit 1"
811 },
2023 " lambdatest" ,
2124 " automation" ,
2225 " browser" ,
23- " testing"
26+ " testing" ,
27+ " cli"
2428 ],
2529 "dependencies" : {
2630 "@lambdatest/node-rest-client" : " ^1.0.4"
You can’t perform that action at this time.
0 commit comments