-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BREAKING CHANGE: Support MSW 2.0 #122
Changes from 8 commits
b106c13
19a6e68
b3ed3b1
06f0c92
e28f7b7
7ea6645
f80e255
15257ac
c7c8a80
bf62ea8
37dfc82
3cfb456
9cedceb
0f49e5c
7ca8425
7f91bea
49f8028
dd2c917
c14e003
4c6d953
7a608cc
cad5197
68fe0ce
a97567c
9f4c631
a5256b9
dc531d0
fd4358f
dfa57d7
dcca74c
513090e
60b211e
61d20b7
691d424
c4f877b
133be34
42db187
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
trailingComma: 'es5', | ||
tabWidth: 2, | ||
semi: false, | ||
singleQuote: true, | ||
printWidth: 100, | ||
bracketSpacing: true, | ||
} |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -1,3 +1,4 @@ | ||||
const path = require('path') | ||||
/** | ||||
* @type {import('@storybook/react-webpack5').StorybookConfig} | ||||
*/ | ||||
|
@@ -8,13 +9,15 @@ const config = { | |||
'@storybook/addon-essentials', | ||||
'@storybook/addon-a11y', | ||||
'@storybook/preset-create-react-app', | ||||
'@storybook/addon-storysource', | ||||
], | ||||
staticDirs: ['../public'], | ||||
webpackFinal: async (config) => { | ||||
config.resolve = config.resolve || {} | ||||
config.resolve.alias = { | ||||
...config.resolve.alias, | ||||
'msw/native': require.resolve( | ||||
path.resolve(__dirname, '../../../node_modules/msw/lib/native/index.mjs') | ||||
), | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is necessary because the export conditions aren't finding this package, likely because it lacks a browser export There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In my case the error is with
but I'd find it hard to sell that consumers of this plugin (or really, consumers wanting to use storybook + jest + jsdom + msw) need to do this 👇
But I also know there is a lot of push back about those conditional |
||||
'msw-storybook-addon': require.resolve('../../msw-addon/dist'), | ||||
} | ||||
return config | ||||
|
@@ -28,4 +31,4 @@ const config = { | |||
}, | ||||
} | ||||
|
||||
export default config; | ||||
export default config |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module.exports = { | ||
yannbf marked this conversation as resolved.
Show resolved
Hide resolved
|
||
clearMocks: false, | ||
moduleFileExtensions: [ | ||
'web.js', | ||
'js', | ||
'web.ts', | ||
'ts', | ||
'web.tsx', | ||
'tsx', | ||
'json', | ||
'web.jsx', | ||
'jsx', | ||
'node', | ||
], | ||
moduleNameMapper: { '^.+\\.module\\.(css|sass|scss)$': 'identity-obj-proxy' }, | ||
resetMocks: true, | ||
resetModules: false, | ||
restoreMocks: false, | ||
setupFiles: ['./src/fetch-polyfill.js'], | ||
setupFilesAfterEnv: ['./src/setupTests.js'], | ||
testEnvironment: 'jsdom', | ||
transform: { | ||
'^.+\\.(js|jsx|mjs|cjs|ts|tsx)$': 'react-scripts/config/jest/babelTransform.js', | ||
'^.+\\.css$': 'react-scripts/config/jest/cssTransform.js', | ||
'^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)': 'react-scripts/config/jest/fileTransform.js', | ||
}, | ||
transformIgnorePatterns: ['node_modules/(?!@bundled-es-modules)/'], | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can probably bring this back, tests work now