Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
See original GitHub issueI run npm run test
in terminal, but I encountered error below, I don’t know what does the error mean, how could I do?
Actual behaviour
> vue2-project@1.0.0 test /Users/gengliming/Desktop/vue2-project
> npm run unit
> vue2-project@1.0.0 unit /Users/gengliming/Desktop/vue2-project
> karma start test/unit/karma.conf.js --single-run
04 11 2016 19:32:48.962:INFO [karma]: Karma v1.3.0 server started at http://localhost:9876/
04 11 2016 19:32:48.965:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
04 11 2016 19:32:48.970:INFO [launcher]: Starting browser PhantomJS
04 11 2016 19:32:49.727:INFO [PhantomJS 2.1.1 (Mac OS X 0.0.0)]: Connected on socket /#2CXoJv9uwmam8iCsAAAA with id 47647179
LOG LOG: '552a0d2a68b89f6e13d0e07d71f831cd1797e7cd89'
ERROR LOG: 'Unhandled promise rejection', TypeError{stack: 'http://localhost:9876/base/index.js?27a36bfdace53b5f11dc9ece93feea32e45ab5c8:9719:2397
Promise@http://localhost:9876/base/index.js?27a36bfdace53b5f11dc9ece93feea32e45ab5c8:1706:16
getAuthUserInfo@http://localhost:9876/base/index.js?27a36bfdace53b5f11dc9ece93feea32e45ab5c8:9719:2276
http://localhost:9876/base/index.js?27a36bfdace53b5f11dc9ece93feea32e45ab5c8:173:27
attemptAsync@http://localhost:9876/absolute/Users/gengliming/Desktop/vue2-project/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?916005cc407925f4764668d61d04888d59258f5d:1980:28
run@http://localhost:9876/absolute/Users/gengliming/Desktop/vue2-project/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?916005cc407925f4764668d61d04888d59258f5d:1935:21
execute@http://localhost:9876/absolute/Users/gengliming/Desktop/vue2-project/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?916005cc407925f4764668d61d04888d59258f5d:1923:13
queueRunnerFactory@http://localhost:9876/absolute/Users/gengliming/Desktop/vue2-project/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?916005cc407925f4764668d61d04888d59258f5d:714:42
execute@http://localhost:9876/absolute/Users/gengliming/Desktop/vue2-project/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?916005cc407925f4764668d61d04888d59258f5d:371:28
fn@http://localhost:9876/absolute/Users/gengliming/Desktop/vue2-project/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?916005cc407925f4764668d61d04888d59258f5d:2579:44
attemptAsync@http://localhost:9876/absolute/Users/gengliming/Desktop/vue2-project/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?916005cc407925f4764668d61d04888d59258f5d:1980:28
run@http://localhost:9876/absolute/Users/gengliming/Desktop/vue2-project/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?916005cc407925f4764668d61d04888d59258f5d:1935:21
execute@http://localhost:9876/absolute/Users/gengliming/Desktop/vue2-project/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?916005cc407925f4764668d61d04888d59258f5d:1923:13
queueRunnerFactory@http://localhost:9876/absolute/Users/gengliming/Desktop/vue2-project/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?916005cc407925f4764668d61d04888d59258f5d:714:42
fn@http://localhost:9876/absolute/Users/gengliming/Desktop/vue2-project/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?916005cc407925f4764668d61d04888d59258f5d:2564:31
attemptAsync@http://localhost:9876/absolute/Users/gengliming/Desktop/vue2-project/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?916005cc407925f4764668d61d04888d59258f5d:1980:28
run@http://localhost:9876/absolute/Users/gengliming/Desktop/vue2-project/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?916005cc407925f4764668d61d04888d59258f5d:1935:21
execute@http://localhost:9876/absolute/Users/gengliming/Desktop/vue2-project/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?916005cc407925f4764668d61d04888d59258f5d:1923:13
queueRunnerFactory@http://localhost:9876/absolute/Users/gengliming/Desktop/vue2-project/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?916005cc407925f4764668d61d04888d59258f5d:714:42
execute@http://localhost:9876/absolute/Users/gengliming/Desktop/vue2-project/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?916005cc407925f4764668d61d04888d59258f5d:2426:25
execute@http://localhost:9876/absolute/Users/gengliming/Desktop/vue2-project/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?916005cc407925f4764668d61d04888d59258f5d:776:24
http://localhost:9876/absolute/Users/gengliming/Desktop/vue2-project/node_modules/karma-jasmine/lib/adapter.js?7975a273517f1eb29d7bd018790fd4c7b9a485d5:320:23
loaded@http://localhost:9876/context.js:151:17
global code@http://localhost:9876/context.html:40:28', line: 9719, sourceURL: 'http://localhost:9876/base/index.js?27a36bfdace53b5f11dc9ece93feea32e45ab5c8'}
Api.users
✗ will get json data
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
App.vue
✓ should export the correct `name`
✓ has a created hook
UserPage.vue
✓ shoule have the correct name : UserPage
PhantomJS 2.1.1 (Mac OS X 0.0.0): Executed 4 of 4 (1 FAILED) (5.231 secs / 5.216 secs)
TOTAL: 1 FAILED, 3 SUCCESS
1) will get json data
Api.users
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
=============================== Coverage summary ===============================
Statements : 81.11% ( 176/217 ), 42 ignored
Branches : 94.68% ( 89/94 ), 36 ignored
Functions : 41.86% ( 18/43 )
Lines : 58.95% ( 56/95 )
================================================================================
npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/Cellar/node/5.10.1/bin/node" "/usr/local/bin/npm" "run" "unit"
npm ERR! node v6.8.1
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! vue2-project@1.0.0 unit: `karma start test/unit/karma.conf.js --single-run`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue2-project@1.0.0 unit script 'karma start test/unit/karma.conf.js --single-run'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the vue2-project package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! karma start test/unit/karma.conf.js --single-run
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs vue2-project
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls vue2-project
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/gengliming/Desktop/vue2-project/npm-debug.log
npm ERR! Test failed. See above for more details.
Environment Details
- Karma version (output of
karma --version
): Karma version: 1.3.0 - Relevant part of your
karma.config.js
file
module.exports = function (config) {
config.set({
// to run in additional browsers:
// 1. install corresponding karma launcher
// http://karma-runner.github.io/0.13/config/browsers.html
// 2. add it to the `browsers` array below.
browsers: ['PhantomJS'],
frameworks: ['jasmine'],
reporters: ['spec', 'coverage'],
files: ['./index.js'],
preprocessors: {
'./index.js': ['webpack', 'sourcemap']
},
webpack: webpackConfig,
webpackMiddleware: {
noInfo: true
},
coverageReporter: {
dir: './coverage',
reporters: [
{ type: 'lcov', subdir: '.' },
{ type: 'text-summary' }
]
}
})
}
specs
users.spec.js:
import Api from 'src/api'
describe('Api.users', () => {
const { users } = Api
it('will get json data', done => {
users.getAuthUserInfo('552a0d2a68b89f6e13d0e07d71f831cd1797e7cd89').then(json => {
expect(typeof json).toBe('object')
done()
}).catch(err => {
throw err
})
})
})
Issue Analytics
- State:
- Created 7 years ago
- Comments:15 (5 by maintainers)
Top Results From Across the Web
jasmine: Async callback was not invoked within timeout ...
In my case, this error was caused by improper use of "fixture.detectChanges()" It seems this method ...
Read more >Async callback was not invoked within timeout specified by ...
In my case, this error was caused by improper use of "fixture.detectChanges()" It seems this method is a event listener (async) which will...
Read more >Jasmine–Async callback was not invoked within timeout
This is a void function that signals Jasmine that the callback is finished. Jasmine will wait for done() to be called before continuing ......
Read more >Async callback was not invoked within timeout specified by ...
Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL. and my test is taking too long to execute (about 5s).
Read more >Difference between setting "defaultTimeoutInterval
This all raised as I was experiencing an Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In my case, this was caused by improper use of “fixture.detectChanges()” It seems this method is a event listener (async) which will only respond a callback when changes are detected. If no changes are detected it will not invoke the callback, resulting in a timeout error. Hope this helps 😃
Try using lesser timeout instead. I got this error while using timeout = 5000. I replaced it with 2000 and it worked for me!