docker-exec-websocket-client
Advanced tools
Comparing version 1.4.0 to 3.0.0
{ | ||
"name": "docker-exec-websocket-client", | ||
"version": "1.4.0", | ||
"version": "3.0.0", | ||
"scripts": { | ||
"test": "./test/runtests.sh" | ||
"test": "mocha ./test/test.js" | ||
}, | ||
@@ -16,15 +16,15 @@ "license": "MPL-2.0", | ||
"debug": "^4.1.1", | ||
"through2": "^3.0.1", | ||
"ws": "^7.1.2" | ||
"through2": "^4.0.2", | ||
"ws": "^8.4.2" | ||
}, | ||
"devDependencies": { | ||
"assume": "^2.2.0", | ||
"docker-exec-websocket-server": "^1.4.0", | ||
"eslint": "^6.4.0", | ||
"docker-exec-websocket-server": "^3.0.0", | ||
"eslint": "^8.8.0", | ||
"express": "^4.17.1", | ||
"mocha": "^6.2.0", | ||
"mocha": "^9.2.0", | ||
"term.js": "^0.0.7" | ||
}, | ||
"engines": { | ||
"node": ">8.0" | ||
"node": ">12.0" | ||
}, | ||
@@ -35,3 +35,8 @@ "repository": { | ||
}, | ||
"bugs": "https://github.com/taskcluster/docker-exec-websocket-client/issues" | ||
"bugs": "https://github.com/taskcluster/docker-exec-websocket-client/issues", | ||
"mocha": { | ||
"ui": "tdd", | ||
"timeout": "40s", | ||
"reporter": "spec" | ||
} | ||
} |
# docker-exec-websocket-client | ||
## Purpose | ||
Client for docker-exec-websocket-server. | ||
Client for [docker-exec-websocket-server](https://github.com/taskcluster/docker-exec-websocket-server). | ||
@@ -34,2 +34,15 @@ ## Usage | ||
Docker 1.6.1 or above must be installed with a container named `servertest` running with `cat` and `/bin/bash` capabilities to inject the exec process into. From there, `npm test` will carry out the test. | ||
Ensure Docker is installed. | ||
To test locally: | ||
* Run ``yarn install`` to install the dependencies, including developer dependencies | ||
* Run ``yarn test`` | ||
* You can pass environment variables and commands to mocha as well, such as ``DEBUG=* yarn test -f 'docker exec wc'`` | ||
To test with ``docker-compose``, similar to CI: | ||
* Run ``docker-compose build --build-arg NODE_VERSION=16-bullseye``, or change to the desired | ||
[Node.js image tag](https://hub.docker.com/_/node/) | ||
* Run ``docker-compose run --rm test`` | ||
* Repeat ``docker-compose build ...`` when the code changes or you want to try a different Node.js image. |
var assert = require('assert'); | ||
var debug = require('debug')('docker-exec-websocket-server:lib:client'); | ||
var debugdata = require('debug')('docker-exec-websocket-server:lib:rcv'); | ||
var debug = require('debug')('docker-exec-websocket-client:lib:client'); | ||
var debugdata = require('debug')('docker-exec-websocket-client:lib:rcv'); | ||
var EventEmitter = require('events').EventEmitter; | ||
@@ -123,3 +123,3 @@ var msgcode = require('./messagecodes.js'); | ||
messageHandler(messageEvent) { | ||
var message = new Buffer(new Uint8Array(messageEvent.data)); | ||
var message = Buffer.from(new Uint8Array(messageEvent.data)); | ||
debugdata(message); | ||
@@ -181,3 +181,3 @@ // the first byte is the message code | ||
} else { | ||
var buf = new Buffer(4); | ||
var buf = Buffer.alloc(4); | ||
buf.writeUInt16LE(h, 0); | ||
@@ -191,7 +191,7 @@ buf.writeUInt16LE(w, 2); | ||
sendCode(code) { | ||
this.strbuf.write(new Buffer([code])); | ||
this.strbuf.write(Buffer.from([code])); | ||
} | ||
sendMessage(code, data) { | ||
this.strbuf.write(Buffer.concat([new Buffer([code]), new Buffer(data)])); | ||
this.strbuf.write(Buffer.concat([Buffer.from([code]), Buffer.from(data)])); | ||
} | ||
@@ -198,0 +198,0 @@ |
@@ -15,4 +15,4 @@ module.exports = { | ||
shutdown: 201, // Server shut down | ||
error: 202 // Some internal error occurred, expect undefined behaviour | ||
error: 202, // Some internal error occurred, expect undefined behaviour | ||
//may carry utf8 payload regarding error reason | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33165
8
425
48
1
+ Addedthrough2@4.0.2(transitive)
+ Addedws@8.18.0(transitive)
- Removedthrough2@3.0.2(transitive)
- Removedws@7.5.10(transitive)
Updatedthrough2@^4.0.2
Updatedws@^8.4.2