From ec0c77e73b467b2f3423f639fbd79b170d6703e8 Mon Sep 17 00:00:00 2001 From: Revath S Kumar Date: Wed, 8 May 2019 20:52:43 +0530 Subject: [PATCH] fix: use `this.equals` instead of import jasmineUtils As per the [comment](https://github.com/testing-library/jest-dom/pull/93#discussion_r282040908) by @SimenB This will remove the direct import of jasmineUtils `import {equals} from 'expect/build/jasmineUtils'` and instead use `this.equals`. Also removes the added dependency of `expect`. --- package.json | 1 - src/to-have-attribute.js | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/package.json b/package.json index ef5f1162..f8f704e0 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,6 @@ "chalk": "^2.4.1", "css": "^2.2.3", "css.escape": "^1.5.1", - "expect": "^24.7.1", "jest-diff": "^24.0.0", "jest-matcher-utils": "^24.0.0", "lodash": "^4.17.11", diff --git a/src/to-have-attribute.js b/src/to-have-attribute.js index 0627cf35..bd56d7cd 100644 --- a/src/to-have-attribute.js +++ b/src/to-have-attribute.js @@ -1,5 +1,4 @@ import {matcherHint, stringify, printExpected} from 'jest-matcher-utils' -import {equals} from 'expect/build/jasmineUtils' import {checkHtmlElement, getMessage} from './utils' function printAttribute(name, value) { @@ -19,7 +18,7 @@ export function toHaveAttribute(htmlElement, name, expectedValue) { const receivedValue = htmlElement.getAttribute(name) return { pass: isExpectedValuePresent - ? hasAttribute && equals(receivedValue, expectedValue) + ? hasAttribute && this.equals(receivedValue, expectedValue) : hasAttribute, message: () => { const to = this.isNot ? 'not to' : 'to'