Skip to content

Commit 725b00a

Browse files
Merge pull request #14 from Itsme-Parth/main
Added npm version 1.1.0
2 parents 1708d26 + c9acdc1 commit 725b00a

File tree

4 files changed

+866
-25
lines changed

4 files changed

+866
-25
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ $ set LT_BUILD_NAME="<Add Build Name>"
3939

4040
#### Step 4. Retrieve the list of automation sessions
4141
```
42-
$ fetch-Lt-sessions
42+
$ lt-reporter run
4343
```
4444
#### Expected Output
4545
```
@@ -80,7 +80,7 @@ $ fetch-Lt-sessions
8080
```
8181
#### Note: In order to retreive the list of only Cypress tests run the command below
8282
```
83-
$ fetch-Lt-sessions --enhancedCyReport
83+
$ lt-reporter run --cypress
8484
```
8585
#### Expected Output
8686
```

index.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
#!/usr/bin/env node
22

3-
const yargs = require("yargs/yargs");
4-
const { hideBin } = require("yargs/helpers");
5-
const argv = yargs(hideBin(process.argv)).argv;
63
const { filterCyTests } = require("./lib/helpers/utils");
74
const { fetchCyEnhancedReport } = require("./lib/helpers/utils/cypress");
85

96
const ltClient = require("@lambdatest/node-rest-client");
107

11-
const fetchSession = async (options) => {
8+
const fetchSession = async (argv) => {
129
// read credentials from env
1310

1411
if (!process.env.LT_ACCESS_KEY || !process.env.LT_USERNAME) {
@@ -27,19 +24,17 @@ const fetchSession = async (options) => {
2724
accessKey: process.env.LT_ACCESS_KEY,
2825
});
2926

30-
if (!options) {
31-
// using default options
32-
options = {
27+
// using default options
28+
let options = {
3329
buildLimt: 20,
3430
buildName: process.env.LT_BUILD_NAME,
3531
sessionParams: {
3632
limit: 10000,
3733
},
3834
};
39-
}
4035

41-
// fetch enhanced cy tests data
42-
const fetchEnhancedCyReport = argv && argv.enhancedCyReport;
36+
// fetch enhanced cypress tests data
37+
const fetchEnhancedCyReport = argv && argv.cypress;
4338

4439
const data = await autoClient.getSessionsOfBuild(options);
4540

@@ -63,5 +58,14 @@ const fetchSession = async (options) => {
6358
return;
6459
};
6560

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

Comments
 (0)