Skip to content
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

[DX-296] Mocks can have the same signature as real plugins #794

Merged
merged 2 commits into from Dec 20, 2017
Merged

Conversation

matteofigus
Copy link
Member

@matteofigus matteofigus commented Dec 20, 2017

This allows a plugin to have, apart from the simplified signature (exporting a synchronous execution function) a regular signature (similar to the real plugins) with an exported asynchronous register() function and a synchronous exported execute() function.

This is part of a bigger work to allow mocks to be more usable and possibly wrapping the whole real plugin - for better local DX and testing.

PS
In case of plugin initialisation error, I improved the error message providing some code snippets for modelling a mock with the correct signature:
screen shot 2017-12-20 at 15 26 51

Copy link
Contributor

@nickbalestra nickbalestra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work, just a very small neatpick. Im going to approve it as its just a neatpick, I'll leave it to you

.join('/');
},
parentDir = pathToResolve ? getParent(pathToResolve) : rootDir;
const getParent = x =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think is never too bad to name things for what they are: pathToResolve or similar in this case instead of x

@matteofigus matteofigus merged commit 9362e7e into master Dec 20, 2017
@matteofigus matteofigus deleted the mocks branch December 20, 2017 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants