Keystone.js Framework Tips (2)


1. Test in keystone.js

I use Mocha as test runner to tell what passes and fails, and Chai for assertion or should libraries to run specific tests.!topic/keystonejs/AvpvUpHNTn0

process.env.NODE_ENV = process.env.NODE_ENV || 'test';

var keystone = require('keystone');
var chai = require('chai');
var dbURI = process.env.MONGO_URL

  'name': 'Post Model Test',
  's3 config': {} //has to be set, but isn't used in our models

var Post = null;



describe('Posts', function() {
    if (keystone.mongoose.connection.db) return done();
    console.log('Connecting to ' + dbURI)
    keystone.mongoose.connect(dbURI, done);

  it('should be a connection to Mongo', function(done){'Object');

  it('should be a Mongoose Model', function(done) {
    Post = keystone.list('Post');'Object');'model').be.a('Function');'schema').be.a('Object');


2. create a gap between tr (table rows)

table {
    border-collapse: separate;
    border-spacing: 0 15px;

3.Keystone JS CMS Deployment error: cannot find module ‘../build/release/bson’ code ‘module_not_found’


root@keystonejs:~# npm install -g npm-check-updates

debian@keystonejs:~/myproject/manalcjim$ npm-check-updates -u

debian@keystonejs:~/myproject/manalcjim$ npm install

Donate $5 to me for a coffee with PayPal and read more professional and interesting technical blog articles. Feel free to visit my web app, WhizWallet, to apply for credit, store or gift cards, DealsPlus to browse daily deals and store coupons to save money.
Follow me @Yaoli0615 at Twitter to get latest tech updates.


A Smarter Way to Learn JavaScript. The new tech-assisted approach that requires half the effort

Secrets of the JavaScript Ninja

Node.js Design Patterns

Web Development with MongoDB and NodeJS

Node.js the Right Way: Practical, Server-Side JavaScript That Scales

Web Development with Node and Express: Leveraging the JavaScript Stack

Learn NodeJS in 1 Day: Complete Node JS Guide with Examples

Learning Node: Moving to the Server-Side

Getting MEAN with Mongo, Express, Angular, and Node


About liyao13

Yao Li is a web and iOS developer, blogger and he has a passion for technology and business. In his blogs, he shares code snippets, tutorials, resources and notes to help people develop their skills. Donate $5 to him for a coffee with PayPal at About Me page and read more professional and interesting technical blog articles. Follow him @Yaoli0615 at Twitter to get latest tech updates.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s