问题
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