[WIP] experimental implementation for enzyme and react #834
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is a goal:
We want to have component tests for React in the same maner as selenium tests.
What's is included in this PR:
compilers
andrequire
. This should solve these issues: Coffeescript support #474 [ Question ] How to get babel working to support imports? #370--transpile
. When it's true, then transpiled code will process without issues. And also React components will displays correctly in test stdout.How to run it:
enzyme
enzyme-adapter-react-16
jsdom
react-element-to-string
sinon
babel-polyfill
babel-core
esprima
escodegen
and install them.
.babelrc
file to store babel settings. If you are using webpack aliases in your project you also have to installbabel-plugin-webpack-aliases
:e.g.
create run script in package.json. E.g.:
codeceptjs run --transpile --compilers js:babel-core/register,js:babel-polyfill
In my case there are some css styles imports in project. They can't be traspiled by babel automaticly. In our project it's webpack job, so we have to emulate this imports. To do this I create a special js file:
and add it to codeceptjs run script:
codeceptjs run -R mocha-multi --transpile --compilers js:babel-core/register,js:babel-polyfill,css:./tests/helper
So next steps for this: