-
-
Notifications
You must be signed in to change notification settings - Fork 137
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
Test Helpers in Factory break development build #247
Comments
Oooo .. you are very right .. those factories should not be in dev if you not using them. |
This was good fix. Should have thought of this before. Fixed in https://github.com/danielspaniel/ember-data-factory-guy/releases/tag/v2.7.8 |
@danielspaniel this commit seems to have reintroduced this issue |
I think I was wrong @GavinJoyce to say that the factories should not be included in dev build because they still need to be for the ember test runner which runs when you go to browser and use the /tests route. |
Thanks @danielspaniel. I'm not fully sure of the original context to this issue, just that it's reoccurring in our app since updating |
@danielspaniel we are seeing this issue when we load our app normally in development. We don't want to use FactoryGuy in our local apps. You are right that FactoryGuy should load if |
Ok @patocallaghan. |
@patocallaghan try https://github.com/danielspaniel/ember-data-factory-guy/releases/tag/v2.9.7 |
@danielspaniel thanks, that works in our app |
Great, glad that worked @GavinJoyce. |
Thanks @danielspaniel 🙇 |
your welcome @patocallaghan .. glad it's working out ( nice emoji .. me like ) |
hey @patocallaghan .. this issue is returning to haunt me. Someone setup a new project with latest factory guy and it was total disaster ( since acceptance tests kept barfing ) .. and I finally figured out it was this issue again. Question for you: Because you have references to other test files in factories is there a way that you could put all your "helper" files that you import into factories because I am needing to go back to this: includeFactoryGuyFiles: function() {
var includeFiles = false;
// changed to /test/ to not include in development, but that not working so well
if (this.app.env.match(/test|development/)) {
includeFiles = true;
} else {
includeFiles = this.factoryGuyEnabled;
}
return includeFiles;
}, since if I don't include the files in development running an acceptance tests with localhost:port/tests will not load the factories ( since the includeFactoryGuyFiles function is returning false in development mode. ) Not sure how this ever worked for anyone frankly. But the change was in 2.9.7 so maybe not too many people upgraded, or they were using factoryGuy: true in environment.js ( development section ) But need to come up with a solution asap. treeForApp: function(appTree) {
var trees = [appTree];
if (this.includeFactoryGuyFiles()) {
try {
if (fs.statSync('tests/factories').isDirectory()) {
var factoriesTree = new Funnel('tests/factories', {
destDir: 'tests/factories'
});
var utilsTree = new Funnel('tests/place-where-my-helper-functions-are', {
destDir: 'tests/place-where-my-helper-functions-are' //
});
trees.push(factoriesTree);
trees.push(utilsTree);
}
} catch (err) {
// do nothing;
}
}
return mergeTrees(trees);
}, So, basically I need a way to include factory guy still in development, so it works in the /tests mode I can think of no other alternative. Can you? I am open to any and all ideas. |
@danielspaniel just to confirm that 2.11.0 works for us when we set:
Factory Guy doesn't appear in our dev environment. Thanks for making those changes 👍 |
Thanks for confirming .. @patocallaghan 😃 |
For |
Since the new development mode has shipped I notice that factories are being included in the development build in the app's JS by default and even when I set
ENV.factoryGuy = false
, i.e. I don't want to use Factory Guy in development mode.In one of my factories I import a test helper like so:
but because the factory is being included in dev build and the test helpers aren't, it breaks my app in development mode with the following error:
Could not find module embercom/tests/helpers/data imported from embercom/tests/factories/engage/message-variation
Should we not be excluding the factories from development builds if you don't want to use the new development mode?
The text was updated successfully, but these errors were encountered: