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
- Move @css-blocks/build => @css-blocks/test-utils.
- Move @css-blocks/test-utils to devDependencies in JSX integration.
- Clean up exports API of test-utils so we don't need deep requires.
- Clean up typings of mock function in test-utils so we don't need Object.apply.
- Add README for test-utils.
- Rename transient-fs to mock-fs.
- Move _files and _directories private properties to truly private module scoped contants.
# Shared Test Utilities for `@css-blocks` Packages
2
+
3
+
These utilities are only used in the @css-blocks tests, so this package is not published.
4
+
5
+
## `import { mock } from @css-blocks/test-utils`
6
+
7
+
The `mock` utility provides tests the ability to temporarily mocks files on the filesystem. Works for all supported versions of Node.js. Once mocked, files generated using `mock` can be accessed like regular files by all Node.js filesystem calls.
8
+
9
+
You can mock files using the following API:
10
+
11
+
```js
12
+
mock({
13
+
'filename.js':'file-contents',
14
+
'foldernames': {
15
+
'can': {
16
+
'nest': {
17
+
'file.css':'file-contents'
18
+
}
19
+
}
20
+
}
21
+
});
22
+
```
23
+
24
+
To clean up all mocked filesystem files and directories when done, simply call:
0 commit comments