sails.js - Is it possible to lift a SailsJS app synchronously? -
it handy testing.
it avoid boilerplate of having lift app on every spec.
my current code:
beforeeach(function(done) { sails.lift({ log: { level: 'error' } }, function(err, sails) { app = sails.express.app // beforeeach related stuff done() }) }
i want put on specs_global.js
:
app = sails.lift({ log: { level: 'error' } }).express.app
edit:
my problem beign unable lift sails syncronously
the problem want instanteate sails once all specs, expensive task , want integration specs run fast possible. want avoid boilerplate of calling sails lift on each of specs files.
no, sails.load
, sails.lift
both asynchronous. you're doing right thing in test (just make sure call sails.lower
in aftereach
method). take @ current sails integration tests example of how it. keep in mind might not need lift
, lower
before each individual test--in cases might okay lift once before suite runs , use instance tests. in case, can use before
, after
instead of beforeeach
, aftereach
.
Comments
Post a Comment