1
1
#!/usr/bin/env node
2
2
3
- const yargs = require ( "yargs/yargs" ) ;
4
- const { hideBin } = require ( "yargs/helpers" ) ;
5
- const argv = yargs ( hideBin ( process . argv ) ) . argv ;
6
3
const { filterCyTests } = require ( "./lib/helpers/utils" ) ;
7
4
const { fetchCyEnhancedReport } = require ( "./lib/helpers/utils/cypress" ) ;
8
5
9
6
const ltClient = require ( "@lambdatest/node-rest-client" ) ;
10
7
11
- const fetchSession = async ( options ) => {
8
+ const fetchSession = async ( argv ) => {
12
9
// read credentials from env
13
10
14
11
if ( ! process . env . LT_ACCESS_KEY || ! process . env . LT_USERNAME ) {
@@ -27,19 +24,17 @@ const fetchSession = async (options) => {
27
24
accessKey : process . env . LT_ACCESS_KEY ,
28
25
} ) ;
29
26
30
- if ( ! options ) {
31
- // using default options
32
- options = {
27
+ // using default options
28
+ let options = {
33
29
buildLimt : 20 ,
34
30
buildName : process . env . LT_BUILD_NAME ,
35
31
sessionParams : {
36
32
limit : 10000 ,
37
33
} ,
38
34
} ;
39
- }
40
35
41
- // fetch enhanced cy tests data
42
- const fetchEnhancedCyReport = argv && argv . enhancedCyReport ;
36
+ // fetch enhanced cypress tests data
37
+ const fetchEnhancedCyReport = argv && argv . cypress ;
43
38
44
39
const data = await autoClient . getSessionsOfBuild ( options ) ;
45
40
@@ -63,5 +58,14 @@ const fetchSession = async (options) => {
63
58
return ;
64
59
} ;
65
60
66
- fetchSession ( ) ;
67
- module . exports = fetchSession ;
61
+ const argv = require ( "yargs" )
62
+ . usage ( "Usage: $0 <command> [options]" )
63
+ . command ( "run" , "Fetches LambdaTest automation session details" , { } , function ( argv ) {
64
+ fetchSession ( argv ) ;
65
+ } )
66
+ . option ( 'cypress' , {
67
+ alias : 'cy' ,
68
+ description : 'Filter cypress test session details'
69
+ } )
70
+ . parse ( ) ;
71
+
0 commit comments