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

CoffeeScript support (close #1556) #2651

Merged
merged 7 commits into from
Aug 10, 2018
Merged

Conversation

GeoffreyBooth
Copy link
Contributor

Closes #1556. Adds support for CoffeeScript test files, similar to the existing TypeScript support.

@testcafe-build-bot
Copy link
Collaborator

❌ Tests for the commit 569ed48 have failed. See details:

@AndreyBelym
Copy link
Contributor

Hi @GeoffreyBooth! Thank you for the great job done.
Could you please take a moment to help us better understand what this feature will give us. Nobody in our team has ever worked with CoffeeScript closely, so please clarify some points:

  • Which features are important for you in CofeeScript that can't be found in ES6 and TypeScript?

  • Do you believe there will be many TestCafe users who would prefer to write E2E tests using the CoffeeScript syntax? Have you heard from any of your colleagues or acquaintances about such a desire?

@GeoffreyBooth
Copy link
Contributor Author

Which features are important for you in CoffeeScript that can’t be found in ES6 and TypeScript?

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.

Do you believe there will be many TestCafe users who would prefer to write E2E tests using the CoffeeScript syntax? Have you heard from any of your colleagues or acquaintances about such a desire?

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.

@GeoffreyBooth
Copy link
Contributor Author

@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 😉

@kirovboris
Copy link
Collaborator

Hi @GeoffreyBooth,

We decided to include the CoffeeScript support to testcafe. Thank you for this great pr!
@AndreyBelym will review your changes soon and assist with it.

Copy link
Contributor

@AndreyBelym AndreyBelym left a 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 () {
Copy link
Contributor

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

@miherlosev
Copy link
Collaborator

@testcafe-build-bot retest

@miherlosev miherlosev changed the title CoffeeScript support CoffeeScript support (close #1556) Aug 9, 2018
@testcafe-build-bot
Copy link
Collaborator

❌ Tests for the commit 569ed48 have failed. See details:

@miherlosev
Copy link
Collaborator

@testcafe-build-bot retest

@testcafe-build-bot
Copy link
Collaborator

❌ Tests for the commit 569ed48 have failed. See details:

@miherlosev
Copy link
Collaborator

@testcafe-build-bot retest

@testcafe-build-bot
Copy link
Collaborator

❌ Tests for the commit 569ed48 have failed. See details:

@miherlosev
Copy link
Collaborator

@testcafe-build-bot retest

@testcafe-build-bot
Copy link
Collaborator

❌ Tests for the commit 569ed48 have failed. See details:

@testcafe-build-bot
Copy link
Collaborator

❌ Tests for the commit dd45f9c have failed. See details:

@miherlosev
Copy link
Collaborator

@testcafe-build-bot retest

@testcafe-build-bot
Copy link
Collaborator

✅ Tests for the commit dd45f9c have passed. See details:

@miherlosev miherlosev merged commit b00671b into DevExpress:master Aug 10, 2018
@GeoffreyBooth GeoffreyBooth deleted the gh1556 branch August 10, 2018 17:35
kirovboris pushed a commit to kirovboris/testcafe-phoenix that referenced this pull request Dec 18, 2019
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants