-
-
Notifications
You must be signed in to change notification settings - Fork 761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
All tests could also be running in the browser #532
Comments
Maybe instead of having a condition detecting if the build is in the browser we could even use a webpack-loader to load the pngs using require. |
I think we have something similar (accidently closed!) |
A combination of and https://github.com/oliver-moran/jimp/blob/master/karma.conf.js#L26 serve files to the browser. |
Indeed, the test that I pinpointed in this issue writes to disk, so this one is really not movable. Some of the other tests could run in the browser too I think : https://github.com/oliver-moran/jimp/blob/master/test/async.test.js#L44 |
Also I don't believe we should be doing any webpacking in jimp. Libraries like jimp should not be webpacked I beleive. https://twitter.com/HipsterSmoothie/status/1023034485749637120 |
I am ES6ing the tests right now. I'll unblock the |
async/await make the tests so much more readable |
Ok, good ! |
Some of the tests are not runned in browser environment :
For example : https://github.com/oliver-moran/jimp/blob/master/test/filetypes.test.js#L13
I think it would be possible to have a function that can read from the disk using one of :
fs.readFile(path)
fetch(path).then(function(response) {return response.text()})
with a static webserver runningWhat do you think of that @hipstersmoothie ?
I do what I describe in an other open-source library that I maintain : https://github.com/open-xml-templating/docxtemplater/blob/master/es6/tests/utils.js#L386 and it has been working quite well.
The text was updated successfully, but these errors were encountered: