I have a problem when using cypress.io with CoffeeScript. The tests fail with the following exception:
describe('testFn', function() {
^
ParseError: reserved word "function"
Code:
describe 'testFn', () ->
it 'testIt', () ->
# a test
CoffeeScript is supported by cypress.io as show in the documentation
I have the cypress.io dependency installed and I have tried using it with the @cypress/coffee-script package but it does not seem to work.
package.json:
...
"cypress": "^1.0.3",
"@cypress/coffee-script": "^0.1.2",
...
The tests do run when using .js files that have the transpiled CoffeeScript code:
describe('testFn', function() {
return it('testIt', function() {
expect(true).to.equal(true);
});
});
What could be the issue here?
Cypress tests definitely work in CoffeeScript. As a developer at Cypress, I know because we write almost all of our own Cypress tests in CoffeeScript.
That being said, if you are using CoffeeScript 2, this is not supported (but is coming soon ).
You shouldn't need to include our internal @cypress/coffee-script
package. We only have this as a dependency for our own project, so that each piece of our application can share the same CoffeeScript version.
My suggestions at the moment:
.coffee
The test code below should work if you copy/paste it:
describe 'testFn', () ->
it 'testIt', () ->
expect(true).to.equal(true)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.