(callback)
| 120 | }) |
| 121 | |
| 122 | async function hopeThat(callback) { |
| 123 | if (store.dryRun) return |
| 124 | const sessionName = 'hopeThat' |
| 125 | |
| 126 | let result = false |
| 127 | return recorder.add( |
| 128 | 'hopeThat', |
| 129 | () => { |
| 130 | recorder.session.start(sessionName) |
| 131 | store.hopeThat = true |
| 132 | callback() |
| 133 | recorder.add(() => { |
| 134 | result = true |
| 135 | recorder.session.restore(sessionName) |
| 136 | return result |
| 137 | }) |
| 138 | recorder.session.catch(err => { |
| 139 | result = false |
| 140 | const msg = err.inspect ? err.inspect() : err.toString() |
| 141 | output.debug(`Unsuccessful assertion > ${msg}`) |
| 142 | hopeThatFailures.push(msg) |
| 143 | event.dispatcher.once(event.test.finished, test => { |
| 144 | if (!test.notes) test.notes = [] |
| 145 | test.notes.push({ type: 'conditionalError', text: msg }) |
| 146 | }) |
| 147 | recorder.session.restore(sessionName) |
| 148 | return result |
| 149 | }) |
| 150 | return recorder.add( |
| 151 | 'result', |
| 152 | () => { |
| 153 | store.hopeThat = undefined |
| 154 | return result |
| 155 | }, |
| 156 | true, |
| 157 | false, |
| 158 | ) |
| 159 | }, |
| 160 | false, |
| 161 | false, |
| 162 | ) |
| 163 | } |
| 164 | |
| 165 | /** |
| 166 | * Asserts that no `hopeThat` soft assertion has failed in the current test. |
no test coverage detected