Sha256: 7ce944624ff63ea390e61e8dd95b6ae41a4f7bf85b8a4cd6262fd8348c06f614

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

/**
@module ember
*/
import { RSVP } from 'ember-runtime';
import { assert, info } from '@ember/debug';

let resume;

/**
 Resumes a test paused by `pauseTest`.

 @method resumeTest
 @return {void}
 @public
*/
export function resumeTest() {
  assert('Testing has not been paused. There is nothing to resume.', resume);
  resume();
  resume = undefined;
}

/**
 Pauses the current test - this is useful for debugging while testing or for test-driving.
 It allows you to inspect the state of your application at any point.
 Example (The test will pause before clicking the button):

 ```javascript
 visit('/')
 return pauseTest();
 click('.btn');
 ```

 You may want to turn off the timeout before pausing.

 qunit (as of 2.4.0):

 ```
 visit('/');
 assert.timeout(0);
 return pauseTest();
 click('.btn');
 ```

 mocha:

 ```
 visit('/');
 this.timeout(0);
 return pauseTest();
 click('.btn');
 ```


 @since 1.9.0
 @method pauseTest
 @return {Object} A promise that will never resolve
 @public
*/
export function pauseTest() {
  info('Testing paused. Use `resumeTest()` to continue.');

  return new RSVP.Promise(resolve => {
    resume = resolve;
  }, 'TestAdapter paused promise');
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
discourse-ember-source-3.5.1.1 dist/es/ember-testing/lib/helpers/pause_test.js
discourse-ember-source-3.5.1.0 dist/dist/es/ember-testing/lib/helpers/pause_test.js