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 razzle test command #270

Closed
jaredpalmer opened this issue May 19, 2017 · 8 comments
Closed

Add razzle test command #270

jaredpalmer opened this issue May 19, 2017 · 8 comments

Comments

@jaredpalmer
Copy link
Owner

No description provided.

@auser
Copy link

auser commented May 27, 2017

Yes... this would be nice. I'm struggling to get my tests running.

More specifically, my jest command explodes (when using typescript) on the line:

const assets = require(process.env.RAZZLE_ASSETS_MANIFEST);

The error (specifically) is TypeError: Cannot read property '0' of undefined, which appears to me to be trouble pulling off RAZZLE_ASSETS_MANIFEST.

@auser
Copy link

auser commented May 27, 2017

For future:

I solved this locally by using this line:

const assets = env === 'test' ? {} : require(process.env.RAZZLE_ASSETS_MANIFEST)

@jaredpalmer
Copy link
Owner Author

Why are you testing the server with jest in the first place?

@auser
Copy link

auser commented May 28, 2017

Why not? It's a fine test runner and then server-side and client-side are matched with technology. Plus jasmine (the assertion framework) doesn't care. I'm interested to know what the opposition viewpoint is...

@jaredpalmer
Copy link
Owner Author

I guess I could have been a bit more specific here....

I love Jest for testing Node API's. It's fantastic.

My suggestion, however, is that you not use Razzle to serve your API / do things with your DB directly. You should do that on a separate server and communicate with it over HTTP or GraphQL.

@auser
Copy link

auser commented May 28, 2017 via email

@jaredpalmer
Copy link
Owner Author

jaredpalmer commented May 28, 2017

We use Mongo or Dynamo for almost everything. While we don't use Node.js on the backend in production anymore, on some of my Node.js side projects, I use my own DAO layer that looks like this: https://gist.github.com/jaredpalmer/5e5617f2aac34c468938d1728906f16e .

@auser
Copy link

auser commented May 28, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants