Skip to content

Commit

Permalink
fix: remove conflicting chai dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-guggisberg committed Jan 2, 2024
1 parent de65207 commit ee155fa
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 77 deletions.
121 changes: 64 additions & 57 deletions package-lock.json

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

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,13 @@
"dependencies": {
"debug": "4.3.4",
"http-cache-semantics": "4.1.1",
"lru-cache": "7.18.3"
"lru-cache": "10.1.0"
},
"devDependencies": {
"@semantic-release/changelog": "6.0.3",
"@semantic-release/git": "10.0.1",
"c8": "8.0.1",
"chai": "5.0.0",
"chai-as-promised": "7.1.1",
"chai-bytes": "0.1.2",
"chai-iterator": "3.0.2",
"eslint": "8.56.0",
"eslint-config-airbnb-base": "15.0.0",
Expand Down
6 changes: 3 additions & 3 deletions test/fetch/headers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
/* eslint-disable no-unused-expressions */
/* eslint-disable guard-for-in */

import chai from 'chai';
import { expect, use } from 'chai';
import chaiIterator from 'chai-iterator';

import { Headers } from '../../src/index.js';

chai.use(chaiIterator);
const { expect } = chai;
use(chaiIterator);
// const { expect } = chai;

describe('Headers Tests', () => {
it('overrides toStringTag', () => {
Expand Down
8 changes: 2 additions & 6 deletions test/fetch/request.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,11 @@

import { Readable } from 'stream';

import chai from 'chai';
import chaiBytes from 'chai-bytes';
import { expect } from 'chai';
import { FormData } from 'formdata-node';

import { Request, AbortController } from '../../src/index.js';

chai.use(chaiBytes);
const { expect } = chai;

const BASE_URL = 'https://example.com/';

describe('Request Tests', () => {
Expand Down Expand Up @@ -289,7 +285,7 @@ describe('Request Tests', () => {
// eslint-disable-next-line no-unused-expressions
expect(req.headers.get('content-type')).to.be.null;
return req.arrayBuffer().then((result) => {
expect(new Uint8Array(result)).to.equalBytes(data);
expect(new Uint8Array(result)).to.deep.equal(Buffer.from(data));
});
});

Expand Down
16 changes: 8 additions & 8 deletions test/fetch/response.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,11 @@

import { Readable } from 'stream';

import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import { expect } from 'chai';
import { FormData } from 'formdata-node';

import { Response } from '../../src/index.js';

chai.use(chaiAsPromised);
const { expect } = chai;

describe('Response Tests', () => {
it('overrides toStringTag', () => {
const res = new Response();
Expand Down Expand Up @@ -229,11 +225,13 @@ describe('Response Tests', () => {
expect(res.url).to.equal('');
});

it('should reject if error on stream', () => {
it('should reject if error on stream', async () => {
const stream = Readable.from('a=1');
const res = new Response(stream);
stream.emit('error', new Error('test'));
expect(res.text()).to.be.rejectedWith(TypeError);
res.text().catch((e) => {
expect(e).to.be.an.instanceof(TypeError);
});
});

it('should set bodyUsed', () => {
Expand All @@ -252,7 +250,9 @@ describe('Response Tests', () => {
expect(res.bodyUsed).to.be.true;
expect(result).to.equal('a=1');
// repeated access should fail
expect(res.text()).to.be.rejectedWith(TypeError);
res.text().catch((e) => {
expect(e).to.be.an.instanceof(TypeError);
});
});
});

Expand Down

0 comments on commit ee155fa

Please sign in to comment.