我有这种摩卡测试:
describe 'sabah', ?
beforeEach ?
@sabahStrategy = _.filter(@strats, { name: 'sabah2' })[0]
.strat
it 'article list should be populated', (done) ?
@timeout 10000
strat = new @sabahStrategy()
articles = strat.getArticleStream('barlas')
articles.take(2).toArray( (result)?
_.each(result, (articleList) ?
// I make the assertions here
// assert(false)
assert(articleList.length > 1)
)
done()
)
Run Code Online (Sandbox Code Playgroud)
问题是,无论什么时候assert(false),测试都会挂起,直到超时,而不是给出断言错误,为什么?
编辑:
例如,如果我有这两个测试
it 'assert false', (done) ?
assert(false)
done()
it 'article link stream should be populated', (done) ?
@timeout 20000
articles = @sabahStrategy.articleLinkStream('barlas')
articles.pull((err, result)?
console.log('here')
assert(false) …Run Code Online (Sandbox Code Playgroud) 这是来自angularjs卫星示例的快速路线,通过Twitter实施3腿OAuth:
/*
|--------------------------------------------------------------------------
| Login with Twitter
|--------------------------------------------------------------------------
*/
app.get('/auth/twitter', function(req, res) {
var requestTokenUrl = 'https://api.twitter.com/oauth/request_token';
var accessTokenUrl = 'https://api.twitter.com/oauth/access_token';
var authenticateUrl = 'https://api.twitter.com/oauth/authenticate';
if (!req.query.oauth_token || !req.query.oauth_verifier) {
var requestTokenOauth = {
consumer_key: config.TWITTER_KEY,
consumer_secret: config.TWITTER_SECRET,
callback: config.TWITTER_CALLBACK
};
// Step 1. Obtain request token for the authorization popup.
request.post({ url: requestTokenUrl, oauth: requestTokenOauth }, function(err, response, body) {
var oauthToken = qs.parse(body);
var params = qs.stringify({ oauth_token: oauthToken.oauth_token });
// Step 2. Redirect to the …Run Code Online (Sandbox Code Playgroud) 我有一个新的ember-cli v.0.1.2应用程序.我在虚拟框中提供ember,并通过Host-Only配置的网络适配器从主机访问网页192.168.56.102.
当我ember serve从虚拟框运行并192.168.56.102从主机访问时,我在控制台上收到以下错误:
[Report Only] Refused to load the script 'http://192.168.56.102:35729/livereload.js?snipver=1' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval' localhost:35729 0.0.0.0:35729".
ember-cli-live-reload.js:5 (anonymous function)
livereload.js?snipver=1:193 [Report Only] Refused to connect to 'ws://192.168.56.102:35729/livereload' because it violates the following Content Security Policy directive: "connect-src 'self' ws://localhost:35729 ws://0.0.0.0:35729".
Run Code Online (Sandbox Code Playgroud)
我尝试了使用ember-cli-content-security-policy的各种配置而没有运气:
contentSecurityPolicy: {
'default-src': "'none'",
'script-src': "'self'",
'font-src': "'self'",
'connect-src': "'self'",
'img-src': "'self'",
'style-src': "'self'",
'media-src': "'self'"
}
Run Code Online (Sandbox Code Playgroud)
如何为虚拟盒开发解决这些错误?
编辑 …
node.js ×2
angularjs ×1
emacs ×1
ember.js ×1
highland.js ×1
javascript ×1
mocha.js ×1
oauth ×1
session ×1
tdd ×1
virtualbox ×1