diff --git a/package.json b/package.json index 4f1968ad..cfe6e980 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,7 @@ "@percy/storybook": "^3.0.2", "@shopify/jest-dom-mocks": "^2.1.1", "@shopify/js-uploader": "github:shopify/js-uploader", - "@shopify/react-testing": "^1.5.3", + "@shopify/react-testing": "^1.7.0", "@shopify/sewing-kit": "0.88.0", "@storybook/addon-a11y": "^5.1.9", "@storybook/addon-actions": "^5.1.9", diff --git a/src/test-utilities/matchers/index.ts b/src/test-utilities/matchers/index.ts deleted file mode 100644 index 172a7d44..00000000 --- a/src/test-utilities/matchers/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -import '@shopify/react-testing/matchers'; -import './react'; diff --git a/src/test-utilities/matchers/types.ts b/src/test-utilities/matchers/types.ts deleted file mode 100644 index c415ec77..00000000 --- a/src/test-utilities/matchers/types.ts +++ /dev/null @@ -1,3 +0,0 @@ -import {Root, Element} from '@shopify/react-testing'; - -export type Node = Root | Element; diff --git a/tests/each-test.ts b/tests/each-test.ts index 846b0b0a..dba4bd10 100644 --- a/tests/each-test.ts +++ b/tests/each-test.ts @@ -1,5 +1,6 @@ import {destroyAll} from '@shopify/react-testing'; -import '../src/test-utilities/matchers'; +import '@shopify/react-testing/matchers'; +import './matchers'; afterEach(() => { destroyAll(); diff --git a/tests/matchers/index.ts b/tests/matchers/index.ts new file mode 100644 index 00000000..787fc81f --- /dev/null +++ b/tests/matchers/index.ts @@ -0,0 +1,11 @@ +import {toBeDisabled} from './props'; + +declare global { + namespace jest { + interface Matchers { + toBeDisabled(): void; + } + } +} + +expect.extend({toBeDisabled}); diff --git a/src/test-utilities/matchers/react.ts b/tests/matchers/props.ts similarity index 58% rename from src/test-utilities/matchers/react.ts rename to tests/matchers/props.ts index 0532e4b9..a5ad756f 100644 --- a/src/test-utilities/matchers/react.ts +++ b/tests/matchers/props.ts @@ -1,15 +1,7 @@ import chalk from 'chalk'; -import {Node} from './types'; +import {Node} from '@shopify/react-testing'; -declare global { - namespace jest { - interface Matchers { - toBeDisabled(): void; - } - } -} - -function toBeDisabled(received: Node) { +export function toBeDisabled(received: Node) { const pass = received.prop('disabled') === true; return { @@ -21,5 +13,3 @@ function toBeDisabled(received: Node) { }, }; } - -expect.extend({toBeDisabled}); diff --git a/tsconfig.json b/tsconfig.json index ddf1810f..cdd977f4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -25,5 +25,5 @@ "scripthost" ] }, - "include": ["./config/typescript/**/*", "./src/**/*"] + "include": ["./config/typescript/**/*", "./src/**/*", "./tests/**/*"] } diff --git a/yarn.lock b/yarn.lock index 803947d0..6ae04cd5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1431,10 +1431,10 @@ url-search-params-polyfill "^5.0.0" whatwg-fetch "^3.0.0" -"@shopify/react-testing@^1.5.3": - version "1.5.3" - resolved "https://registry.yarnpkg.com/@shopify/react-testing/-/react-testing-1.5.3.tgz#98c54f93ca2906d5fa1d3b1f7de22a7480893e57" - integrity sha512-uvRR/80iJVxF/zTNbKDDD/1qPfdROdXe9vKVkOl+bGunKRHEr7BVX+snKrhGqGCuB2AVq1A5P5NuBt7N7Wq02g== +"@shopify/react-testing@^1.7.0": + version "1.7.0" + resolved "https://registry.yarnpkg.com/@shopify/react-testing/-/react-testing-1.7.0.tgz#025f109b09b9abdad10148a0ec670bade4ec582f" + integrity sha512-AAK+QCVBiuIzcI/hNjRVkd7/+H1hwFUOgQCmwOiOZxpC1uDIsj2VWAY9bsMKmCmuvGfpRSOhVUMlQRi5fa4Ybg== dependencies: "@shopify/useful-types" "^1.3.0" jest-matcher-utils "^24.5.0"