-
Notifications
You must be signed in to change notification settings - Fork 1
Plugin requires folder src to be created in root #5
Comments
As I said in rocjs/roc-template-web-app-react#8 (comment) you will here need to run the test command with an option that tells it where it can find the code to generate coverage for.
This is because the template uses another pattern for where it hosts its src files, I guess the question here is what the optimal action is:
// …
test: {
src: {
path: 'app'
}
}
// …
I'm leaning against nr. 1 for now. We should however manage the case when the |
"Cannot find source folder 'src'. Please use In any case, how about changing the default roc test script to use /App as default? |
Yeah something like that. We will however not be able to easily detect where the real source files are located. You mean to change the configuration as in the first alternative above? I think that would be a good start. It's probably however more logical to change the template to use To keep in mind in regards to the template is that we should aim to keep it as minimal as possible and really let the community create alternative templates that work for their specific use case since it's so easy to create and use a new ones. |
OK. Having slept on it, and then gone to the dentist on it, I suggest simply renaming app to src. /src/components, /src/reducers and so on. Also, where should I place karma.conf.js for default tests? The only one I can find after installing the roc-plugin-test-mocha-karma-webpack dependency is the ones in the actual package itself ( |
I agree, we should update the template to use Short answer. Yes through the Long answer. There is currently one way to do it using the Current way // Inside the roc.config.js
module.exports = {
// ...
action: () => (rocObject) => {
const hook = rocObject.hook;
const previousValue = rocObject.previousValue;
if (hook === 'build-karma-config') {
return () => () =>
Object.assign(previousValue, {
// A karma configuration object that will
// overwrite what the extensions has defined
// You would also be able to mutate the previousValue
// and return that directly.
});
}
}
} This type of interface is not going away but we are looking into make it simpler to work with, for instance will the first function in the chain probably be removed soon and maybe some abstraction is desirable as has been provided for extensions. The future |
There's a PR coming from me either way, if I can get the testing to work. Basically I'll do it in two parts (so two PRs). One tests for some pretty basic things - things that don't require anything other than the roc-test plugin with the long name. I can do a quick PR first with the app->src change, I just need to do some grepping to see what else needs to be changed so the PR can be merged with no carnage. Then I've planned some tests using karma-jquery-expect, but you might not want to merge that because it obviously adds some dependencies. I'll still make it a PR and then there can be a discussion on whether to add it. So, yeah, three PRs. As for configuration style, there is definitely something to be said for both keeping it in the same file for ease of use, and separation of concerns for reuse - not that you can't reuse parts from a huge config file of course. How about making it optional like with gulp and webpack? Default is to have a karma: object in roc.config.js, but if you simply do a karma: require('karma.conf.js') then obviously you know what you're doing and Roc should just roll with it? Opinionated is great, but if you don't have to eliminate choices while still keeping things relatively clean, that's something I would appreciate. |
Sounds awesome, looking forward to it! Just a heads up, this is the current default expect by mjackson, not this expect by Automattic. Thanks for your input, will work more with this going forward. |
This is what I hate about the microlibrary model. We need a microlib to connect microlib A to microlib B. Not that these are really small libraries, but you know... |
I will close this issue since the direct problem has been resolved through rocjs/roc-template-web-app-react#10. We can continue the discussion here or in another issue. |
As said in topic,
roc test
fails with the following error if foldersrc
is not in the project root.If this is a feature, not a bug, shouldn't the entire App directory be in the src folder?
https://asciinema.org/a/7pzre2zjrpp9bum0tj68d8m19
(I finally got a reason to use Asciinema!)
The text was updated successfully, but these errors were encountered: