-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Release: Prerelease 8.4.0-alpha.1 #29118
Changes from all commits
64fbe39
aff3580
6f19cac
5faae40
19a68df
b9e35a1
98e6608
651674a
3da4372
4af51ac
e693dcd
1d27f37
dac2cc3
3d4f7ec
247efff
2ac99b3
ce73ddb
5ed3ab4
2e89262
b080e71
b9c600a
67dbe11
cf80eaa
ef33853
353dfb1
08c6eef
a09abbc
93b866b
7c14a13
7816541
fb2455b
2dcc7b7
ca39982
a42ff7e
174868a
643acbf
89cdff3
0d10b95
5a97b8f
8c58016
a3d75f5
6019553
b0d55ed
b40b44f
629e70d
8e9d63b
f5b1525
8346b85
12f8029
f6e33b1
f0593f9
ea609bf
b034203
7262c52
8ac3e53
8115974
4ebba9a
20c0b10
ea27938
57cdf15
2d2943b
5ac38c3
a70830b
3f856d9
0d238e2
57ee6e1
221f6a7
26c2865
3bae5cf
995c912
b11edcf
1882717
d43564e
d02d6b4
d2a98f1
d5ba8e5
b23e84a
387f10e
470ad3c
9414c0d
48980f6
f665c36
8de3b0e
0811ca8
72a6f7d
af8d757
dd170eb
91c2e9d
538de42
b7cfbe5
60e266a
9a059d9
d80402d
71a3eb4
caa4ff3
1a50094
58cca8d
8333cde
f655698
02598e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { vi } from 'vitest'; | ||
|
||
// This is a custom function that our tests can use during setup to specify | ||
// what the files on the "mock" filesystem should look like when any of the | ||
// `fs` APIs are used. | ||
let mockFiles = Object.create(null); | ||
|
||
// eslint-disable-next-line no-underscore-dangle, @typescript-eslint/naming-convention | ||
export function __setMockFiles(newMockFiles: Record<string, string | null>) { | ||
mockFiles = newMockFiles; | ||
} | ||
|
||
export const readFileSync = (filePath = '') => mockFiles[filePath]; | ||
export const existsSync = (filePath: string) => !!mockFiles[filePath]; | ||
export const lstatSync = (filePath: string) => ({ | ||
isFile: () => !!mockFiles[filePath], | ||
}); | ||
export const realpathSync = vi.fn(); | ||
export const readdir = vi.fn(); | ||
export const readdirSync = vi.fn(); | ||
export const readlinkSync = vi.fn(); | ||
|
||
export default { | ||
__setMockFiles, | ||
readFileSync, | ||
existsSync, | ||
lstatSync, | ||
realpathSync, | ||
readdir, | ||
readdirSync, | ||
readlinkSync, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { vi } from 'vitest'; | ||
|
||
// This is a custom function that our tests can use during setup to specify | ||
// what the files on the "mock" filesystem should look like when any of the | ||
// `fs` APIs are used. | ||
let mockFiles = Object.create(null); | ||
|
||
// eslint-disable-next-line no-underscore-dangle, @typescript-eslint/naming-convention | ||
export function __setMockFiles(newMockFiles: Record<string, string | null>) { | ||
mockFiles = newMockFiles; | ||
} | ||
|
||
export const writeFile = vi.fn(async (filePath: string, content: string) => { | ||
mockFiles[filePath] = content; | ||
}); | ||
export const readFile = vi.fn(async (filePath: string) => mockFiles[filePath]); | ||
export const lstat = vi.fn(async (filePath: string) => ({ | ||
isFile: () => !!mockFiles[filePath], | ||
})); | ||
export const readdir = vi.fn(); | ||
export const readlink = vi.fn(); | ||
export const realpath = vi.fn(); | ||
|
||
export default { | ||
__setMockFiles, | ||
writeFile, | ||
readFile, | ||
lstat, | ||
readdir, | ||
readlink, | ||
realpath, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ import { type Call, CallStates, type ControlStates } from '@storybook/instrument | |
|
||
import { transparentize } from 'polished'; | ||
|
||
import { isTestAssertionError } from '../utils'; | ||
import { isTestAssertionError, useAnsiToHtmlFilter } from '../utils'; | ||
import { Empty } from './EmptyState'; | ||
import { Interaction } from './Interaction'; | ||
import { Subnav } from './Subnav'; | ||
|
@@ -97,6 +97,7 @@ export const InteractionsPanel: React.FC<InteractionsPanelProps> = React.memo( | |
onScrollToEnd, | ||
endRef, | ||
}) { | ||
const filter = useAnsiToHtmlFilter(); | ||
return ( | ||
<Container> | ||
{(interactions.length > 0 || hasException) && ( | ||
|
@@ -131,9 +132,12 @@ export const InteractionsPanel: React.FC<InteractionsPanelProps> = React.memo( | |
<CaughtExceptionTitle> | ||
Caught exception in <CaughtExceptionCode>play</CaughtExceptionCode> function | ||
</CaughtExceptionTitle> | ||
<CaughtExceptionStack data-chromatic="ignore"> | ||
{printSerializedError(caughtException)} | ||
</CaughtExceptionStack> | ||
<CaughtExceptionStack | ||
data-chromatic="ignore" | ||
dangerouslySetInnerHTML={{ | ||
__html: filter.toHtml(printSerializedError(caughtException)), | ||
}} | ||
Comment on lines
+137
to
+139
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. style: Use of dangerouslySetInnerHTML might pose security risks if the input is not properly sanitized |
||
></CaughtExceptionStack> | ||
</CaughtException> | ||
)} | ||
{unhandledErrors && ( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ import React from 'react'; | |
|
||
import { styled, typography } from 'storybook/internal/theming'; | ||
|
||
import { useAnsiToHtmlFilter } from '../utils'; | ||
import { Node } from './MethodCall'; | ||
|
||
const getParams = (line: string, fromIndex = 0): string => { | ||
|
@@ -59,6 +60,7 @@ export const MatcherResult = ({ | |
message: string; | ||
style?: React.CSSProperties; | ||
}) => { | ||
const filter = useAnsiToHtmlFilter(); | ||
const lines = message.split('\n'); | ||
return ( | ||
<pre | ||
|
@@ -131,7 +133,13 @@ export const MatcherResult = ({ | |
]; | ||
} | ||
|
||
return [<span key={line + index}>{line}</span>, <br key={`br${index}`} />]; | ||
return [ | ||
<span | ||
key={line + index} | ||
dangerouslySetInnerHTML={{ __html: filter.toHtml(line) }} | ||
></span>, | ||
Comment on lines
+137
to
+140
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. logic: Using dangerouslySetInnerHTML can be a security risk if the input is not properly sanitized. Ensure that the filter.toHtml() method properly escapes any potentially malicious content. |
||
<br key={`br${index}`} />, | ||
]; | ||
})} | ||
</pre> | ||
); | ||
|
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.
style: Use of dangerouslySetInnerHTML could pose a security risk if the input is not properly sanitized