-
Notifications
You must be signed in to change notification settings - Fork 0
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
Removing mock-fs promises, rewriting mock async tests #501
Conversation
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.
Several items need to be addressed before this PR can be approved:
- Update the
.gitignore
file to include the correct Yarn 2 exclusion rules (per inline comment). - Remove all of the
.yarn/cache/*.zip
and related files that would not be included based on the updated.gitignore
rules. - Update
package.json
to not include@types/mock-fs
ormemfs
(per inline comments).
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.
Two minor changes and then this PR is ready:
- Remove
.yarn/install-state.gz
from git-tracking and don't include in the PR. - Remove the
mock-fs
import statement in__test__/CanvasComponent.spec.tsx
@andrealit, looks like you missed a FAIL __test__/stacks.spec.ts
● Test suite failed to run
__test__/stacks.spec.ts:1:18 - error TS7016: Could not find a declaration file for module 'mock-fs'. '/home/runner/work/synectic/synectic/node_modules/mock-fs/lib/index.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/mock-fs` if it exists or add a new declaration (.d.ts) file containing `declare module 'mock-fs';`
1 import mock from 'mock-fs';
~~~~~~~~~ |
Description:
After removing
mock-fs
from the project, remove any uses ofmock-fs
in the test cases and replace withmock-fs-promise
. The two tests that need to be re-reviewed in the future after development areCanvasComponent.spec.tsx
andExplorer.spec.tsx
.mock-fs-promise
is an internal module that usestmp-promise
to create a temporary directory for holding all mocked filesystem objects (files, directories, and symbolic links). The API formock-fs-promise
mimics the API ofmock-fs
, but allows for consistent asynchronous access by depending on the standard Node.jsfs
(which natively supports Promises, callbacks, and async/await). Additionally, sincemock-fs-promise
is creating real files and directories, it is possible to create initialize a mocked directory as a valid git repository (see Git-Based Tests for an example of this).This PR resolves #487, and signifies the following version changes:
Changes:
This PR makes the following changes:
mock-fs
and@types/mock-fs
fromdevDependencies
.tmp-promise
todevDependencies
.mock-fs
to usemock-fs-promise
instead.Checklist:
Before submitting this PR, I have verified that my code:
fix/
orfeature/
branch that was initially branched off fromdevelopment
.yarn lint
) and unit testing (yarn test
).yarn package
).Additionally, I have verified that: