
Security News
NIST Under Federal Audit for NVD Processing Backlog and Delays
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
v0.0.4
This gem provides sane defaults for using Javascript test frameworks in the Rails 3.1 Asset Pipeline. It allows you to write and run Qunit or Jasmine tests while leveraging the new compiling power of Tilt and Sprockets 2. Now enabling more profit when you write your JS tests in CoffeeScript!
TestTrack is a mountable engine whichs provides routes to Javascript test runners pre-loaded with your application's code and tests.
In your Rails 3.1 app, just add it to your Gemfile, like this:
gem "test_track"
TestTrack automatically adds test paths to your app's asset pipeline. The default locations are...
spec/javascripts
test/javascripts
This is a good place for your manfiest file for your framework of choice. Here is a sample Jasmine manifest, called jasmine.js
in spec/javascripts
that includes our test suite and helpers:
// SUITE :: Jasmine
// SUITE MANIFEST :: spec/javascripts/jasmine.js
// TEST SRC DIR :: spec/javascripts
//
//= require helpers/spec_helper
//= require profile_spec
//= require user_spec
For Qunit, create qunit.js
in test/javascripts
, instead.
We would recommend that you place your test manifests in the directories listed above, as TestTrack will look for them there by default. Feel free to place these anywhere else in the asset pipeline, just don't forget to specify its location in an initializer. If it happens to be in the root of an asset directory, no additional configuration is required.
If you'd like to change a default, such as the name of your Jasmine
manifest, try the following in config/initializers/test_track.rb
:
TestTrack.setup do |config|
config.qunit_manifest = "test/qunit"
end
To see this in action, check out the sample Rails code in test/dummy
.
See lib/test_track.rb
for all available options.
In your routes.rb
:
mount TestTrack::Engine => "test"
And you're off the the races. An index is provided with links to the test
runners. They would be accessible at /test/jasmine
and
/test/qunit
in the example above.
In addition to the test runners, Sinon.js is included by default. It's a great set of tooling for mocking, spies, and XHR faking. In general, Sinon.js will not affect any pre-existing test suites, but there are some gotcha's. Be sure to check the out the documentation if you haven't used it before
In Sinon's default settings, setTimeout and setInterval are overwritten. To change this behavior you need to modify Sinon's config object before your tests run.
sinon.config.useFakeTimers = false;
To not include Sinon, add the following to your TestTrack initiailizer. ] config.include_sinon = false
Obviously, you may not want to have these routes available if your app
is running in :production
. Try this in your routes.rb
:
mount TestTrack::Engine => "test" unless Rails.env.production?
This project uses the MIT-LICENSE.
FAQs
Unknown package
We found that test_track demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
Research
Security News
Socket’s Threat Research Team has uncovered 60 npm packages using post-install scripts to silently exfiltrate hostnames, IP addresses, DNS servers, and user directories to a Discord-controlled endpoint.
Security News
TypeScript Native Previews offers a 10x faster Go-based compiler, now available on npm for public testing with early editor and language support.