This repository has been archived by the owner on May 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Note that without extending the top-level tsconfig.json from tsconfig.base.json, the right compiler options weren't being applied for the tests, even though they are inherited by the individual project tsconfig.jsons (react and esModuleInterop). Extending the top level one from the base solves the issue, but feels wrong... I would've thought that because each project gets the right config, the tests should've worked right. Also building works fine, but it is Jest or ts-jest causing the issue. Pretty sure this is related to - kulshekhar/ts-jest#1648 - microsoft/TypeScript#37239
- Loading branch information
Showing
5 changed files
with
137 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
packages/stories-utils/src/__tests__/prepareStory.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* @jest-environment jsdom | ||
*/ | ||
import { render, screen } from '@testing-library/react'; | ||
import React from 'react'; | ||
import prepareStory from '../prepareStory'; | ||
|
||
test('no args', () => { | ||
const Story = () => <button>brew</button>; | ||
|
||
render(prepareStory(Story)); | ||
expect(screen.getByRole('button', { name: 'brew' })).toBeTruthy(); | ||
}); | ||
|
||
test('args', () => { | ||
type Args = { children: React.ReactNode }; | ||
const Story = (args: Args) => <button {...args} />; | ||
Story.args = { children: 'hiya' }; | ||
|
||
render(prepareStory(Story)); | ||
expect(screen.getByRole('button', { name: 'hiya' })).toBeTruthy(); | ||
}); | ||
|
||
test('args and overrides', () => { | ||
type Args = { children: React.ReactNode }; | ||
const Story = (args: Args) => <button {...args} />; | ||
Story.args = { children: 'hiya' }; | ||
|
||
render(prepareStory(Story, { children: 'byeya' })); | ||
expect(screen.getByRole('button', { name: 'byeya' })).toBeTruthy(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -986,7 +986,15 @@ | |
pirates "^4.0.0" | ||
source-map-support "^0.5.16" | ||
|
||
"@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.3.1", "@babel/runtime@^7.5.0", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": | ||
"@babel/runtime-corejs3@^7.10.2": | ||
version "7.12.5" | ||
resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.12.5.tgz#ffee91da0eb4c6dae080774e94ba606368e414f4" | ||
integrity sha512-roGr54CsTmNPPzZoCP1AmDXuBoNao7tnSA83TXTwt+UK5QVyh1DIJnrgYRPWKCF2flqZQXwa7Yr8v7VmLzF0YQ== | ||
dependencies: | ||
core-js-pure "^3.0.0" | ||
regenerator-runtime "^0.13.4" | ||
|
||
"@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.5", "@babel/runtime@^7.3.1", "@babel/runtime@^7.5.0", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": | ||
version "7.12.5" | ||
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.12.5.tgz#410e7e487441e1b360c29be715d870d9b985882e" | ||
integrity sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg== | ||
|
@@ -2794,11 +2802,38 @@ | |
"@svgr/plugin-svgo" "^5.5.0" | ||
loader-utils "^2.0.0" | ||
|
||
"@testing-library/dom@^7.26.6": | ||
version "7.26.7" | ||
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-7.26.7.tgz#b9008b21524288fb09f7bc20bf366a3aa1f0ce72" | ||
integrity sha512-Ykb+W02Q5lAAuwwANq/LCxMqrLKF7S+udJ0tFDwyuHyr84kQ2YKeYdIl5B3HnLKSWK4mGqA+Xe7dbU25DXhlkQ== | ||
dependencies: | ||
"@babel/code-frame" "^7.10.4" | ||
"@babel/runtime" "^7.12.5" | ||
"@types/aria-query" "^4.2.0" | ||
aria-query "^4.2.2" | ||
chalk "^4.1.0" | ||
dom-accessibility-api "^0.5.4" | ||
lz-string "^1.4.4" | ||
pretty-format "^26.6.2" | ||
|
||
"@testing-library/react@^11.1.2": | ||
version "11.1.2" | ||
resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-11.1.2.tgz#089b06d3828e76fc1ff0092dd69c7b59c454c998" | ||
integrity sha512-foL0/Mo68M51DdgFwEsO2SDEkUpocuEYidOTcJACGEcoakZDINuERYwVdd6T5e3pPE+BZyGwwURaXcrX1v9RbQ== | ||
dependencies: | ||
"@babel/runtime" "^7.12.1" | ||
"@testing-library/dom" "^7.26.6" | ||
|
||
"@types/anymatch@*": | ||
version "1.3.1" | ||
resolved "https://registry.yarnpkg.com/@types/anymatch/-/anymatch-1.3.1.tgz#336badc1beecb9dacc38bea2cf32adf627a8421a" | ||
integrity sha512-/+CRPXpBDpo2RK9C68N3b2cOvO0Cf5B9aPijHsoDQTHivnGSObdOF2BRQOYjojWTDy6nQvMjmqRXIxH55VjxxA== | ||
|
||
"@types/aria-query@^4.2.0": | ||
version "4.2.0" | ||
resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-4.2.0.tgz#14264692a9d6e2fa4db3df5e56e94b5e25647ac0" | ||
integrity sha512-iIgQNzCm0v7QMhhe4Jjn9uRh+I6GoPmt03CbEtwx3ao8/EfoQcmgtqH4vQ5Db/lxiIGaWDv6nwvunuh0RyX0+A== | ||
|
||
"@types/babel__core@^7.0.0", "@types/babel__core@^7.1.7": | ||
version "7.1.12" | ||
resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.12.tgz#4d8e9e51eb265552a7e4f1ff2219ab6133bdfb2d" | ||
|
@@ -3039,7 +3074,7 @@ | |
dependencies: | ||
"@types/react" "*" | ||
|
||
"@types/react@*": | ||
"@types/react@*", "@types/react@^16.9.56": | ||
version "16.9.56" | ||
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.56.tgz#ea25847b53c5bec064933095fc366b1462e2adf0" | ||
integrity sha512-gIkl4J44G/qxbuC6r2Xh+D3CGZpJ+NdWTItAPmZbR5mUS+JQ8Zvzpl0ea5qT/ZT3ZNTUcDKUVqV3xBE8wv/DyQ== | ||
|
@@ -3139,6 +3174,17 @@ | |
eslint-scope "^5.0.0" | ||
eslint-utils "^2.0.0" | ||
|
||
"@typescript-eslint/experimental-utils@^3.10.1": | ||
version "3.10.1" | ||
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-3.10.1.tgz#e179ffc81a80ebcae2ea04e0332f8b251345a686" | ||
integrity sha512-DewqIgscDzmAfd5nOGe4zm6Bl7PKtMG2Ad0KG8CUZAHlXfAKTF9Ol5PXhiMh39yRL2ChRH1cuuUGOcVyyrhQIw== | ||
dependencies: | ||
"@types/json-schema" "^7.0.3" | ||
"@typescript-eslint/types" "3.10.1" | ||
"@typescript-eslint/typescript-estree" "3.10.1" | ||
eslint-scope "^5.0.0" | ||
eslint-utils "^2.0.0" | ||
|
||
"@typescript-eslint/parser@^4.8.1": | ||
version "4.8.1" | ||
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.8.1.tgz#4fe2fbdbb67485bafc4320b3ae91e34efe1219d1" | ||
|
@@ -3157,11 +3203,30 @@ | |
"@typescript-eslint/types" "4.8.1" | ||
"@typescript-eslint/visitor-keys" "4.8.1" | ||
|
||
"@typescript-eslint/[email protected]": | ||
version "3.10.1" | ||
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-3.10.1.tgz#1d7463fa7c32d8a23ab508a803ca2fe26e758727" | ||
integrity sha512-+3+FCUJIahE9q0lDi1WleYzjCwJs5hIsbugIgnbB+dSCYUxl8L6PwmsyOPFZde2hc1DlTo/xnkOgiTLSyAbHiQ== | ||
|
||
"@typescript-eslint/[email protected]": | ||
version "4.8.1" | ||
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.8.1.tgz#23829c73c5fc6f4fcd5346a7780b274f72fee222" | ||
integrity sha512-ave2a18x2Y25q5K05K/U3JQIe2Av4+TNi/2YuzyaXLAsDx6UZkz1boZ7nR/N6Wwae2PpudTZmHFXqu7faXfHmA== | ||
|
||
"@typescript-eslint/[email protected]": | ||
version "3.10.1" | ||
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-3.10.1.tgz#fd0061cc38add4fad45136d654408569f365b853" | ||
integrity sha512-QbcXOuq6WYvnB3XPsZpIwztBoquEYLXh2MtwVU+kO8jgYCiv4G5xrSP/1wg4tkvrEE+esZVquIPX/dxPlePk1w== | ||
dependencies: | ||
"@typescript-eslint/types" "3.10.1" | ||
"@typescript-eslint/visitor-keys" "3.10.1" | ||
debug "^4.1.1" | ||
glob "^7.1.6" | ||
is-glob "^4.0.1" | ||
lodash "^4.17.15" | ||
semver "^7.3.2" | ||
tsutils "^3.17.1" | ||
|
||
"@typescript-eslint/[email protected]": | ||
version "4.8.1" | ||
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.8.1.tgz#7307e3f2c9e95df7daa8dc0a34b8c43b7ec0dd32" | ||
|
@@ -3176,6 +3241,13 @@ | |
semver "^7.3.2" | ||
tsutils "^3.17.1" | ||
|
||
"@typescript-eslint/[email protected]": | ||
version "3.10.1" | ||
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-3.10.1.tgz#cd4274773e3eb63b2e870ac602274487ecd1e931" | ||
integrity sha512-9JgC82AaQeglebjZMgYR5wgmfUdUc+EitGUUMW8u2nDckaeimzW+VsoLV6FoimPv2id3VQzfjwBxEMVz08ameQ== | ||
dependencies: | ||
eslint-visitor-keys "^1.1.0" | ||
|
||
"@typescript-eslint/[email protected]": | ||
version "4.8.1" | ||
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.8.1.tgz#794f68ee292d1b2e3aa9690ebedfcb3a8c90e3c3" | ||
|
@@ -3622,6 +3694,14 @@ argparse@^1.0.7: | |
dependencies: | ||
sprintf-js "~1.0.2" | ||
|
||
aria-query@^4.2.2: | ||
version "4.2.2" | ||
resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-4.2.2.tgz#0d2ca6c9aceb56b8977e9fed6aed7e15bbd2f83b" | ||
integrity sha512-o/HelwhuKpTj/frsOsbNLNgnNGVIFsVP/SW2BSF14gVl7kAfMOJ6/8wUAUvG1R1NHKrfG+2sHZTu0yauT1qBrA== | ||
dependencies: | ||
"@babel/runtime" "^7.10.2" | ||
"@babel/runtime-corejs3" "^7.10.2" | ||
|
||
arr-diff@^4.0.0: | ||
version "4.0.0" | ||
resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" | ||
|
@@ -5196,7 +5276,7 @@ core-js-compat@^3.6.2: | |
browserslist "^4.14.6" | ||
semver "7.0.0" | ||
|
||
core-js-pure@^3.0.1: | ||
core-js-pure@^3.0.0, core-js-pure@^3.0.1: | ||
version "3.7.0" | ||
resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.7.0.tgz#28a57c861d5698e053f0ff36905f7a3301b4191e" | ||
integrity sha512-EZD2ckZysv8MMt4J6HSvS9K2GdtlZtdBncKAmF9lr2n0c9dJUaUN88PSTjvgwCgQPWKTkERXITgS6JJRAnljtg== | ||
|
@@ -5732,6 +5812,11 @@ doctrine@^3.0.0: | |
dependencies: | ||
esutils "^2.0.2" | ||
|
||
dom-accessibility-api@^0.5.4: | ||
version "0.5.4" | ||
resolved "https://registry.yarnpkg.com/dom-accessibility-api/-/dom-accessibility-api-0.5.4.tgz#b06d059cdd4a4ad9a79275f9d414a5c126241166" | ||
integrity sha512-TvrjBckDy2c6v6RLxPv5QXOnU+SmF9nBII5621Ve5fu6Z/BDrENurBEvlC1f44lKEUVqOpK4w9E5Idc5/EgkLQ== | ||
|
||
dom-converter@^0.2: | ||
version "0.2.0" | ||
resolved "https://registry.yarnpkg.com/dom-converter/-/dom-converter-0.2.0.tgz#6721a9daee2e293682955b6afe416771627bb768" | ||
|
@@ -6224,6 +6309,13 @@ eslint-plugin-prettier@^3.1.4: | |
dependencies: | ||
prettier-linter-helpers "^1.0.0" | ||
|
||
eslint-plugin-testing-library@^3.10.0: | ||
version "3.10.0" | ||
resolved "https://registry.yarnpkg.com/eslint-plugin-testing-library/-/eslint-plugin-testing-library-3.10.0.tgz#8c3c9c475bb4e5794446920d363403ae5bcf7f1c" | ||
integrity sha512-zqITQ9qS9tdTG5hY+JnY4k3osolg4sGMD9gTnJr0L1xKB8CvPXXts7tp331ZjQ6qL37kRgH0288/XtsG+bcsxQ== | ||
dependencies: | ||
"@typescript-eslint/experimental-utils" "^3.10.1" | ||
|
||
eslint-scope@^4.0.3: | ||
version "4.0.3" | ||
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848" | ||
|
@@ -9136,6 +9228,11 @@ lru-cache@^6.0.0: | |
dependencies: | ||
yallist "^4.0.0" | ||
|
||
lz-string@^1.4.4: | ||
version "1.4.4" | ||
resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.4.4.tgz#c0d8eaf36059f705796e1e344811cf4c498d3a26" | ||
integrity sha1-wNjq82BZ9wV5bh40SBHPTEmNOiY= | ||
|
||
macos-release@^2.2.0: | ||
version "2.4.1" | ||
resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-2.4.1.tgz#64033d0ec6a5e6375155a74b1a1eba8e509820ac" | ||
|