Skip to content

Commit

Permalink
chore: remove enzyme (#6777)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyletsang committed Mar 17, 2024
1 parent d139e15 commit 522fd86
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 352 deletions.
3 changes: 0 additions & 3 deletions karma.conf.js
Expand Up @@ -33,9 +33,6 @@ module.exports = (config) => {
symlinks: false,
extensions: ['.js', '.jsx', '.ts', '.tsx'],
fallback: {
util: require.resolve('util/'),
// for Enzyme/Cheerio
stream: require.resolve('stream-browserify'),
'process/browser': require.resolve('process/browser'),
},
},
Expand Down
3 changes: 0 additions & 3 deletions package.json
Expand Up @@ -104,8 +104,6 @@
"cpy-cli": "^3.1.1",
"cross-env": "^7.0.3",
"dtslint": "^4.2.1",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.7",
"eslint": "^8.55.0",
"eslint-config-4catalyzer-typescript": "^3.3.0",
"eslint-import-resolver-node": "^0.3.9",
Expand Down Expand Up @@ -139,7 +137,6 @@
"simulant": "^0.2.2",
"sinon": "^15.2.0",
"sinon-chai": "^3.7.0",
"stream-browserify": "^3.0.0",
"typescript": "^5.3.3",
"util": "^0.12.5",
"webpack": "^5.89.0"
Expand Down
23 changes: 0 additions & 23 deletions test/index.js
@@ -1,28 +1,5 @@
import deprecated from 'prop-types-extra/lib/deprecated';
import Util from 'util';
import Enzyme, { ShallowWrapper, ReactWrapper } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

Enzyme.configure({ adapter: new Adapter() });

function assertLength(length) {
return function $assertLength(selector) {
let result = this.find(selector);
expect(
result,
`Expected to find ${length} match but found ${
result.length
} for selector "${selector}" on element: \n\n${this.debug()}`,
).to.have.length(length);
return result;
};
}

ReactWrapper.prototype.assertSingle = assertLength(1);
ShallowWrapper.prototype.assertSingle = assertLength(1);

ReactWrapper.prototype.assertNone = assertLength(0);
ShallowWrapper.prototype.assertNone = assertLength(0);

beforeEach(() => {
sinon.stub(console, 'error').callsFake((msg, ...args) => {
Expand Down
5 changes: 2 additions & 3 deletions test/useOverlayOffsetSpec.tsx
@@ -1,6 +1,5 @@
import * as React from 'react';
import { useImperativeHandle } from 'react';
import { mount } from 'enzyme';
import { render } from '@testing-library/react';
import { expect } from 'chai';

Expand Down Expand Up @@ -54,7 +53,7 @@ describe('useOverlayOffset', () => {
it('should have offset of [0, 6] for Tooltips', () => {
const ref = React.createRef<any>();

mount(
render(
<Wrapper ref={ref}>
<Tooltip id="test-tooltip" />
</Wrapper>,
Expand All @@ -67,7 +66,7 @@ describe('useOverlayOffset', () => {
it('should have offset of [0, 0] for any overlay', () => {
const ref = React.createRef<any>();

mount(
render(
<Wrapper ref={ref}>
<div>test</div>
</Wrapper>,
Expand Down

0 comments on commit 522fd86

Please sign in to comment.