I have a barebones spec written in coffeescript:
# test/foobar.spec.coffee
describe "falsy test", ->
it "should fail", ->
expect(true).toBe false
when I run jasmine-node --coffee test/foobar.spec.coffee
from the project directory, I get the following error:
Exception loading: /Users/myuser/programming/project/test/foobar.spec.coffee
{ [Error: Cannot find module '/Users/myuser/programming/project/test/foobar.spec'] code: 'MODULE_NOT_FOUND' }
I am using:
node --version
v0.10.8
jasmine-node --version
1.13.0
Does anyone know why this is happening?
I had a similar problem with other packages (require, supertest). It seems that if you install them globally (npm install -g) than you get this error. With a local installation (without -g option) everything seems to be normal.
I encountered this error in a weird way.
The following code works,
function someFunc(){
//do something
}
describe(testCases.testCaseRegister.name, async function(){
someFunc();
//ensure ample time for database to be setup properly
await new Promise(done => setTimeout(done, 5000));
}
But when i changed to this, the error will appear and occasionally, a "Syntax Error: await is only valid in async function"
function someFunc(){
//do something
await new Promise(done => setTimeout(done, 5000));
}
describe(testCases.testCaseRegister.name, async function(){
someFunc();
}
Switching back to my original code, resolved all these errors.
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.