Skip to content
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

AMD/Require and use strict #21

Closed
davetheninja opened this issue Sep 4, 2014 · 52 comments
Closed

AMD/Require and use strict #21

davetheninja opened this issue Sep 4, 2014 · 52 comments

Comments

@davetheninja
Copy link

Hey,
I really am quite interested in using this library for dev/testing however in its current state I am unable to use it.

Issues:

  1. I use 'use strict' within my build process which rejects undeclared (var) variables. var is not used when defining classes within this library.
  2. Unless I am missing something obvious, there is no support for AMD/Require JS

Question:

  1. I am more than willing to fork, change and submit a patch to resolve the above - is this something you would be willing to accept into your library?

If you are totally against strict and AMD then there is no point me spending time forking and patching.

Thanks

Davie

@OpakAlex
Copy link
Contributor

OpakAlex commented Sep 4, 2014

Hi! It's good idea, can you add this, and create PR?

@danielspaniel
Copy link
Collaborator

@davetheninja .. I would be happy to merge your patch with these new additions, so go for it.

@davetheninja
Copy link
Author

Most excellent. I will get on the case. One other question, i noticed in the gruntfile there is grunt-contrib-coffee which is not used within the build proccess.

Is this something you were looking to do, migrate to coffeescript?

@danielspaniel
Copy link
Collaborator

I was going to write the tests in coffeescript, but not the core code. I was having some trouble with async tests in coffeescript so I abandoned that idea and kept with the js, but I could revisit that one day.

@davetheninja
Copy link
Author

Can you confirm if the master tests pass on your machine? Trying to run them and they are failing on

Error: Assertion Failed: The content property of DS.PromiseArray should be set before modifying it

Wondering if its a bug or my machine. Thanks

@davetheninja
Copy link
Author

Just spotted the travis file. Checked on TravisCI and can confirm it master thats failing not my local.

Ill see if i can fix that while im at it

@danielspaniel
Copy link
Collaborator

That was a strange one .. because my tests pass .. but when I see that error on Travis, so it's nice that you can reproduce that .. because I could not. If you can fix .. even better.

@davetheninja
Copy link
Author

What version of ember/ember data are you running locally.

@danielspaniel
Copy link
Collaborator

1.0.0-beta.8.2a68c63a

@davetheninja
Copy link
Author

Test in question is #createRecord adds belongsTo association to records it hasMany of within fixture adapter factory test

@danielspaniel
Copy link
Collaborator

Good to know .. but I am not getting that error .. what versions of ember / ember-data are you running?

@davetheninja
Copy link
Author

i have tried a few different, from a bower install (using whats specified in the bower.json) and have upped the versions incrementally to beta.9 - no dice

currently stepping through code in ember to see why its blowing up

@danielspaniel
Copy link
Collaborator

ok .. I wish I could reproduce it myself .. so thanks for trying to track it down.

@davetheninja
Copy link
Author

sure. what OS are you running? (not sure it would make a difference though)

@danielspaniel
Copy link
Collaborator

mavericks .. and what versions of ember and ember data get you this failure .. ( all of them? it sounds like )

@davetheninja
Copy link
Author

from ember 1.6 -> 1.8 beta 1 and ember-data 1.0.0-beta.7 -> 1.0.0-beta.9

@davetheninja
Copy link
Author

Its something to do with has many and async (RSVP call within the user find promise) . Ill have another look at it tomorrow

@davetheninja
Copy link
Author

Right. So I went back to Travis to check the logs.....

a1181df

That was the commit that caused the build to fail.

I hate computers.

@danielspaniel
Copy link
Collaborator

geez .. that commit does not even do anything in particular .. which is why I just threw my hands up and ignored the travis test failure, since it seemed bogus. But now that you are actually reproducing it and have the bug live and fresh on your machine .. well .. yeah .. good point about computers.

@davetheninja
Copy link
Author

Right. Just to err on the side of caution, I checked out the GREEN tag. Still doesnt work on my machine.

Could you try a clean clone of the repo, bower install, npm install grunt test

To see if it happens on a clean build on your machine

@davetheninja
Copy link
Author

AH HA!!! I figured it out.

@davetheninja
Copy link
Author

Last passing Travis Build.....

bower install ember-data#1.0.0-beta.8
bower install jquery#1.10.2
bower install ember#1.6.1

First Failing

bower install ember-data#1.0.0-beta.9
bower install jquery#1.10.2
bower install ember#1.6.1

I forced install 1.6.1 and 1.0.0-beta.8 locally and now the tests pass.

@davetheninja
Copy link
Author

So to get a green build on travis, put a hard dependency on 1.6.1 and beta 8 for the time being.

@davetheninja
Copy link
Author

Victory is sweet. Time for beer.

@danielspaniel
Copy link
Collaborator

Hooray .. for you .. and for me .. I got the test to fail with fresh install ( looks like newer ember release kills that test .. but I will try and fix also ) ..

@davetheninja
Copy link
Author

Sure, I need a green build before I start committing changes - need a solid platform if you know what I mean.

Expect Pull requests tomorrow instead of tonight :-)

@danielspaniel
Copy link
Collaborator

no problem .. will be nice to get this sorted out

@danielspaniel
Copy link
Collaborator

I have been looking at this and the code in DS.FixtureAdapter.createRecord .. ( which is where the problem is ) and to me .. its not worth fixing this .. since I am thinking it is best to drop support for the fixture adapter anyway ..
the purpose of this project is that you don't have to use the fixture adapter, so why am I supporting it ( out of legacy is the answer .. but I barely bother with keeping fixture adapter happy ) ..
so if you start to feel like your going down a deep well and getting nowhere ..

@davetheninja
Copy link
Author

