-
Notifications
You must be signed in to change notification settings - Fork 145
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
Custom boot for Node #29
Comments
Whilst getting custom boot to work may be a bit more challenging, do you think the fact that the helpers are not loaded when a specific test is specified is a bug? If so, perhaps I should create a PR to resolve that bug in the mean time? |
It probably makes sense for the CLI to use the jasmine.json configuration as defaults that the CLI then overrides. You could file an issue/PR for the helper files not being loaded. When you add a reporter, the default reporter is no longer added. There is no boot_files option for jasmine.json. Right now you can not use a custom boot from the command line. All this module does for booting is use the boot exposed by the jasmine-core module. You can optionally pass in a jasmineCore to this module, so you could just pass in your own instance of jasmineCore and then define your own boot method on the core. https://github.com/jasmine/jasmine-npm/blob/master/lib/jasmine.js#L14 |
@mattheworiordan What are you trying to do in a boot file? Are you able to solve your problems with a helper file instead? Right now there's a bug in tracker for fixing helper file loading when specifying files to run on the command line. If this gets fixed so helpers are always loaded correctly, does this fix your issue? |
I'm in a similar situation. I'm trying to load BabelJS through the |
Sorry for the slow reply on this. In the end I actually abandoned Jasmine as I just couldn't get it to behave the way I needed, not specifically this issue though. In terms of why I could not use helpers, yes, I expect when that bug is fixed that would have solved my problem indeed. Thanks. |
@whitehat101 The helper files should be loaded properly even when specifying files to execute now on master. If you get a chance, can you take a look and see if adding a helper that does the extra stuff you want in a boot solves your problem? If not, we'd like to know what would need to be added to make a helper file sufficient. Thanks for using jasmine! |
The fix for loading helper files properly should be released with 2.3 now. From what I can tell that should solve this issue, so I'm going to close it. |
I'm trying to use something like the custom_boot.js to make a webpack loader for Jasmine tests, so that it can inject the Jasmine methods into test modules. This is also necessary because I'm using Meteor, which also injects variables, and they wouldn't be present if I let Jasmine run the tests itself. The way both Meteor and Jasmine prefer to load and run js files themselves really gets in the way of interoperability, it makes the developer jump through hoops. Meteor's Velocity test framework has figured out how to run things with Jasmine, but Velocity has some severe limitations (e.g. you can't do anything like Karma as far as I know). |
@jedwards1211 if you're looking to run the tests in a browser, you want to just go straight to jasmine-core, which is just the base jasmine files. You might also see if something like gulp-jasmine-browser will work for you, it should be capable of doing a webpack server as well. |
I'm running both server and client-side tests. Here is my somewhat hacky workaround:
|
I thought I would add to this, I managed to include a boot.js file by doing the follow: {
"spec_dir": "app/server/",
"spec_files": [
"../../.utilities/boot.js", //this
"**/*.test.js"
],
"helpers": [
"helpers/**/*.js"
]
} |
The custom
boot.js
file introduced in 2.0 is a great addition, however I am trying to figure out how to use jasmine with Node with a custom boot.js file, and so far the only way I seem to be able to get this to work is to invoke the Jasmine Runner directly from a Grunt script as opposed to using thejasmine
command line script.I have worked around this issue easily when running the entire test suite using helpers, however when I run a single spec such as
jasmine spec/whatever.spec.js
the helpers are not loaded.I have also tried adding a
boot_files
option to my jasmine.json file without luck.Is there a recommended way with node to inject your own custom boot?
On a slightly separate note, I see in https://github.com/jasmine/jasmine-npm/blob/master/lib/jasmine.js#L45-L46 that you automatically add the default console reporter. If I want to use a different reporter, it seems unfortunately there is no way to do that because the API only exposes an
addReporter
method. Any thoughts on how to address that?The text was updated successfully, but these errors were encountered: