Skip to content

Commit 552947f

Browse files
authored
Merge pull request #18 from th-ch/upgrade-dependencies
Upgrade dependencies
2 parents fe2fc04 + 446d0e2 commit 552947f

File tree

9 files changed

+1643
-702
lines changed

9 files changed

+1643
-702
lines changed

.github/workflows/node.js.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ name: Node.js CI
55

66
on:
77
push:
8-
branches: [ master ]
98
pull_request:
109
branches: [ master ]
1110

@@ -16,7 +15,7 @@ jobs:
1615

1716
strategy:
1817
matrix:
19-
node-version: [12.x, 14.x, 16.x, 18.x, 20.x]
18+
node-version: [18.x, 20.x, 22.x]
2019

2120
steps:
2221
- uses: actions/checkout@v2

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,10 @@
22
/node_modules
33
/package
44
*.tgz
5+
.pnp.*
6+
.yarn/*
7+
!.yarn/patches
8+
!.yarn/plugins
9+
!.yarn/releases
10+
!.yarn/sdks
11+
!.yarn/versions

.yarnrc.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
"type": "git"
99
},
1010
"devDependencies": {
11-
"@types/chai": "^4.3.11",
12-
"@types/mocha": "^9.1.0",
13-
"@types/node": "^14.11.8",
14-
"chai": "^4.4.1",
15-
"mocha": "^9.2.2",
16-
"prettier": "^2.1.2",
17-
"ts-node": "^9.0.0",
18-
"typescript": "^4.0.3"
11+
"@types/chai": "^4.3.20",
12+
"@types/mocha": "^10.0.10",
13+
"@types/node": "^22.10.2",
14+
"chai": "^4.5.0",
15+
"mocha": "11.0.2",
16+
"prettier": "^3.4.2",
17+
"ts-node": "^10.9.2",
18+
"typescript": "^5.7.2"
1919
},
2020
"scripts": {
2121
"build": "yarn clean && tsc",

src/stream.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export class Stream extends Duplex {
8282
}
8383

8484
private sendFlags() {
85-
let flags: FLAGS = 0;
85+
let flags: FLAGS | number = 0;
8686

8787
switch (this.state) {
8888
case STREAM_STATES.Init:

test/header.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('Header', () => {
99
});
1010

1111
it('can parse and re-encode an encoded header', () => {
12-
const encodedHeader = Buffer.from(['00', '02', '00', '01', '00', '00', '00', '00', '00', '00', '00', '07']);
12+
const encodedHeader = Buffer.from([0x0, 0x2, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7]);
1313
const header = Header.parse(encodedHeader);
1414

1515
expect(header.version).to.equal(VERSION);

test/session.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ describe('Server session', () => {
3535
const server = new Session(false, testConfigWithKeepAlive);
3636
const expectedPings = [
3737
// first ping
38-
Buffer.from(['00', '02', '00', '01', '00', '00', '00', '00', '00', '00', '00', '00']),
38+
Buffer.from([0x0, 0x2, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]),
3939
// second ping
40-
Buffer.from(['00', '02', '00', '01', '00', '00', '00', '00', '00', '00', '00', '01']),
40+
Buffer.from([0x0, 0x2, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1]),
4141
// Third ping
42-
Buffer.from(['00', '02', '00', '01', '00', '00', '00', '00', '00', '00', '00', '02']),
42+
Buffer.from([0x0, 0x2, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2]),
4343
];
4444

4545
server.on('data', (data) => {

test/stream.test.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('Stream', () => {
2525
expect(
2626
Buffer.compare(
2727
data,
28-
Buffer.from(['00', '01', '00', '01', '00', '00', '00', '00', '00', '00', '00', '00'])
28+
Buffer.from([0x0, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0])
2929
)
3030
).to.equal(0);
3131
session.removeAllListeners('data');
@@ -42,15 +42,15 @@ describe('Stream', () => {
4242
expect(
4343
Buffer.compare(
4444
data,
45-
Buffer.from(['00', '00', '00', '00', '00', '00', '00', '00', '00', '00', '00', '01', 'ff'])
45+
Buffer.from([0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0xff])
4646
)
4747
).to.equal(0);
4848
expect(stream['sendWindow']).to.equal(0)
4949
session.removeAllListeners('data');
5050
session.close();
5151
done();
5252
});
53-
stream.write(Buffer.from(['ff']), () => stream.close());
53+
stream.write(Buffer.from([0xff]), () => stream.close());
5454
});
5555

5656
it('waits for a window update if send window is empty', (done) => {
@@ -61,7 +61,7 @@ describe('Stream', () => {
6161
expect(
6262
Buffer.compare(
6363
data,
64-
Buffer.from(['00', '00', '00', '00', '00', '00', '00', '00', '00', '00', '00', '01', 'ff'])
64+
Buffer.from([0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0xff])
6565
)
6666
).to.equal(0);
6767
expect(stream['sendWindow']).to.equal(0)
@@ -70,7 +70,7 @@ describe('Stream', () => {
7070
session.close();
7171
done();
7272
});
73-
stream.write(Buffer.from(['ff']), () => stream.close());
73+
stream.write(Buffer.from([0xff]), () => stream.close());
7474
const hdr = new Header(VERSION, TYPES.WindowUpdate, 0, stream.ID(), 1);
7575
setTimeout(() => stream.incrSendWindow(hdr), 50)
7676
});
@@ -82,13 +82,13 @@ describe('Stream', () => {
8282
session.on('data', (data) => {
8383
if (data[1] === 0) { // packet is of type Data
8484
numberOfDataPackets++
85-
expect(Buffer.compare(data, Buffer.from(['00', '00', '00', '00', '00', '00', '00', '00', '00', '00', '00', '01', 'ff']))).to.equal(0);
85+
expect(Buffer.compare(data, Buffer.from([0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0xff]))).to.equal(0);
8686
expect(stream['sendWindow']).to.equal(0)
8787
const hdr = new Header(VERSION, TYPES.WindowUpdate, 0, stream.ID(), 1);
8888
stream.incrSendWindow(hdr)
8989
}
9090
});
91-
stream.write(Buffer.from(['ff', 'ff']), () => {
91+
stream.write(Buffer.from([0xff, 0xff]), () => {
9292
expect(numberOfDataPackets).to.equal(2)
9393
stream.close();
9494
session.removeAllListeners('data');
@@ -104,7 +104,7 @@ describe('Stream', () => {
104104
expect(
105105
Buffer.compare(
106106
data,
107-
Buffer.from(['00', '01', '00', '04', '00', '00', '00', '00', '00', '00', '00', '00'])
107+
Buffer.from([0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
108108
)
109109
).to.equal(0);
110110
session.removeAllListeners('data');
@@ -120,7 +120,7 @@ describe('Stream', () => {
120120
expect(
121121
Buffer.compare(
122122
data,
123-
Buffer.from(['00', '01', '00', '04', '00', '00', '00', '00', '00', '00', '00', '00'])
123+
Buffer.from([0x00, 0x01, 0x00, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0])
124124
)
125125
).to.equal(0);
126126
session.removeAllListeners('data');

0 commit comments

Comments
 (0)