Agree.


Sent from Mailbox

On Fri, Sep 5, 2014 at 1:12 AM, Daniel Sudol [email protected]
wrote:

I have been looking at this and the code in DS.FixtureAdapter.createRecord .. ( which is where the problem is ) and to me .. its not worth fixing this .. since I am thinking it is best to drop support for the fixture adapter anyway ..
the purpose of this project is that you don't have to use the fixture adapter, so why am I supporting it ( out of legacy is the answer .. but I barely bother with keeping fixture adapter happy ) ..

so if you start to feel like your going down a deep well and getting nowhere ..

Reply to this email directly or view it on GitHub:
#21 (comment)

@danielspaniel
Copy link
Collaborator

I mentioned the test failure to @KnownSubset .. and asked him if he could try and fix it, since he has more interest in making that code work. If he can't fix it .. I will comment out the test so the build passes and wait for inspiration to fix it myself.

@davetheninja
Copy link
Author

any reason why the has_many.js include in the qunit index.html is not being referenced from the dist package?

@OpakAlex
Copy link
Contributor

OpakAlex commented Sep 5, 2014

i think has_many.js is outdated. In latest ember-data it's not works. I have commit to up it on latest version, but we need change tests for FixtureAdapter. Build belongs_to is broken.

@davetheninja
Copy link
Author

p.s I have a basic setup working now where RequireJS is now supported.

I am going to refactor the test structure so that I can run all tests from Global scope and through Require.

@davetheninja
Copy link
Author

Ok No problem

@OpakAlex
Copy link
Contributor

OpakAlex commented Sep 5, 2014

@OpakAlex
Copy link
Contributor

OpakAlex commented Sep 5, 2014

Do you use broccoli for you build?

@davetheninja
Copy link
Author

Personally I do use broccoli yes, I have no problem whatsoever using Grunt though given it is already integrated.

Would Broccoli be something you would want to use?

@OpakAlex
Copy link
Contributor

OpakAlex commented Sep 5, 2014

yes, i want new version with Broccoli. It will be very nice, and we can add some console commands for ember-cli. #17 Check this one.

@davetheninja
Copy link
Author

Yeh thats quite sweet indeed :-)

To be honest with you guys, looking through the googlz this is the first project that has come close to what I am looking for in regards to streamlined testing within ember.

I am completely against use of fixtures as from experience (rails etc) they get out of control very quickly.

Factories on the other hand are much easier to maintain and override on a test per test basis.

Even more honestly (or stupidly) I have not even got this project to run on my app yet (amd dependency) hence I am working to add the requirejs goodies - just to test the app :-)

Once its added and I see if I can use this project, going forward I will be more than happy to invest time contributing.

As I said, from the features you currently support it looks almost perfect for my use case.

Bravo

@davetheninja
Copy link
Author

One other thing I would recommend is using broc + es6 concat or similar and setting up the dependencies within your source files:

Example:

import Sequence from './sequence'

var FactoryGuy = {

  someMethodThatUsesSequence: function() {
    return Sequence.generate();
  }

}

export default FactoryGuy

The above is completely trivial example but that pattern has helped me so much (even more so when combined with CoffeeScript) when architecting my JS apps and libs.

@OpakAlex
Copy link
Contributor

OpakAlex commented Sep 5, 2014

If you need help to testing your Ember app you can ping me.

@davetheninja
Copy link
Author

Thanks

@KnownSubset
Copy link
Contributor

@davetheninja I think everyone is against hard coded fixtures, but using a library/factories that populate the list of fixtures is an entirely different thing. I do think that the library should become adapter agnostic so that we rely only upon the store otherwise ember-data-factory-guy's adoption will always be hindered if a new adapter comes out.

@davetheninja
Copy link
Author

Exactly. That's what I meant.

Factory -> attributes
factory -> store


Sent from Mailbox

On Fri, Sep 5, 2014 at 10:35 PM, Nathan [email protected] wrote:

@davetheninja I think everyone is against hard coded fixtures, but using a library/factories that populate the list of fixtures is an entirely different thing. I do think that the library should become adapter agnostic so that we rely only upon the store otherwise ember-data-factory-guy's adoption will always be hindered if a new adapter comes out.

Reply to this email directly or view it on GitHub:
#21 (comment)

@danielspaniel
Copy link
Collaborator

@davetheninja .. I am not convinced on the need for switching to brocolli, so don't include that in this pull request ( lets save for another time ) And @OpakAlex, if you want this switch from grunt, try and implement it yourself first.

@davetheninja
Copy link
Author

Sure. As I already said I have no intention to do anything other than requirejs initially.


Sent from Mailbox

On Sat, Sep 6, 2014 at 7:27 PM, Daniel Sudol [email protected]
wrote:

@davetheninja .. I am not convinced on the need for switching to brocolli, so don't include that in this pull request ( lets save for another time ) And @OpakAlex, if you want this switch from grunt, try and implement it yourself first.

Reply to this email directly or view it on GitHub:
#21 (comment)

@danielspaniel
Copy link
Collaborator

Got it .. and I am looking forward to seeing that in action. :)

@danielspaniel
Copy link
Collaborator

Hi @davetheninja .. how is it going with the amd conversion? I am guessing it got stalled .. but hoping you can finish it one of these days :)

@danielspaniel
Copy link
Collaborator

@indirect made this happen so I am closing this one.

@davetheninja
Copy link
Author

Apologies for being AWOL, family and work commitments. I am actually getting time to do some of my own project coding again.

The new factory-guy is excellent btw. Well done

@danielspaniel
Copy link
Collaborator

Thanks @davetheninja .. mucho appreciado and glad to see you back :)

@davetheninja
Copy link
Author

😌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants