blanket icon indicating copy to clipboard operation
blanket copied to clipboard

Cannot read property 'parse' of undefined (at line 29 of blanket.js)

Open mapio opened this issue 8 years ago • 12 comments

Serving the test dir and opening /backbone-koans/ in the browser result in the console reporting the error that is the subject of this issue. The culprit seems to be

https://github.com/alex-seville/blanket/blob/11f1a927477af163177a96df6590a397c1f4a0f5/dist/qunit/blanket.js#L29

a missing library.

mapio avatar Dec 04 '15 01:12 mapio

I think you should built the project first. Follow the steps in Roll your own section.

warpig9 avatar Dec 10 '15 03:12 warpig9

I don't think you are right.

First of all, that file is a dist directory https://github.com/alex-seville/blanket/tree/HEAD/dist/qunit that suggest it already has been built.

Second, the same error (albeit at a different line number) happens if using the minified file in the same directory – exactly what one is suggested to do by the instruction in http://blanketjs.org/.

Finally, the error does not happen using https://raw.githubusercontent.com/alex-seville/blanket/89266afe70ea733592f5d51f213657d98e19fc0a/dist/qunit/blanket.js (without building).

So it seems that, probably by mistake, the wrong (unbuilt) file has been committed to the repo (in the dist directory).

mapio avatar Dec 10 '15 17:12 mapio

Yes, the file blanket.js(65kb) in /dist/qunit is unbuilt. It became 200kb after I built it and that's why I suggest you should built it by yourself. BTW, from the source code I saw that blanket needs a 3rd-party parser(Esprima or other parsers), and the building work will import the parser in the target file, that's why blanket can do all the job in the browser without any nodejs dependency during runtime.

warpig9 avatar Dec 11 '15 02:12 warpig9

I met the same issue. The files is /dist/qunit should be updated.

yangzhaox avatar Dec 11 '15 06:12 yangzhaox

@warpig9 I can absolutely agree that committing a file that is built from other files in the repo is quite a bad idea (given its size, but not only); it is a common best practice not to do so, reported even on some GitHub guide http://kbroman.org/github_tutorial/pages/routine.html "[d]on’t include files that are derived from other files in the repository".

You should also consider that:

  • the http://blanketjs.org/ home page explicitly instructs you that "[t]he only file you need is blanket.js [d]ownload the library and reference it in your test runner" and points to (the currently not working) https://raw.github.com/alex-seville/blanket/master/dist/qunit/blanket.min.js and does not mention at all that one should download the source and build it himself;
  • the same holds for the "Getting Started Guide (browser version)" https://github.com/alex-seville/blanket/blob/master/docs/getting_started_browser.md also pointing to (the currently not working) https://raw.github.com/alex-seville/blanket/master/dist/qunit/blanket.min.js and does not mention at all again the one needs to build such file.

So I think you either to:

  • update the dist directory to contain working (built) files,
  • remove the dist directory and update the documents where it is said that it's enough to download files from such dir.

mapio avatar Dec 11 '15 09:12 mapio

I just ran into this as well. Installing through npm has a similar problem. I had to clone the repo and rebuild the dist directory as well in order to get past it.

socketwiz avatar Dec 14 '15 21:12 socketwiz

Same problem here. You should either keep your dist up-to date and built, or remove/rename it.

You know, we users are lazy. So lazy you should treat me as dumb. Because we have our own host of dependencies, and want to focus on our own project. So please provide ready-to-use package (in our case that one blanket.min.js is okay). I revert to https://raw.githubusercontent.com/alex-seville/blanket/89266afe70ea733592f5d51f213657d98e19fc0a/dist/qunit/blanket.js for the time being.

magwas avatar Dec 21 '15 17:12 magwas

Backed out of 1.2.0 due to this issue. Any fix on the horizon?

stefaneg avatar Jan 26 '16 15:01 stefaneg

@stefaneg as you see in https://github.com/alex-seville/blanket/issues/541#issuecomment-163816843 @warpig9 does not consider this a bug :( so no fix will be ever provided…

mapio avatar Jan 26 '16 22:01 mapio

Either the documentation has to change or the code distribution. While they are not in sync, this is definitely a bug. I would suggest that the right thing to do is to publish a built blanket.js in a npm package, and update the docs accordingly.

stefaneg avatar Jan 27 '16 08:01 stefaneg

@stefaneg :+1:

mapio avatar Jan 28 '16 22:01 mapio

+1 for @mapio arguments. That is really disturbing when you follow the docs and it doesn't work as expected. The docs should mention that or the file should be updated.

louisatome avatar Feb 01 '16 08:02 louisatome