You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following errors occur when using NodeJS version 20.5.0 or above:
FAIL lib/core-common/src/utils/__tests__/template.test.ts
● server.getPreviewHeadHtml › when .storybook/preview-head.html does not exist › return an empty string
ENOENT: no such file or directory, open 'undefined/templates/base-preview-head.html'
26 | interpolations?: Record<string, string>
27 | ) {
> 28 | const base = fs.readFileSync(`${sync(__dirname)}/templates/base-preview-head.html`, 'utf8');
| ^
29 | const headHtmlPath = path.resolve(configDirPath, 'preview-head.html');
30 |
31 | let result = base;
at readFileSync (src/utils/template.ts:28:19)
at Object.<anonymous> (src/utils/__tests__/template.test.ts:24:44)
● server.getPreviewHeadHtml › when .storybook/preview-head.html exists › return the contents of the file
ENOENT: no such file or directory, open 'undefined/templates/base-preview-head.html'
26 | interpolations?: Record<string, string>
27 | ) {
> 28 | const base = fs.readFileSync(`${sync(__dirname)}/templates/base-preview-head.html`, 'utf8');
| ^
29 | const headHtmlPath = path.resolve(configDirPath, 'preview-head.html');
30 |
31 | let result = base;
at readFileSync (src/utils/template.ts:28:19)
at Object.<anonymous> (src/utils/__tests__/template.test.ts:44:44)
● server.getPreviewBodyHtml › when .storybook/preview-body.html does not exist › return an empty string
ENOENT: no such file or directory, open 'undefined/templates/base-preview-body.html'
10 | interpolations?: Record<string, string>
11 | ) {
> 12 | const base = fs.readFileSync(`${sync(__dirname)}/templates/base-preview-body.html`, 'utf8');
| ^
13 |
14 | const bodyHtmlPath = path.resolve(configDirPath, 'preview-body.html');
15 | let result = base;
at readFileSync (src/utils/template.ts:12:19)
at Object.<anonymous> (src/utils/__tests__/template.test.ts:64:44)
● server.getPreviewBodyHtml › when .storybook/preview-body.html exists › return the contents of the file
ENOENT: no such file or directory, open 'undefined/templates/base-preview-body.html'
10 | interpolations?: Record<string, string>
11 | ) {
> 12 | const base = fs.readFileSync(`${sync(__dirname)}/templates/base-preview-body.html`, 'utf8');
| ^
13 |
14 | const bodyHtmlPath = path.resolve(configDirPath, 'preview-body.html');
15 | let result = base;
at readFileSync (src/utils/template.ts:12:19)
at Object.<anonymous> (src/utils/__tests__/template.test.ts:84:44)
This is because of this issue in mock-fs. Short version: NodeJS added an optimisation in 20.5.0 where reading a UTF-8 file uses a dedicated fast path. This breaks mock-fs.
samvv
changed the title
ENOENT: no such file or directory, open 'undefined/templates/base-preview-head.html'
[Bug]: ENOENT: no such file or directory, open 'undefined/templates/base-preview-head.html'
Nov 20, 2023
Describe the bug
The following errors occur when using NodeJS version 20.5.0 or above:
This is because of this issue in mock-fs. Short version: NodeJS added an optimisation in 20.5.0 where reading a UTF-8 file uses a dedicated fast path. This breaks mock-fs.
To Reproduce
yarn test
in the project rootSystem
Additional context
Still trying to work on issue #11486.
The text was updated successfully, but these errors were encountered: