Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coffee-react (cjsx) support #52

Open
spudly opened this issue Jul 6, 2015 · 2 comments
Open

coffee-react (cjsx) support #52

spudly opened this issue Jul 6, 2015 · 2 comments
Labels

Comments

@spudly
Copy link

spudly commented Jul 6, 2015

I would love to have support for coffee-react (.cjsx) files. I may even be willing to submit a pull request if someone provide some insight into how coffee-coverage works.

@jwalton
Copy link
Contributor

jwalton commented Jul 8, 2015

I would welcome a PR for sure.

The 5 mile high view of coffee-coverage is; first we use coffee-script to parse the input and generate an AST. Then we visit every node in the AST with an instrumentor which, generally, adds some extra nodes into the resulting coffee-script. Finally we compile the resulting AST out into JavaScript.

All the information about where a particular fragment of source came from is based on the locationData found in the coffee-script node.

@GeoffreyBooth
Copy link

CoffeeScript 2 includes support for CSX/JSX: http://coffeescript.org/v2/#jsx

Such a file currently chokes coffee-coverage:

~/coffeescript/node_modules/coffee-coverage/lib/coffeeCoverage.js:279
      throw new CoverageError(“Could not parse “ + fileName + “: “ + err.stack);
      ^
CoverageError: Could not parse ~/coffeescript/documentation/examples/jsx.coffee:
[stdin]:9:4: error: missing / (unclosed regex)
  </aside>
   ^
    at Object.exports._runInstrumentor (/Volumes/Geoffrey/Sites/coffeescript/node_modules/coffee-coverage/lib/coffeeCoverage.js:279:13)
    at CoverageInstrumentor.exports.CoverageInstrumentor.CoverageInstrumentor.instrumentCoffee (/Volumes/Geoffrey/Sites/coffeescript/node_modules/coffee-coverage/lib/coffeeCoverage.js:237:24)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants