Express.js and Zombie.js - Can't seem to parse Javascript assets

若如初见. 提交于 2019-12-25 05:23:43

问题


I have an Express.js app that uses connect-asssets to serve JS and CSS:

app.configure(function() {
    app.set('port', 3000);
    app.set('views', path.join(__dirname, 'views'));
    app.set('view engine', 'ejs');
    app.use(connectAssets({src: path.join(__dirname, 'assets')}));
});

I'm trying to use Zombie.js for acceptance testing, but keep getting SyntaxError: Unexpected token ILLEGAL whenever it tries to parse a Javascript file. If I replace connect-assets with express.static, then the acceptance tests work perfectly.

Any idea what connect-assets does differently that would trip up Zombie.js?


回答1:


So I ran the requests through Charles. Zombie sends the request header Accept-Encoding: identity, but connect-assets returns GZIP data anyway.

I raised an issue with connect-file-cache on Github, hopefully everything will run fine once this is fixed.



来源:https://stackoverflow.com/questions/12700152/express-js-and-zombie-js-cant-seem-to-parse-javascript-assets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!