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

Add tests for server side rendering of Soy and JSX components #269

Merged
merged 6 commits into from
Oct 11, 2017

Conversation

robframpton
Copy link

@robframpton robframpton commented Oct 3, 2017

Note: the tests on this branch will fail until the following branches are merged.

#264
#265
#266

This branch adds the private metal-isomorphic package for the purpose of testing server side rendering of components. It's only intention is to add tests that can leverage from the lerna environment, which is why the private flag has been set to true.

@robframpton robframpton force-pushed the iso_test branch 4 times, most recently from 9539473 to 7d9fea0 Compare October 6, 2017 16:08
@robframpton robframpton changed the title Add test for rendering JSXComponent server side Add tests for server side rendering of Soy and JSX components Oct 9, 2017
@jbalsas
Copy link
Contributor

jbalsas commented Oct 10, 2017

Sounds good, I added some comments on #264 and #265!

.babelrc Outdated
@@ -0,0 +1,3 @@
{
"presets": ["es2015"]
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 es2015 has been deprecated for a while in favor of env... could we try using it instead?

@@ -102,6 +102,12 @@ gulp.task('soy', function() {
.pipe(gulp.dest('packages/metal-soy/test'));
});

gulp.task('soy:isomorphic', function() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need gulp for this? Since we're invoking it from npm run can't we simply call metalsoy?

Copy link
Author

Choose a reason for hiding this comment

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

That's what I did at first, unfortunately this repo still uses an older version of metal-tools-soy, and updating it to the version that included the cli caused some issues.

Once this is merged I'd like to update it, resolve the issues, and remove whatever gulp tasks we can.

Copy link
Contributor

Choose a reason for hiding this comment

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

fair enough!

"metal-component": "^2.13.2",
"metal-jsx": "^2.13.2",
"metal-soy": "^2.13.2"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't we missing devDependencies here? (I know it's probably picked by lerna, but it feels weird, not sure if that's how it's supposed to be :) )

Copy link
Author

Choose a reason for hiding this comment

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

Well, since the tests aren't actually run from this package, it will only add bloat to lerna bootstrap since the devDependencies in this package wouldn't be used. I can see why it looks a little confusing though, do you want to add mocha and the other test dependencies here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good, if that's what we're also doing in other projects... we need to converge all the monorepos' infrastructure :)

import Component from 'metal-component';
import MyComponent from './fixtures/MyComponent';
import MyJSXComponent from './fixtures/MyJSXComponent';
import { assert } from 'chai';
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't we rather use jest snapshots here? Since we're already using it in other places and we won't be testing this on browsers... that way we have the same test dep everywhere.

Copy link
Author

Choose a reason for hiding this comment

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

Sure we can do that.

Copy link
Author

Choose a reason for hiding this comment

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

Do you think we can make that improvement down the line? There are a lot of places in this repo that we could be using jest snapshots, it would be nice to do that migration all at once under a separate issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, we can do that

@robframpton robframpton changed the base branch from master to develop October 10, 2017 16:25
@jbalsas
Copy link
Contributor

jbalsas commented Oct 11, 2017

This LGTM, then, just waiting on #274 to retest.

@robframpton
Copy link
Author

Waiting on #274 to rebase this branch, as it will cause more conflicts.

@robframpton
Copy link
Author

Note: I added 4c2a707 since we decided to not go with #265. Apparently that shim was also allowing Component to work server side.

@jbalsas
Copy link
Contributor

jbalsas commented Oct 11, 2017

Awesome!!! All is green!!! 🎉

As I mentioned, my only concern right now is that testing jumps from 6-8 minutes to 13-15 on this PR, so I'd like to see if we can figure out why. Could you take a look?

@robframpton
Copy link
Author

It's retesting right now, but I suspect it's because Edge is hanging for some reason.

@robframpton
Copy link
Author

@jbalsas Edge didn't hang in the retest, and the time was significantly shorter.

@jbalsas jbalsas added this to the 2.14.0 milestone Oct 11, 2017
@jbalsas
Copy link
Contributor

jbalsas commented Oct 11, 2017

Merging then!! 🎉

@jbalsas jbalsas merged commit cfe20c6 into metal:develop Oct 11, 2017
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.

2 participants