-
Notifications
You must be signed in to change notification settings - Fork 45
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
multiple node_modules colision #1462
Comments
This is indeed an exciting setup! Thanks for sharing.
This was causing the issues that you are observing, because it is confusing Jest (when ran by Wallaby). You also don't need to include any
No changes from our side are required. You may just tell Jest (when running from wallaby) how to resolve This is the only/most important change(s) that you really need. Other than that, you may clean up your I have sent you 2 PRs with config changes: So your process.env.BABEL_ENV = "test"
process.env.ENZYME = true
process.env.NODE_ENV = "TESTING"
module.exports = (wallaby) => {
return {
debug: true,
testFramework: 'jest',
files: [
'mobileClient/**/*.js',
'!mobileClient/node_modules/**',
'server/src/**/*.js',
'!server/src/**/*.spec.js',
'testing/testHelpers/**/*.js',
'testingMobile/**/*.snap'
],
tests: [
'testingMobile/App.test.js',
],
compilers: {'**/*.js': wallaby.compilers.babel()},
env: {type: 'node'},
setup: function (wallaby) {
process.env.NODE_PATH = '';
const jestConfig = require('./package.json').jest;
jestConfig.moduleDirectories = [
'node_modules', '<rootDir>/server/node_modules', '<rootDir>/mobileClient/node_modules'
];
wallaby.testFramework.configure(jestConfig);
}
}
}; and your process.env.BABEL_ENV="test"
process.env.ENZYME=true
process.env.NODE_ENV="TESTING"
module.exports = (wallaby) => {
return {
debug: true,
testFramework: 'jest',
files: [
'client/src/**/*.js',
'client/tests/testHelpers/**/*.js',
'!client/src/**/*.test.js',
'server/src/**/*.js',
'!server/src/**/*.spec.js',
'cypress/integration/pageObjects/*.js',
'testing/testHelpers/**/*.js',
'clientEnzymeTest.json'
],
tests: [
'cypress/integration/landingPage.test.js',
],
compilers: {'**/*.js': wallaby.compilers.babel()},
env: {type: 'node'},
setup: function (wallaby) {
const jestConfig = require('./clientEnzymeTest');
jestConfig.moduleDirectories = [
'node_modules', '<rootDir>/server/node_modules', '<rootDir>/client/node_modules'
];
wallaby.testFramework.configure(jestConfig);
}// --config ./clientEnzymeTest.json
}
}; |
Awesome, try the config changes above, it should work. If you mention Wallaby in some article/blog/video describing this setup, please let us know, would love to check it out! |
Great! They all start up separately now. So looks like this will be possible to have set up properly :-) As always - thanks for a best-class support! I still have problems though:
If I run web first and then mobile it complaines about missing jquery mobile first, and then server, the server complains about
Which it shouldn't even load. With server first and then web: I initially get no errors in web (but server side tests stop to reload when I change the resolvers (server/src/api/resolvers.js , test for them are in resolvers-graphql.spec.js in the same folder), and I see errors in the log:
client test is in: cypress/integration/landingPage.test.js mobile: testingMobile/App.test.js They all work properly separately. Which suggests to me that there is some kind of a collision between wallabyjs caches? Also, do I even get this right, even if they started up, would I be able to see separate columns of dots there? (on the server, for example, I would expect to see three - one from the server unit tests, one from the mobile integration tests and one from the web integration tests. I would also expect to reload all three kind of tests when I change my graphql resolvers) |
Wallaby doesn't support (never had) running multiple configurations within one IDE instance. Apart from a lot of complexity that such behaviour implementation would bring, there's also a few things to consider regarding merging/isolating feedback/coverage from different configurations. Having said that, if you're able to open multiple IDE windows with the same project, you should be able to start each wallaby config in each window (however I'm not sure if it's possible to open the same project in different WebStorm instances). |
shoot :-) this would be mind blowing if it worked.. Our goal here is to have a starter of a react-native (expo)/react(create-react-app)/graphql-express server with everything set up and connected some example tests and wallaby configured, with bare minimum, and also a real-life example of a medium-sized app ( https://thebrain.pro ) to give people an understanding of how to structure and do more advanced things (like how to sue fb login, notifications on mobile, or optimistic ui with graphql, etc) . |
The other way of having this to work would be to use jest to run tests with multiple configs.. Or, maybe this is something wallabyjs could do itself? To run all those tests using one wallaby config? |
Thanks for sharing your plans and for your offer. It would be really good to have the feature working for your project, as well as for other multi-config projects, such as full stack JS apps with front end plus node server.
The team is fully occupied right now and for the next few months, but we are planning to expand the team later this year, so while I can't make any promises, we'll definitely consider implementing the feature and offer to help.
… On 14 Jan 2018, at 5:01 pm, Łukasz Gandecki ***@***.***> wrote:
shoot :-) this would be mind blowing if it worked..
Is there any chance we could help prioritizing this feature by "sponsoring" it? I see there were a few good suggestions in the post you linked.
For now we could get away with running wallaby for what we are directly working with, but long term the usability would be much better and more convincing..
Our goal here is to have a starter of a react-native (expo)/react(create-react-app)/graphql-express server with everything set up and connected some example tests and wallaby configured, with bare minimum, and also a real-life example of a medium-sized app ( https://thebrain.pro ) to give people an understanding of how to structure and do more advanced things (like how to sue fb login, notifications on mobile, or optimistic ui with graphql, etc) .
I hope this would also convince more people to get your product :)
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I think Jest supports with the |
looks like projects would work indeed - is this something that would be easier to implement with wallabyjs then multi-wallabyjs functionality? |
Will need to investigate, it may be easier than implementing multiple running configurations feature. |
I just had a moment and made our repo work with jest projects, pretty cool stuff, here is what I had to change: basically I run the tests with the projects are paths to the directories that have jest.config.js inside them, and setup the test execution for tests found in that particular folder. I thought I'd share in case you wanted a playground to investigate this. There is no rush, but if you had a chance to put a few hours into this during the next week or so that would be fantastic! |
Issue description or question
When I have a structure:
And I add the node_modules to NODE_PATH like this:
I get errors.. while jest works.
(some background, feel free to skip @ArtemGovorov but I hope this will get you as excited about the possibility and wow factor here as we are :-) )
We've been building an example application that's a monorepo of decoupled apps, but where
With a single package, when I was not reusing the server files to mock the graphql server on the web/mobile clients I was able to have fantastic, mind-blowing tests of type 2 (meaning, I have cypress e2e and also jest/enzyme tests with wallaby passing, I change something in one test file in wrong way - they both fail, also, when I change something in my script, they both fail and turn green in the same times.) It's easier to show than to explain and we are preparing to do just that in early Febraury, but we do want to give a huge shotout to wallabyjs there, if we can get this piece to work :)
In general - what this means, almost-end to end tests (with graphql server and in memory database, with no state shared between tests!) with wallaby, and immediate feedback. :) The only thing we are not testing here is whether the server can connect to the express server properly, and the way passport does the authorization, for that we will have a full-run e2e test that works on a unmocked client, running server, and real db running in a background. This will just ensure that everything is glued properly together, most of the other stuff is either pure logic, or frontend orchestration (like changing state/routes etc)
(/background)
Repro:
(they both should be green, as for circle build: https://circleci.com/gh/TheBrainFamily/TheBrain2.0/1009 )
and then use either wallaby-mobile.js or wallaby-web.js to see the problems
My guess is that all node_modules are treated as being on "the same level", so when I do require("graphql") in server/ and I included client/node_modules first (that also include graphql), it resolves the graphql from client/node_modules instead of server/node_modules causing some issues. Would there be any way to resolve node_modules in a way that honors the path of the file that does the require/import? How difficult is this?
Please let us know if there is any chance of having this supported in the next few weeks! I'm happy to help with any way I can. I actually made this prematurely open source just so you can play around with it.
Wallaby.js configuration file
https://github.com/TheBrainFamily/TheBrain2.0/blob/wallabyIssue/wallaby-mobile.js
https://github.com/TheBrainFamily/TheBrain2.0/blob/wallabyIssue/wallaby-web.js
Code editor or IDE name and version
WebStorm
OS name and version
OSX
The text was updated successfully, but these errors were encountered: