Skip to content

Commit 05eeea5

Browse files
Merge branch 'LambdaTest:master' into IN-1533
2 parents 14f595c + 1aa2003 commit 05eeea5

File tree

4 files changed

+89
-22
lines changed

4 files changed

+89
-22
lines changed

.github/workflows/healthcheck.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Node Tunnel health check
2+
on:
3+
schedule:
4+
- cron: "0 18 * * *"
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
env:
13+
LT_USERNAME: ${{ secrets.LT_USERNAME }}
14+
LT_ACCESS_KEY: ${{ secrets.LT_ACCESS_KEY }}
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Use Node.js 14.x
18+
uses: actions/setup-node@v2
19+
with:
20+
node-version: 14.x
21+
22+
- name: npm dependencies
23+
run: npm install
24+
25+
- name: Install Mocha
26+
run: npm install -g mocha
27+
28+
- name: Run test
29+
run: npm run test

.github/workflows/npm-publish.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
name: Publish Node Tunnel Package
3+
4+
on:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
build:
10+
if: startsWith(github.ref, 'refs/tags/prod-')
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-node@v2
15+
with:
16+
node-version: 14
17+
- run: npm install
18+
19+
publish-npm:
20+
needs: build
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v2
24+
- uses: actions/setup-node@v2
25+
with:
26+
node-version: 14
27+
registry-url: https://registry.npmjs.org/
28+
- run: npm install
29+
- run: npm publish --access public
30+
env:
31+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
![LambdaTest Logo](https://www.lambdatest.com/static/images/logo.svg)
22

3-
# LambdaTest Nodejs bindings for Tunnel
3+
# LambdaTest Nodejs bindings for Tunnel
44

5-
[![CircleCI](https://circleci.com/gh/LambdaTest/node-tunnel.svg?style=svg)](https://circleci.com/gh/LambdaTest/node-tunnel) [![npm version](https://img.shields.io/npm/v/@lambdatest/node-tunnel.svg?style=flat)](https://www.npmjs.com/package/@lambdatest/node-tunnel 'View this project on npm')
5+
[![Node Tunnel health check](https://github.com/LambdaTest/node-tunnel/actions/workflows/healthcheck.yml/badge.svg?branch=master)](https://github.com/LambdaTest/node-tunnel/actions/workflows/healthcheck.yml)
66

77
## Installation
88

tests/test-index.js

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,34 @@
1+
var lambdaTunnel = require('../index');
12
var chai = require('chai');
23
var expect = chai.expect;
4+
35
describe('Tunnel runs successfully', function() {
6+
var isTunnelStarted = false;
7+
beforeEach(function(done) {
8+
//start tunnel
9+
this.timeout(20000);
10+
var tunnelInstance = new lambdaTunnel();
11+
// replace <lambdatest-user> with your user and <lambdatest-accesskey> with your key.
12+
var tunnelArguments = {
13+
user: process.env.LT_USERNAME || '<lambdatest-user>',
14+
key: process.env.LT_ACCESS_KEY || '<lambdatest-accesskey>'
15+
};
16+
try {
17+
tunnelInstance.start(tunnelArguments, function(error, status) {
18+
if (!error) {
19+
isTunnelStarted = true;
20+
tunnelInstance.stop().then(status => {
21+
console.log('Tunnel is Stopped ? ' + status);
22+
});
23+
done();
24+
}
25+
});
26+
} catch (error) {
27+
isTunnelStarted = false;
28+
}
29+
});
430
it('Tunnel doesnt start on wrong parameter', function() {
5-
var isTunnelStarted = false;
6-
before(function() {
7-
this.timeout('10sec');
8-
//creates an instance of Tunnel
9-
var tunnelInstance = new lambdaTunnel();
10-
// replace <lambdatest-user> with your user and <lambdatest-accesskey> with your key.
11-
var tunnelArguments = {
12-
user: process.env.LT_USERNAME || '<lambdatest-user>',
13-
key: process.env.LT_ACCESS_KEY || '<lambdatest-accesskey>'
14-
};
15-
try {
16-
tunnelInstance.start(tunnelArguments, function(error, status) {
17-
if (!error) {
18-
isTunnelStarted = true;
19-
}
20-
});
21-
} catch (error) {
22-
isTunnelStarted = false;
23-
}
24-
});
2531
expect(typeof isTunnelStarted).to.equal('boolean');
32+
expect(isTunnelStarted).to.equal(true);
2633
});
2734
});

0 commit comments

Comments
 (0)