| 22 | // The chart helpers need a canvas in a page. In a unit spec they fail with the |
| 23 | // rename that moves the file to the browsers, instead of a bare ReferenceError. |
| 24 | function needsBrowser(name) { |
| 25 | return function() { |
| 26 | const file = relative(root, expect.getState().testPath).split(sep).join('/'); |
| 27 | throw new Error(`${name} needs a browser: rename ${file} to drop .unit from its name`); |
| 28 | }; |
| 29 | } |
| 30 | |
| 31 | for (const name of ['acquireChart', 'afterEvent', 'releaseChart', 'triggerMouseEvent', 'waitForResize']) { |
| 32 | global[name] = needsBrowser(name); |