Search code examples
node.jsexpressgzipzombie.jsnode.js-connect

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


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?


Solution

  • 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.