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

Redundant requires break the dependency chain #16

Closed
airhorns opened this issue Apr 30, 2012 · 3 comments
Closed

Redundant requires break the dependency chain #16

airhorns opened this issue Apr 30, 2012 · 3 comments

Comments

@airhorns
Copy link

In snockets master, there are test fixtures x.coffee, y.js, and z.coffee. z depends on y and y depends on x.

If I add alphabet.coffee which looks like this:

#= require y.js
#= require z.coffee

I would expect the dependency chain to look like this:

chain = snockets.depGraph.getChain('alphabet.coffee')
test.deepEqual chain, ['x.coffee', 'y.js', 'z.coffee']

alphabet requires y, which requires x, and then requires z, which requires y, which has already been required. So, x first as needed by y and z, then y because it's listed first in alphabet, and then z because it's listed second and all its dependencies have been required already.

However, the chain doesn't look like that, it looks like this:

AssertionError: [ 'y.js', 'x.coffee', 'z.coffee' ] deepEqual [ 'x.coffee', 'y.js', 'z.coffee' ]

Note the order is y, x, z instead of x, y, z, which might break the code in y since it relies on things in x but comes before it.

I pushed my failing test case to hornairs@4d330756f698d8211efc539cf4d2a8c36925dc4e.

@airhorns
Copy link
Author

This would be fixed by cutting a new release of dep-graph :)

@airhorns
Copy link
Author

@TrevorBurnham Do you think you could cut new releases so I don't have to depend on master?

@TrevorBurnham
Copy link
Collaborator

Done, new release is 1.3.5. Thanks for the reminder.

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

2 participants