Giter Site home page Giter Site logo

Comments (11)

thabti avatar thabti commented on August 17, 2024 1

@whitehat101

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"
  ]
}

from jasmine-npm.

mattheworiordan avatar mattheworiordan commented on August 17, 2024

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?

from jasmine-npm.

amavisca avatar amavisca commented on August 17, 2024

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

from jasmine-npm.

slackersoft avatar slackersoft commented on August 17, 2024

@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?

from jasmine-npm.

whitehat101 avatar whitehat101 commented on August 17, 2024

I'm in a similar situation. I'm trying to load BabelJS through the boot.js. I have a "working" setup with gulp, but I'm hoping to run a single spec with the jasmine CLI without pre-compiling my source/spec.

from jasmine-npm.

mattheworiordan avatar mattheworiordan commented on August 17, 2024

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.

from jasmine-npm.

slackersoft avatar slackersoft commented on August 17, 2024

@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!

from jasmine-npm.

slackersoft avatar slackersoft commented on August 17, 2024

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.

from jasmine-npm.

jedwards1211 avatar jedwards1211 commented on August 17, 2024

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).

from jasmine-npm.

slackersoft avatar slackersoft commented on August 17, 2024

@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.

from jasmine-npm.

jedwards1211 avatar jedwards1211 commented on August 17, 2024

I'm running both server and client-side tests. Here is my somewhat hacky workaround:

  • Use a custom Webpack loader for test modules. It wraps them in function(jasmine) and at the top of the function, uses eval to put everything in jasmine.getEnv() on the local scope.
  • Inside the Velocity Jasmine test scripts, I call those functions, passing the fake jasmine whose getEnv() returns the Jasmine globals on the local scope of the Velocity Jasmine test scripts.

from jasmine-npm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.