-
Notifications
You must be signed in to change notification settings - Fork 674
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
CoffeeScript support (close #1556) #2651
Conversation
❌ Tests for the commit 569ed48 have failed. See details: |
Hi @GeoffreyBooth! Thank you for the great job done.
|
CoffeeScript provides a cleaner syntax that many people find easier to read. Compare this file to this file, for example. Code that’s more concise is often easier to follow, which helps lead to fewer bugs.
I want to write tests in CoffeeScript because I have an entire app written in CoffeeScript, and I want to keep all my code in the same language. I don’t think this is that uncommon of a use case. I work on a team at a big company, and we’ve written several large apps in CoffeeScript. |
@AndreyBelym Any thoughts on this? Here’s an article to help explain the state of CoffeeScript today: https://codeburst.io/why-coffeescript-is-still-alive-aeb369b91b85 Also, Cypress is written in CoffeeScript: https://github.com/cypress-io/cypress 😉 |
Hi @GeoffreyBooth, We decided to include the CoffeeScript support to testcafe. Thank you for this great pr! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @GeoffreyBooth, thank for the great job you've done! Just giving a little tip 😄
return { '.coffee': (code, filename) => this._compileCode(code, filename) }; | ||
} | ||
|
||
getSupportedExtension () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's okay to override the canCompile
method if you want to support files with different extensions, as you stated in your comment in the nodejs repository. Our Legacy API compiler does it: testcafe-legacy-api/blob/master/src/compiler/index.js#L157
@testcafe-build-bot retest |
❌ Tests for the commit 569ed48 have failed. See details: |
@testcafe-build-bot retest |
❌ Tests for the commit 569ed48 have failed. See details: |
@testcafe-build-bot retest |
❌ Tests for the commit 569ed48 have failed. See details: |
@testcafe-build-bot retest |
❌ Tests for the commit 569ed48 have failed. See details: |
…l and method as ESNextTestFileCompiler
…ently was a bug for regular JS/TypeScript too, not just for CoffeeScript)
…oking for are top-level
❌ Tests for the commit dd45f9c have failed. See details: |
@testcafe-build-bot retest |
✅ Tests for the commit dd45f9c have passed. See details: |
* CoffeeScript compiler first pass * Tests for CoffeeScript compiler * Don’t use CoffeeScript’s internal Babel to compile, use the same Babel and method as ESNextTestFileCompiler * CoffeeScript functional tests that mirror TypeScript’s * Don’t crash on variable declaration lines like `var foo;` (this apparently was a bug for regular JS/TypeScript too, not just for CoffeeScript) * Don’t use CoffeeScript safety wrapper, so that the AST nodes we’re looking for are top-level * CoffeeScript parser smoke tests; allow returns of `test` calls
Closes #1556. Adds support for CoffeeScript test files, similar to the existing TypeScript support.