Vue-test-utils: Add sleep

Created on 22 Dec 2017  路  3Comments  路  Source: vuejs/vue-test-utils

I think that when asynchronous processing is executed in Promise, it needs to sleep asynchronously.
This is related to #288.

export default function sleep (ms) {
  return new Promise(resolve => setTimeout(resolve, ms))
}

Most helpful comment

@eddyerburgh
I am very sorry.
I mistook the input.
I did not enter "not".
Correctly, "I think it is __not__ necessary because it is only 3 lines."
I am sorry for hurting your feelings.

All 3 comments

I think it is necessary because it is only 3 lines.

I don't think we should add this method to vue-test-utils.

You could create an npm package, and we could recommend its use. At the moment we recommend flushPromises, which doesn't give you the option to wait for chosen milliseconds.

But this function is out of scope for a Vue test library in my opinion. It's not Vue specific.

@eddyerburgh
I am very sorry.
I mistook the input.
I did not enter "not".
Correctly, "I think it is __not__ necessary because it is only 3 lines."
I am sorry for hurting your feelings.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dwonisch picture dwonisch  路  3Comments

robcresswell picture robcresswell  路  3Comments

matt-sanders picture matt-sanders  路  3Comments

maerteijn picture maerteijn  路  3Comments

alexanderstudte picture alexanderstudte  路  3Comments