kazzkiq / CodeFlask

A micro code-editor for awesome web pages.
https://kazzkiq.github.io/CodeFlask/
MIT License
1.07k stars 120 forks source link

Can't use codeflask with mocha #75

Closed Rhymmor closed 6 years ago

Rhymmor commented 6 years ago

Getting error ReferenceError: CSS is not defined during the mocha tests I guess it is because this line: https://github.com/kazzkiq/CodeFlask/blob/e64a3082a3ce4ce8ad9db60ad9e600f3d2944a16/src/styles/editor.js#L4

kazzkiq commented 6 years ago

Hmm, yes. CSS is a browser-based method.

You could prevent this error by adding this code before your tests:

if (!CSS) {
  CSS = {
    supports: () => { return false }
  }
}

Perhaps you will also have to use window or global, just to make explicit you wantCSS globally assigned. (ex.: global.CSS = {...}).