Skip to content

Weird behavior when using Facebook's Jest and the gorillascript compiler. #3

@sterpe

Description

@sterpe

This seems to be an subtle issue related to the gorillascript compiler and Jest:

Using node 0.12.x
Modifying the documentation here to support gorillascript: https://facebook.github.io/jest/docs/tutorial-coffeescript.html#content

Assume a jest-cli-prepocessor file like this:

var gorilla = require('gorillascript');

exports.process = function (src, path) {
    if (/\.(gs|gorilla)$/.test(path)) {
        // This works if the file extension is '.gorilla' but not if the extension is '.gs'
                // I would think this is a Jest issue except that if I rename random coffeescript files to .gs extensions
                // then do:
                //            return coffee.compile(src, { "bare": true });
                // instead, then everything works as one would expect
               return gorilla.compile(src, {
            "bare": true
        }).code;
    }
    return src;
};

The behavior is really inexplicable to me, since seemingly there is no relationship to the file path in the above code, but nonetheless.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions