I'm encountering a problem when it comes to unit testing in Angular using Angular-Mocks, Jasmine, and CoffeeScript.
The issue lies within this code snippet:
'use strict'
describe 'sample suite', ->
beforeEach inject(($rootScope, $compile) ->
scope = $rootScope.$new()
)
it 'should be true', ->
expect('foo').toBe('foo')
It triggers an error in Angular
debug.html:37 Error: [ng:areq] Argument 'fn' is not a function, got Object
.
On the other hand, the following code works smoothly:
'use strict'
describe 'sample suite', ->
beforeEach ->
sample = 'test'
it 'should be true', ->
expect('foo').toBe('foo')
This indicates that the usage of the global inject()
angular-mocks method doesn't align properly with the CoffeeScript compiler.
Unfortunately, concluding the beforeEach
block with return
doesn't resolve the issue.
Any assistance on this matter would be greatly appreciated.