uptech / snapdragon Goto Github PK
View Code? Open in Web Editor NEWA Jasmine JavaScript test runner that lets you run tests on the command-line similar to RSpec.
License: Other
A Jasmine JavaScript test runner that lets you run tests on the command-line similar to RSpec.
License: Other
This could be especially useful for use cases such as CI and other cases where software is going to be reading the output of the tests.
This should now be possible since we added the /:path
route to return files from the CWD the command was run in.
From looking at the stack traces it seems like generally we only care about things above the at null.<anonymous>
and don't care about any of the stack trace lines after that.
Hello,
I have my specs inside spec/javascript/ folder and while running from command prompt as - snapdragon spec/javascript/
It fails all test cases. (Note forward slash at the end)
But same works if I don't use '/' at last or put '*' at the end.
Thanks.
This is important so that users can report bugs specific to a given version.
To allow for the inevitable variance that will exist in spec files, the build_jspec_filter should be replaced with a parser that will recurse through the spec files and accurately determine describe and it blocks with line numbers.
This is especially valuable in the following scenario:
spec/javascripts/
.spec/fixtures
spec/fixtures
I am sure there are other scenarios where the Jasmine specs may need to access various paths and using the current working directory of the snapdragon process allows us to avoid requiring a configuration files which specifies the root of the project.
In the future we may decided that we want to use the current working directory of the snapdragon process as the default and allow this to be overridden with some sort of configuration.
We need to update Snapdragon to use the latest stable Jasmine 2 or greater now that it is available.
Would be nice if it outputted file and line information for the syntax error.
/usr/local/rvm/gems/ruby-2.0.0-p247@budget_builder/gems/poltergeist-1.3.0/lib/capybara/poltergeist/browser.rb:229:in `command': One or more errors were raised in the Javascript code on the page. If you don't care about these errors, you can ignore them by setting js_errors: false in your Poltergeist configuration (see documentation for details). (Capybara::Poltergeist::JavascriptError)
SyntaxError: Parse error
from /usr/local/rvm/gems/ruby-2.0.0-p247@budget_builder/gems/poltergeist-1.3.0/lib/capybara/poltergeist/browser.rb:29:in `visit'
from /usr/local/rvm/gems/ruby-2.0.0-p247@budget_builder/gems/poltergeist-1.3.0/lib/capybara/poltergeist/driver.rb:89:in `visit'
from /usr/local/rvm/gems/ruby-2.0.0-p247@budget_builder/gems/capybara-2.1.0/lib/capybara/session.rb:193:in `visit'
from /usr/local/rvm/gems/ruby-2.0.0-p247@budget_builder/gems/snapdragon-1.0.0/lib/snapdragon/cli_application.rb:25:in `run'
To support running jasmine tests in something like Jenkins, it would be really nice for snapdragon to be able to report results in JUnit XML. See the junit_reporter.js from https://github.com/larrymyers/jasmine-reporters for a working JUnit XML reporter for Jasmine.
The most common use case where this is going to be very important is when you have a situation where you need to control order of requirements across multiple tests files.
In this scenario you would simply want a spec_helper.js
file that would have all of your require_relative() directives in it, in the correct order. Plus you could have any other setup js in the spec_helper.js
.
Then your actual spec files would only have to require_relative the spec_helper.js
and all the order issues could be controlled in a singular place. This very much follows the rspec model.
# Set the default_wait_time to something reasonable for the entire length of
# the test suite to run. This should probably eventually be something
# configurable because these could break for people with long running test
# suites.
Capybara.default_wait_time = 120 # 2 mins
discovered this trying to work around #31 if you load a relative url outside the repository it will not say file not found but when it executes your spec the variables that are defined in that file are not available to you. Example:
// require_relative('../../../../../usr/local/rvm/gems/ruby-2.0.0-p247@proposal_tool/gems/rails-assets-angular-1.2.8/vendor/assets/javascripts/angular/angular.js')
Every spec says ReferenceError: Can't find variable: angular
despite the path being correct.
Implement feature similar to --pattern flag in rspec to set a pattern for loading spec files from a location:
-P, --pattern PATTERN Load files matching pattern (default: "spec/*_/__spec.rb").
Make default pattern spec/*_/__spec.js
I looked into it a bit and it seems this is happening because the Set which makes sure unique path strings only exist once in the set, users can specify the same path in multiple ways. For example the following map to the same path in the end but their path strings are different:
// require_relative('src/hoopty.js')
// require_relative('./src/hoopty.js')
Because the path strings differ the Set doesn't identify them as being the same. I think the ideal solution would be if we could collapse the paths down to the most basic form that represents the path before it gets added to the Set. That way even if they start out different as long as they represent the same actual path they only get included once.
The use case we are looking at is certain javascript files are provided to us through gems. We can include these files in our deployed application via the //= require directive but its unclear how to test code that depends on this code from snapdragon without knowing the exact path the gem is sitting in the filesystem.
If newline does not exist, then it fails.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.