Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: replace chai with node:assert #2167

Merged
merged 3 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ Run `npm run lint` or install an editor plugin.

# Testing

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

To run tests, execute the following:
Expand Down
1 change: 0 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export default tseslint.config(
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-unused-vars': ['error', { args: 'none' }],
},
},
Expand Down
174 changes: 0 additions & 174 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,9 @@
},
"devDependencies": {
"@eslint/js": "^9.18.0",
"@types/chai": "^5.0.0",
"@types/chai-as-promised": "^8.0.1",
"@types/mocha": "^10.0.1",
"@types/mock-fs": "^4.13.1",
"c8": "^10.0.0",
"chai": "^5.1.2",
"chai-as-promised": "^8.0.0",
"eslint": "^9.18.0",
"husky": "^9.0.6",
"mocha": "^11.0.1",
Expand Down
12 changes: 6 additions & 6 deletions src/attach_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect } from 'chai';
import { strictEqual } from 'node:assert';
import WebSocket from 'isomorphic-ws';
import { ReadableStreamBuffer, WritableStreamBuffer } from 'stream-buffers';
import { anyFunction, anything, capture, instance, mock, verify, when } from 'ts-mockito';
Expand Down Expand Up @@ -73,7 +73,7 @@ describe('Attach', () => {
await attach.attach(namespace, pod, container, osStream, errStream, isStream, false);
const [, , outputFn] = capture(fakeWebSocketInterface.connect).last();

expect(outputFn).to.not.be.null;
strictEqual(typeof outputFn, 'function');

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

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

buffer = Buffer.alloc(1024, 20);
outputFn(WebSocketHandler.StderrStream, buffer);
expect(errStream.size()).to.equal(1024);
strictEqual(errStream.size(), 1024);
buff = errStream.getContents() as Buffer;
for (let i = 0; i < 1024; i++) {
expect(buff[i]).to.equal(20);
strictEqual(buff[i], 20);
}

const initialTerminalSize: TerminalSize = { height: 0, width: 0 };
Expand Down
Loading
Loading