Skip to content

Commit 8416822

Browse files
authored
Merge pull request #2167 from cjihrig/assert
test: replace chai with node:assert
2 parents 95fe749 + 36d208b commit 8416822

27 files changed

+821
-1128
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ Run `npm run lint` or install an editor plugin.
177177

178178
# Testing
179179

180-
Tests are written using the [Chai](http://chaijs.com/) library. See
180+
Tests are written using the [Mocha](https://mochajs.org/) test runner and
181+
[`node:assert`](https://nodejs.org/api/assert.html) assertion library. See
181182
[`config_test.ts`](./src/config_test.ts) for an example.
182183

183184
To run tests, execute the following:

eslint.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export default tseslint.config(
2121
'@typescript-eslint/no-empty-object-type': 'off',
2222
'@typescript-eslint/no-explicit-any': 'off',
2323
'@typescript-eslint/no-non-null-assertion': 'off',
24-
'@typescript-eslint/no-unused-expressions': 'off',
2524
'@typescript-eslint/no-unused-vars': ['error', { args: 'none' }],
2625
},
2726
},

package-lock.json

Lines changed: 0 additions & 174 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,9 @@
8080
},
8181
"devDependencies": {
8282
"@eslint/js": "^9.18.0",
83-
"@types/chai": "^5.0.0",
84-
"@types/chai-as-promised": "^8.0.1",
8583
"@types/mocha": "^10.0.1",
8684
"@types/mock-fs": "^4.13.1",
8785
"c8": "^10.0.0",
88-
"chai": "^5.1.2",
89-
"chai-as-promised": "^8.0.0",
9086
"eslint": "^9.18.0",
9187
"husky": "^9.0.6",
9288
"mocha": "^11.0.1",

src/attach_test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { expect } from 'chai';
1+
import { strictEqual } from 'node:assert';
22
import WebSocket from 'isomorphic-ws';
33
import { ReadableStreamBuffer, WritableStreamBuffer } from 'stream-buffers';
44
import { anyFunction, anything, capture, instance, mock, verify, when } from 'ts-mockito';
@@ -73,7 +73,7 @@ describe('Attach', () => {
7373
await attach.attach(namespace, pod, container, osStream, errStream, isStream, false);
7474
const [, , outputFn] = capture(fakeWebSocketInterface.connect).last();
7575

76-
expect(outputFn).to.not.be.null;
76+
strictEqual(typeof outputFn, 'function');
7777

7878
// this is redundant but needed for the compiler, sigh...
7979
if (!outputFn) {
@@ -83,18 +83,18 @@ describe('Attach', () => {
8383
let buffer = Buffer.alloc(1024, 10);
8484

8585
outputFn(WebSocketHandler.StdoutStream, buffer);
86-
expect(osStream.size()).to.equal(1024);
86+
strictEqual(osStream.size(), 1024);
8787
let buff = osStream.getContents() as Buffer;
8888
for (let i = 0; i < 1024; i++) {
89-
expect(buff[i]).to.equal(10);
89+
strictEqual(buff[i], 10);
9090
}
9191

9292
buffer = Buffer.alloc(1024, 20);
9393
outputFn(WebSocketHandler.StderrStream, buffer);
94-
expect(errStream.size()).to.equal(1024);
94+
strictEqual(errStream.size(), 1024);
9595
buff = errStream.getContents() as Buffer;
9696
for (let i = 0; i < 1024; i++) {
97-
expect(buff[i]).to.equal(20);
97+
strictEqual(buff[i], 20);
9898
}
9999

100100
const initialTerminalSize: TerminalSize = { height: 0, width: 0 };

0 commit comments

Comments
 (0)