Add jasmine for demo
parent
c03c64c3a2
commit
41788bbd59
@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
"name": "jasmine-core",
|
||||||
|
"version": "2.2.1",
|
||||||
|
"homepage": "http://jasmine.github.io",
|
||||||
|
"authors": [
|
||||||
|
"slackersoft <gregg@slackersoft.net>"
|
||||||
|
],
|
||||||
|
"description": "Official packaging of Jasmine's core files",
|
||||||
|
"keywords": [
|
||||||
|
"jasmine",
|
||||||
|
"bdd"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"moduleType": "globals",
|
||||||
|
"ignore": [
|
||||||
|
"**/.*",
|
||||||
|
"dist",
|
||||||
|
"grunt",
|
||||||
|
"node_modules",
|
||||||
|
"pkg",
|
||||||
|
"release_notes",
|
||||||
|
"spec",
|
||||||
|
"src",
|
||||||
|
"Gemfile",
|
||||||
|
"Gemfile.lock",
|
||||||
|
"Rakefile",
|
||||||
|
"jasmine-core.gemspec",
|
||||||
|
"*.sh",
|
||||||
|
"*.py",
|
||||||
|
"Gruntfile.js",
|
||||||
|
"lib/jasmine-core.rb",
|
||||||
|
"lib/jasmine-core/boot/",
|
||||||
|
"lib/jasmine-core/spec",
|
||||||
|
"lib/jasmine-core/version.rb",
|
||||||
|
"lib/jasmine-core/*.py",
|
||||||
|
"sauce_connect.log"
|
||||||
|
],
|
||||||
|
"_release": "2.2.1",
|
||||||
|
"_resolution": {
|
||||||
|
"type": "version",
|
||||||
|
"tag": "v2.2.1",
|
||||||
|
"commit": "e173cd1c9dbd1ec829d03c29d1c8528982c289f4"
|
||||||
|
},
|
||||||
|
"_source": "git://github.com/pivotal/jasmine.git",
|
||||||
|
"_target": "~2.2.1",
|
||||||
|
"_originalSource": "jasmine",
|
||||||
|
"_direct": true
|
||||||
|
}
|
@ -0,0 +1,125 @@
|
|||||||
|
# Developing for Jasmine Core
|
||||||
|
|
||||||
|
We welcome your contributions - Thanks for helping make Jasmine a better project for everyone. Please review the backlog and discussion lists (the main group - [http://groups.google.com/group/jasmine-js](http://groups.google.com/group/jasmine-js) and the developer's list - [http://groups.google.com/group/jasmine-js-dev](http://groups.google.com/group/jasmine-js-dev)) before starting work - what you're looking for may already have been done. If it hasn't, the community can help make your contribution better.
|
||||||
|
|
||||||
|
## General Workflow
|
||||||
|
|
||||||
|
Please submit pull requests via feature branches using the semi-standard workflow of:
|
||||||
|
|
||||||
|
1. Fork it
|
||||||
|
1. Clone your fork: (`git clone git@github.com:yourUserName/jasmine.git`)
|
||||||
|
1. Change directory: (`cd jasmine`)
|
||||||
|
1. Assign original repository to a remote named 'upstream': (`git remote add
|
||||||
|
upstream https://github.com/jasmine/jasmine.git`)
|
||||||
|
1. Pull in changes not present in your local repository: (`git fetch upstream`)
|
||||||
|
1. Create your feature branch (`git checkout -b my-new-feature`)
|
||||||
|
1. Commit your changes (`git commit -am 'Add some feature'`)
|
||||||
|
1. Push to the branch (`git push origin my-new-feature`)
|
||||||
|
1. Create new Pull Request
|
||||||
|
|
||||||
|
We favor pull requests with very small, single commits with a single purpose.
|
||||||
|
|
||||||
|
## Background
|
||||||
|
|
||||||
|
### Directory Structure
|
||||||
|
|
||||||
|
* `/src` contains all of the source files
|
||||||
|
* `/src/console` - Node.js-specific files
|
||||||
|
* `/src/core` - generic source files
|
||||||
|
* `/src/html` - browser-specific files
|
||||||
|
* `/spec` contains all of the tests
|
||||||
|
* mirrors the source directory
|
||||||
|
* there are some additional files
|
||||||
|
* `/dist` contains the standalone distributions as zip files
|
||||||
|
* `/lib` contains the generated files for distribution as the Jasmine Rubygem and the Python package
|
||||||
|
|
||||||
|
### Self-testing
|
||||||
|
|
||||||
|
Note that Jasmine tests itself. The files in `lib` are loaded first, defining the reference `jasmine`. Then the files in `src` are loaded, defining the reference `j$`. So there are two copies of the code loaded under test.
|
||||||
|
|
||||||
|
The tests should always use `j$` to refer to the objects and functions that are being tested. But the tests can use functions on `jasmine` as needed. _Be careful how you structure any new test code_. Copy the patterns you see in the existing code - this ensures that the code you're testing is not leaking into the `jasmine` reference and vice-versa.
|
||||||
|
|
||||||
|
### `boot.js`
|
||||||
|
|
||||||
|
__This is new for Jasmine 2.0.__
|
||||||
|
|
||||||
|
This file does all of the setup necessary for Jasmine to work. It loads all of the code, creates an `Env`, attaches the global functions, and builds the reporter. It also sets up the execution of the `Env` - for browsers this is in `window.onload`. While the default in `lib` is appropriate for browsers, projects may wish to customize this file.
|
||||||
|
|
||||||
|
For example, for Jasmine development there is a different `dev_boot.js` for Jasmine development that does more work.
|
||||||
|
|
||||||
|
### Compatibility
|
||||||
|
|
||||||
|
* Browser Minimum
|
||||||
|
* IE8
|
||||||
|
* Firefox 3.x
|
||||||
|
* Chrome ??
|
||||||
|
* Safari 5
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
All source code belongs in `src/`. The `core/` directory contains the bulk of Jasmine's functionality. This code should remain browser- and environment-agnostic. If your feature or fix cannot be, as mentioned above, please degrade gracefully. Any code that should only be in a non-browser environment should live in `src/console/`. Any code that depends on a browser (specifically, it expects `window` to be the global or `document` is present) should live in `src/html/`.
|
||||||
|
|
||||||
|
### Install Dependencies
|
||||||
|
|
||||||
|
Jasmine Core relies on Ruby and Node.js.
|
||||||
|
|
||||||
|
To install the Ruby dependencies, you will need Ruby, Rubygems, and Bundler available. Then:
|
||||||
|
|
||||||
|
$ bundle
|
||||||
|
|
||||||
|
...will install all of the Ruby dependencies. If the ffi gem fails to build its native extensions, you may need to manually install some system dependencies. On Ubuntu:
|
||||||
|
|
||||||
|
$ apt-get install gcc ruby ruby-dev libxml2 libxml2-dev libxslt1-dev
|
||||||
|
|
||||||
|
...should get you to the point that `bundle` can install everything.
|
||||||
|
|
||||||
|
To install the Node dependencies, you will need Node.js, Npm, and [Grunt](http://gruntjs.com/), the [grunt-cli](https://github.com/gruntjs/grunt-cli) and ensure that `grunt` is on your path.
|
||||||
|
|
||||||
|
$ npm install --local
|
||||||
|
|
||||||
|
...will install all of the node modules locally. If when you run
|
||||||
|
|
||||||
|
$ grunt
|
||||||
|
|
||||||
|
...you see that JSHint runs your system is ready.
|
||||||
|
|
||||||
|
### How to write new Jasmine code
|
||||||
|
|
||||||
|
Or, How to make a successful pull request
|
||||||
|
|
||||||
|
* _Do not change the public interface_. Lots of projects depend on Jasmine and if you aren't careful you'll break them
|
||||||
|
* _Be environment agnostic_ - server-side developers are just as important as browser developers
|
||||||
|
* _Be browser agnostic_ - if you must rely on browser-specific functionality, please write it in a way that degrades gracefully
|
||||||
|
* _Write specs_ - Jasmine's a testing framework; don't add functionality without test-driving it
|
||||||
|
* _Write code in the style of the rest of the repo_ - Jasmine should look like a cohesive whole
|
||||||
|
* _Ensure the *entire* test suite is green_ in all the big browsers, Node, and JSHint - your contribution shouldn't break Jasmine for other users
|
||||||
|
|
||||||
|
Follow these tips and your pull request, patch, or suggestion is much more likely to be integrated.
|
||||||
|
|
||||||
|
### Running Specs
|
||||||
|
|
||||||
|
Jasmine uses the [Jasmine Ruby gem](http://github.com/jasmine/jasmine-gem) to test itself in browser.
|
||||||
|
|
||||||
|
$ rake jasmine
|
||||||
|
|
||||||
|
...and then visit `http://localhost:8888` to run specs.
|
||||||
|
|
||||||
|
Jasmine uses the [Jasmine NPM package](http://github.com/jasmine/jasmine-npm) to test itself in a Node.js/npm environment.
|
||||||
|
|
||||||
|
$ grunt execSpecsInNode
|
||||||
|
|
||||||
|
...and then the results will print to the console. All specs run except those that expect a browser (the specs in `spec/html` are ignored).
|
||||||
|
|
||||||
|
## Before Committing or Submitting a Pull Request
|
||||||
|
|
||||||
|
1. Ensure all specs are green in browser *and* node
|
||||||
|
1. Ensure JSHint is green with `grunt jshint`
|
||||||
|
1. Build `jasmine.js` with `grunt buildDistribution` and run all specs again - this ensures that your changes self-test well
|
||||||
|
|
||||||
|
## Submitting a Pull Request
|
||||||
|
1. Revert your changes to `jasmine.js` and `jasmine-html.js`
|
||||||
|
* We do this because `jasmine.js` and `jasmine-html.js` are auto-generated (as you've seen in the previous steps) and accepting multiple pull requests when this auto-generated file changes causes lots of headaches.
|
||||||
|
1. When we accept your pull request, we will generate these files as a separate commit and merge the entire branch into master.
|
||||||
|
|
||||||
|
Note that we use Travis for Continuous Integration. We only accept green pull requests.
|
||||||
|
|
@ -0,0 +1,64 @@
|
|||||||
|
# (Vague) Jasmine 2.0 Goals/(Guidelines)
|
||||||
|
|
||||||
|
1. No globals!
|
||||||
|
* jasmine library is entirely inside `jasmine` namespace
|
||||||
|
* globals required for backwards compatibility should be added in `boot.js` (EG, var describe = jasmine.getCurrentEnv().describe lives in boot.js)
|
||||||
|
1. Don't use properties as getters. Use methods.
|
||||||
|
* Properties aren't encapsulated -- can be mutated, unsafe.
|
||||||
|
1. Reporters get data objects (no methods).
|
||||||
|
* easier to refactor as needed
|
||||||
|
1. More unit tests - fewer nasty integration tests
|
||||||
|
|
||||||
|
## Remaining non-story-able work:
|
||||||
|
* Make a `TODO` list
|
||||||
|
|
||||||
|
### Hard
|
||||||
|
* Finish killing Globals
|
||||||
|
* Guidelines:
|
||||||
|
* New objects can have constructors on `jasmine`
|
||||||
|
* Top level functions can live on `jasmine`
|
||||||
|
* Top level (i.e., any `jasmine` property) should only be referenced inside the `Env` constructor
|
||||||
|
* should better allow any object to get jasmine code (Node-friendly)
|
||||||
|
* review everything in base.js
|
||||||
|
* Remove isA functions:
|
||||||
|
* isArray_ - used in matchers and spies
|
||||||
|
* isString_
|
||||||
|
* isDOMNode_
|
||||||
|
* isA_
|
||||||
|
* unimplementedMethod_, used by PrettyPrinter
|
||||||
|
* jasmine.util should be util closure inside of env or something
|
||||||
|
* argsToArray is used for Spies and matching (and can be replaced)
|
||||||
|
* inherit is only for PrettyPrinter now
|
||||||
|
* formatException is used only inside Env/spec
|
||||||
|
* htmlEscape is for messages in matchers - should this be HTML at all?
|
||||||
|
* Pretty printing
|
||||||
|
* move away from pretty printer and to a JSON.stringify implementation?
|
||||||
|
* jasmineToString vs. custom toString ?
|
||||||
|
|
||||||
|
### Easy
|
||||||
|
|
||||||
|
* unify params to ctors: options vs. attrs.
|
||||||
|
* This will be a lot of the TODOs, but clean up & simplify Env.js (is this a 2.1 task?)
|
||||||
|
|
||||||
|
### DONE
|
||||||
|
* Matchers improvements
|
||||||
|
* unit testable DONE
|
||||||
|
* better equality (from Underscore) DONE
|
||||||
|
* addCustomMatchers doesn't explode stack DONE
|
||||||
|
* refactor equals function so that it just loops & recurses over a list of fns (custom and built-in) - 2.1? (Tracker story)
|
||||||
|
* Spies
|
||||||
|
* break these out into their own tests/file DONE
|
||||||
|
|
||||||
|
|
||||||
|
## Other Topics
|
||||||
|
|
||||||
|
* Docs
|
||||||
|
* Docco has gone over well. Should we annotate all the sources and then have Pages be more complex, having tutorials and annotated source like Backbone? Are we small enough?
|
||||||
|
* Need examples for:
|
||||||
|
* How to build a Custom Matcher
|
||||||
|
* How to add a custom equality tester
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
|||||||
|
recursive-include . *.py
|
||||||
|
include lib/jasmine-core/*.js
|
||||||
|
include lib/jasmine-core/*.css
|
||||||
|
include images/*.png
|
||||||
|
include package.json
|
@ -0,0 +1,20 @@
|
|||||||
|
Copyright (c) 2008-2014 Pivotal Labs
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@ -0,0 +1,71 @@
|
|||||||
|
<a name="README">[<img src="https://rawgithub.com/jasmine/jasmine/master/images/jasmine-horizontal.svg" width="400px" />](http://jasmine.github.io)</a>
|
||||||
|
|
||||||
|
[![Build Status](https://travis-ci.org/jasmine/jasmine.png?branch=master)](https://travis-ci.org/jasmine/jasmine) [![Code Climate](https://codeclimate.com/github/pivotal/jasmine.png)](https://codeclimate.com/github/pivotal/jasmine)
|
||||||
|
|
||||||
|
=======
|
||||||
|
|
||||||
|
**A JavaScript Testing Framework**
|
||||||
|
|
||||||
|
Jasmine is a Behavior Driven Development testing framework for JavaScript. It does not rely on browsers, DOM, or any JavaScript framework. Thus it's suited for websites, [Node.js](http://nodejs.org) projects, or anywhere that JavaScript can run.
|
||||||
|
|
||||||
|
Documentation & guides live here: [http://jasmine.github.io](http://jasmine.github.io/)
|
||||||
|
For a quick start guide of Jasmine 2.0, see the beginning of [http://jasmine.github.io/2.0/introduction.html](http://jasmine.github.io/2.0/introduction.html)
|
||||||
|
|
||||||
|
Upgrading from Jasmine 1.x? Check out the [2.0 release notes](https://github.com/jasmine/jasmine/blob/v2.0.0/release_notes/20.md) for a list of what's new (including breaking interface changes). You can also read the [upgrade guide](http://jasmine.github.io/2.0/upgrading.html).
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Please read the [contributors' guide](https://github.com/jasmine/jasmine/blob/master/CONTRIBUTING.md)
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
For the Jasmine NPM module:<br>
|
||||||
|
[https://github.com/jasmine/jasmine-npm](https://github.com/jasmine/jasmine-npm)
|
||||||
|
|
||||||
|
For the Jasmine Ruby Gem:<br>
|
||||||
|
[https://github.com/jasmine/jasmine-gem](https://github.com/jasmine/jasmine-gem)
|
||||||
|
|
||||||
|
For the Jasmine Python Egg:<br>
|
||||||
|
[https://github.com/jasmine/jasmine-py](https://github.com/jasmine/jasmine-py)
|
||||||
|
|
||||||
|
To install Jasmine on your local box:
|
||||||
|
|
||||||
|
* Clone Jasmine - `git clone https://github.com/jasmine/jasmine.git`
|
||||||
|
* Create a Jasmine directory in your project - `mkdir my-project/jasmine`
|
||||||
|
* Move latest dist to your project directory - `mv jasmine/dist/jasmine-standalone-2.0.0.zip my-project/jasmine`
|
||||||
|
* Change directory - `cd my-project/jasmine`
|
||||||
|
* Unzip the dist - `unzip jasmine-standalone-2.0.0.zip`
|
||||||
|
|
||||||
|
Add the following to your HTML file:
|
||||||
|
|
||||||
|
<link rel="shortcut icon" type="image/png" href="jasmine/lib/jasmine-2.0.0/jasmine_favicon.png">
|
||||||
|
<link rel="stylesheet" type="text/css" href="jasmine/lib/jasmine-2.0.0/jasmine.css">
|
||||||
|
|
||||||
|
<script type="text/javascript" src="jasmine/lib/jasmine-2.0.0/jasmine.js"></script>
|
||||||
|
<script type="text/javascript" src="jasmine/lib/jasmine-2.0.0/jasmine-html.js"></script>
|
||||||
|
<script type="text/javascript" src="jasmine/lib/jasmine-2.0.0/boot.js"></script>
|
||||||
|
|
||||||
|
## Supported environments
|
||||||
|
|
||||||
|
Jasmine tests itself across many browsers (Safari, Chrome, Firefox, PhantomJS, and new Internet Explorer) as well as node. To see the exact version tests are run against look at our [.travis.yml](https://github.com/jasmine/jasmine/blob/master/.travis.yml)
|
||||||
|
|
||||||
|
|
||||||
|
## Support
|
||||||
|
|
||||||
|
* Search past discussions: [http://groups.google.com/group/jasmine-js](http://groups.google.com/group/jasmine-js)
|
||||||
|
* Send an email to the list: [jasmine-js@googlegroups.com](mailto:jasmine-js@googlegroups.com)
|
||||||
|
* View the project backlog at Pivotal Tracker: [http://www.pivotaltracker.com/projects/10606](http://www.pivotaltracker.com/projects/10606)
|
||||||
|
* Follow us on Twitter: [@JasmineBDD](http://twitter.com/JasmineBDD)
|
||||||
|
|
||||||
|
## Maintainers
|
||||||
|
|
||||||
|
* [Davis W. Frank](mailto:dwfrank@pivotal.io), Pivotal Labs
|
||||||
|
* [Rajan Agaskar](mailto:rajan@pivotal.io), Pivotal Labs
|
||||||
|
* [Gregg Van Hove](mailto:gvanhove@pivotal.io), Pivotal Labs
|
||||||
|
|
||||||
|
### Maintainers Emeritus
|
||||||
|
|
||||||
|
* [Christian Williams](mailto:antixian666@gmail.com), Cloud Foundry
|
||||||
|
* Sheel Choksi
|
||||||
|
|
||||||
|
Copyright (c) 2008-2014 Pivotal Labs. This software is licensed under the MIT License.
|
@ -0,0 +1,75 @@
|
|||||||
|
# How to work on a Jasmine Release
|
||||||
|
|
||||||
|
## Development
|
||||||
|
___Jasmine Core Maintainers Only___
|
||||||
|
|
||||||
|
Follow the instructions in `CONTRIBUTING.md` during development.
|
||||||
|
|
||||||
|
### Git Rules
|
||||||
|
|
||||||
|
Please work on feature branches.
|
||||||
|
|
||||||
|
Please attempt to keep commits to `master` small, but cohesive. If a feature is contained in a bunch of small commits (e.g., it has several wip commits or small work), please squash them when merging back to `master`.
|
||||||
|
|
||||||
|
### Version
|
||||||
|
|
||||||
|
We attempt to stick to [Semantic Versioning](http://semver.org/). Most of the time, development should be against a new minor version - fixing bugs and adding new features that are backwards compatible.
|
||||||
|
|
||||||
|
The current version lives in the file `/package.json`. This version will be the version number that is currently released. When releasing a new version, update `package.json` and `bower.json` with the new version and `grunt build:copyVersionToGem` to update the gem version number.
|
||||||
|
|
||||||
|
This version is used by both `jasmine.js` and the `jasmine-core` Ruby gem.
|
||||||
|
|
||||||
|
Note that Jasmine should only use the "patch" version number in the following cases:
|
||||||
|
|
||||||
|
* Changes related to packaging for a specific platform (npm, gem, or pip).
|
||||||
|
* Fixes for regressions.
|
||||||
|
|
||||||
|
When jasmine-core revs its major or minor version, the binding libraries should also rev to that version.
|
||||||
|
|
||||||
|
## Release
|
||||||
|
|
||||||
|
When ready to release - specs are all green and the stories are done:
|
||||||
|
|
||||||
|
1. Update the release notes in `release_notes` - use the Anchorman gem to generate the markdown file and edit accordingly
|
||||||
|
1. Update the version in `package.json` to a release candidate
|
||||||
|
1. Update any links or top-level landing page for the Github Pages
|
||||||
|
|
||||||
|
### Build standalone distribution
|
||||||
|
|
||||||
|
1. Build the standalone distribution with `grunt buildStandaloneDist`
|
||||||
|
1. Make sure you add the new ZIP file to git
|
||||||
|
1. Should we still do this? Given we want to use github releases...
|
||||||
|
|
||||||
|
### Release the Python egg
|
||||||
|
|
||||||
|
1. `python setup.py register sdist upload` You will need pypi credentials to upload the egg.
|
||||||
|
|
||||||
|
### Release the Ruby gem
|
||||||
|
|
||||||
|
1. Copy version to the Ruby gem with `grunt build:copyVersionToGem`
|
||||||
|
1. __NOTE__: You will likely need to point to a local jasmine gem in order to run tests locally. _Do not_ push this version of the Gemfile.
|
||||||
|
1. __NOTE__: You will likely need to push a new jasmine gem with a dependent version right after this release.
|
||||||
|
1. Push these changes to GitHub and verify that this SHA is green
|
||||||
|
1. `rake release` - tags the repo with the version, builds the `jasmine-core` gem, pushes the gem to Rubygems.org. In order to release you will have to ensure you have rubygems creds locally.
|
||||||
|
|
||||||
|
### Release the NPM
|
||||||
|
|
||||||
|
1. `npm adduser` to save your credentials locally
|
||||||
|
1. `npm publish .` to publish what's in `package.json`
|
||||||
|
|
||||||
|
### Release the docs
|
||||||
|
|
||||||
|
Probably only need to do this when releasing a minor version, and not a patch version.
|
||||||
|
|
||||||
|
1. `cp edge ${version}` to copy the current edge docs to the new version
|
||||||
|
1. Add a link to the new version in `index.html`
|
||||||
|
|
||||||
|
### Finally
|
||||||
|
|
||||||
|
1. Visit the [Releases page for Jasmine](https://github.com/jasmine/jasmine/releases), find the tag just pushed.
|
||||||
|
1. Paste in a link to the correct release notes for this release. The link should reference the blob and tag correctly, and the markdown file for the notes.
|
||||||
|
1. If it is a pre-release, mark it as such.
|
||||||
|
1. Attach the standalone zipfile
|
||||||
|
|
||||||
|
|
||||||
|
There should be a post to Pivotal Labs blog and a tweet to that link.
|
@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"name": "jasmine-core",
|
||||||
|
"version": "2.2.1",
|
||||||
|
"homepage": "http://jasmine.github.io",
|
||||||
|
"authors": [
|
||||||
|
"slackersoft <gregg@slackersoft.net>"
|
||||||
|
],
|
||||||
|
"description": "Official packaging of Jasmine's core files",
|
||||||
|
"keywords": [
|
||||||
|
"jasmine",
|
||||||
|
"bdd"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"moduleType": "globals",
|
||||||
|
"ignore": [
|
||||||
|
"**/.*",
|
||||||
|
"dist",
|
||||||
|
"grunt",
|
||||||
|
"node_modules",
|
||||||
|
"pkg",
|
||||||
|
"release_notes",
|
||||||
|
"spec",
|
||||||
|
"src",
|
||||||
|
"Gemfile",
|
||||||
|
"Gemfile.lock",
|
||||||
|
"Rakefile",
|
||||||
|
"jasmine-core.gemspec",
|
||||||
|
"*.sh",
|
||||||
|
"*.py",
|
||||||
|
"Gruntfile.js",
|
||||||
|
"lib/jasmine-core.rb",
|
||||||
|
"lib/jasmine-core/boot/",
|
||||||
|
"lib/jasmine-core/spec",
|
||||||
|
"lib/jasmine-core/version.rb",
|
||||||
|
"lib/jasmine-core/*.py",
|
||||||
|
"sauce_connect.log"
|
||||||
|
]
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
@ -0,0 +1,102 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
version="1.1"
|
||||||
|
width="681.96252"
|
||||||
|
height="187.5"
|
||||||
|
id="svg2"
|
||||||
|
xml:space="preserve"><metadata
|
||||||
|
id="metadata8"><rdf:RDF><cc:Work
|
||||||
|
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
|
||||||
|
id="defs6"><clipPath
|
||||||
|
id="clipPath18"><path
|
||||||
|
d="M 0,1500 0,0 l 5455.74,0 0,1500 L 0,1500 z"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path20" /></clipPath></defs><g
|
||||||
|
transform="matrix(1.25,0,0,-1.25,0,187.5)"
|
||||||
|
id="g10"><g
|
||||||
|
transform="scale(0.1,0.1)"
|
||||||
|
id="g12"><g
|
||||||
|
id="g14"><g
|
||||||
|
clip-path="url(#clipPath18)"
|
||||||
|
id="g16"><path
|
||||||
|
d="m 1544,599.434 c 0.92,-40.352 25.68,-81.602 71.53,-81.602 27.51,0 47.68,12.832 61.44,35.754 12.83,22.93 12.83,56.852 12.83,82.527 l 0,329.184 -71.52,0 0,104.543 266.83,0 0,-104.543 -70.6,0 0,-344.77 c 0,-58.691 -3.68,-104.531 -44.93,-152.218 -36.68,-42.18 -96.28,-66.02 -153.14,-66.02 -117.37,0 -207.24,77.941 -202.64,197.145 l 130.2,0"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path22"
|
||||||
|
style="fill:#8a4182;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
|
||||||
|
d="m 2301.4,662.695 c 0,80.703 -66.94,145.813 -147.63,145.813 -83.44,0 -147.63,-68.781 -147.63,-151.301 0,-79.785 66.94,-145.801 145.8,-145.801 84.35,0 149.46,67.852 149.46,151.289 z m -1.83,-181.547 c -35.77,-54.097 -93.53,-78.859 -157.72,-78.859 -140.3,0 -251.24,116.449 -251.24,254.918 0,142.129 113.7,260.41 256.74,260.41 63.27,0 118.29,-29.336 152.22,-82.523 l 0,69.687 175.14,0 0,-104.527 -61.44,0 0,-280.598 61.44,0 0,-104.527 -175.14,0 0,66.019"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path24"
|
||||||
|
style="fill:#8a4182;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
|
||||||
|
d="m 2622.33,557.258 c 3.67,-44.016 33.01,-73.348 78.86,-73.348 33.93,0 66.93,23.824 66.93,60.504 0,48.606 -45.84,56.856 -83.44,66.941 -85.28,22.004 -178.81,48.606 -178.81,155.879 0,93.536 78.86,147.633 165.98,147.633 44,0 83.43,-9.176 110.94,-44.008 l 0,33.922 82.53,0 0,-132.965 -108.21,0 c -1.83,34.856 -28.42,57.774 -63.26,57.774 -30.26,0 -62.35,-17.422 -62.35,-51.348 0,-45.847 44.93,-55.93 80.69,-64.18 88.02,-20.175 182.47,-47.695 182.47,-157.734 0,-99.027 -83.44,-154.039 -175.13,-154.039 -49.53,0 -94.46,15.582 -126.55,53.18 l 0,-40.34 -85.27,0 0,142.129 114.62,0"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path26"
|
||||||
|
style="fill:#8a4182;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
|
||||||
|
d="m 2988.18,800.254 -63.26,0 0,104.527 165.05,0 0,-73.355 c 31.18,51.347 78.86,85.277 141.21,85.277 67.85,0 124.71,-41.258 152.21,-102.699 26.6,62.351 92.62,102.699 160.47,102.699 53.19,0 105.46,-22 141.21,-62.351 38.52,-44.938 38.52,-93.532 38.52,-149.457 l 0,-185.239 63.27,0 0,-104.527 -238.42,0 0,104.527 63.28,0 0,157.715 c 0,32.102 0,60.527 -14.67,88.957 -18.34,26.582 -48.61,40.344 -79.77,40.344 -30.26,0 -63.28,-12.844 -82.53,-36.672 -22.93,-29.355 -22.93,-56.863 -22.93,-92.629 l 0,-157.715 63.27,0 0,-104.527 -238.41,0 0,104.527 63.28,0 0,150.383 c 0,29.348 0,66.023 -14.67,91.699 -15.59,29.336 -47.69,44.934 -80.7,44.934 -31.18,0 -57.77,-11.008 -77.94,-35.774 -24.77,-30.253 -26.6,-62.343 -26.6,-99.941 l 0,-151.301 63.27,0 0,-104.527 -238.4,0 0,104.527 63.26,0 0,280.598"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path28"
|
||||||
|
style="fill:#8a4182;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
|
||||||
|
d="m 3998.66,951.547 -111.87,0 0,118.293 111.87,0 0,-118.293 z m 0,-431.891 63.27,0 0,-104.527 -239.33,0 0,104.527 64.19,0 0,280.598 -63.27,0 0,104.527 175.14,0 0,-385.125"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path30"
|
||||||
|
style="fill:#8a4182;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
|
||||||
|
d="m 4159.12,800.254 -63.27,0 0,104.527 175.14,0 0,-69.687 c 29.35,54.101 84.36,80.699 144.87,80.699 53.19,0 105.45,-22.016 141.22,-60.527 40.34,-44.934 41.26,-88.032 41.26,-143.957 l 0,-191.653 63.27,0 0,-104.527 -238.4,0 0,104.527 63.26,0 0,158.637 c 0,30.262 0,61.434 -19.26,88.035 -20.17,26.582 -53.18,39.414 -86.19,39.414 -33.93,0 -68.77,-13.75 -88.94,-41.25 -21.09,-27.5 -21.09,-69.687 -21.09,-102.707 l 0,-142.129 63.26,0 0,-104.527 -238.4,0 0,104.527 63.27,0 0,280.598"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path32"
|
||||||
|
style="fill:#8a4182;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
|
||||||
|
d="m 5082.48,703.965 c -19.24,70.605 -81.6,115.547 -154.04,115.547 -66.04,0 -129.3,-51.348 -143.05,-115.547 l 297.09,0 z m 85.27,-144.883 c -38.51,-93.523 -129.27,-156.793 -231.05,-156.793 -143.07,0 -257.68,111.871 -257.68,255.836 0,144.883 109.12,261.328 254.91,261.328 67.87,0 135.72,-30.258 183.39,-78.863 48.62,-51.344 68.79,-113.695 68.79,-183.383 l -3.67,-39.434 -396.13,0 c 14.67,-67.863 77.03,-117.363 146.72,-117.363 48.59,0 90.76,18.328 118.28,58.672 l 116.44,0"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path34"
|
||||||
|
style="fill:#8a4182;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
|
||||||
|
d="m 690.895,850.703 90.75,0 22.543,31.035 0,243.122 -135.829,0 0,-243.141 22.536,-31.016"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path36"
|
||||||
|
style="fill:#8a4182;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
|
||||||
|
d="m 632.395,742.258 28.039,86.304 -22.551,31.04 -231.223,75.128 -41.976,-129.183 231.257,-75.137 36.454,11.848"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path38"
|
||||||
|
style="fill:#8a4182;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
|
||||||
|
d="m 717.449,653.105 -73.41,53.36 -36.488,-11.875 -142.903,-196.692 109.883,-79.828 142.918,196.703 0,38.332"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path40"
|
||||||
|
style="fill:#8a4182;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
|
||||||
|
d="m 828.52,706.465 -73.426,-53.34 0.011,-38.359 L 898.004,418.07 1007.9,497.898 864.973,694.609 828.52,706.465"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path42"
|
||||||
|
style="fill:#8a4182;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
|
||||||
|
d="m 812.086,828.586 28.055,-86.32 36.484,-11.836 231.225,75.117 -41.97,129.183 -231.239,-75.14 -22.555,-31.004"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path44"
|
||||||
|
style="fill:#8a4182;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
|
||||||
|
d="m 736.301,1335.88 c -323.047,0 -585.875,-262.78 -585.875,-585.782 0,-323.118 262.828,-585.977 585.875,-585.977 323.019,0 585.809,262.859 585.809,585.977 0,323.002 -262.79,585.782 -585.809,585.782 l 0,0 z m 0,-118.61 c 257.972,0 467.189,-209.13 467.189,-467.172 0,-258.129 -209.217,-467.348 -467.189,-467.348 -258.074,0 -467.254,209.219 -467.254,467.348 0,258.042 209.18,467.172 467.254,467.172"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path46"
|
||||||
|
style="fill:#8a4182;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
|
||||||
|
d="m 1091.13,619.883 -175.771,57.121 11.629,35.808 175.762,-57.121 -11.62,-35.808"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path48"
|
||||||
|
style="fill:#8a4182;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
|
||||||
|
d="M 866.957,902.074 836.5,924.199 945.121,1073.73 975.586,1051.61 866.957,902.074"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path50"
|
||||||
|
style="fill:#8a4182;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
|
||||||
|
d="M 607.465,903.445 498.855,1052.97 529.32,1075.1 637.93,925.566 607.465,903.445"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path52"
|
||||||
|
style="fill:#8a4182;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
|
||||||
|
d="m 380.688,622.129 -11.626,35.801 175.758,57.09 11.621,-35.801 -175.753,-57.09"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path54"
|
||||||
|
style="fill:#8a4182;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
|
||||||
|
d="m 716.289,376.59 37.6406,0 0,184.816 -37.6406,0 0,-184.816 z"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path56"
|
||||||
|
style="fill:#8a4182;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g></g></g></g></svg>
|
After Width: | Height: | Size: 8.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,190 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2008-2015 Pivotal Labs
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
function getJasmineRequireObj() {
|
||||||
|
if (typeof module !== 'undefined' && module.exports) {
|
||||||
|
return exports;
|
||||||
|
} else {
|
||||||
|
window.jasmineRequire = window.jasmineRequire || {};
|
||||||
|
return window.jasmineRequire;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getJasmineRequireObj().console = function(jRequire, j$) {
|
||||||
|
j$.ConsoleReporter = jRequire.ConsoleReporter();
|
||||||
|
};
|
||||||
|
|
||||||
|
getJasmineRequireObj().ConsoleReporter = function() {
|
||||||
|
|
||||||
|
var noopTimer = {
|
||||||
|
start: function(){},
|
||||||
|
elapsed: function(){ return 0; }
|
||||||
|
};
|
||||||
|
|
||||||
|
function ConsoleReporter(options) {
|
||||||
|
var print = options.print,
|
||||||
|
showColors = options.showColors || false,
|
||||||
|
onComplete = options.onComplete || function() {},
|
||||||
|
timer = options.timer || noopTimer,
|
||||||
|
specCount,
|
||||||
|
failureCount,
|
||||||
|
failedSpecs = [],
|
||||||
|
pendingCount,
|
||||||
|
ansi = {
|
||||||
|
green: '\x1B[32m',
|
||||||
|
red: '\x1B[31m',
|
||||||
|
yellow: '\x1B[33m',
|
||||||
|
none: '\x1B[0m'
|
||||||
|
},
|
||||||
|
failedSuites = [];
|
||||||
|
|
||||||
|
print('ConsoleReporter is deprecated and will be removed in a future version.');
|
||||||
|
|
||||||
|
this.jasmineStarted = function() {
|
||||||
|
specCount = 0;
|
||||||
|
failureCount = 0;
|
||||||
|
pendingCount = 0;
|
||||||
|
print('Started');
|
||||||
|
printNewline();
|
||||||
|
timer.start();
|
||||||
|
};
|
||||||
|
|
||||||
|
this.jasmineDone = function() {
|
||||||
|
printNewline();
|
||||||
|
for (var i = 0; i < failedSpecs.length; i++) {
|
||||||
|
specFailureDetails(failedSpecs[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(specCount > 0) {
|
||||||
|
printNewline();
|
||||||
|
|
||||||
|
var specCounts = specCount + ' ' + plural('spec', specCount) + ', ' +
|
||||||
|
failureCount + ' ' + plural('failure', failureCount);
|
||||||
|
|
||||||
|
if (pendingCount) {
|
||||||
|
specCounts += ', ' + pendingCount + ' pending ' + plural('spec', pendingCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
print(specCounts);
|
||||||
|
} else {
|
||||||
|
print('No specs found');
|
||||||
|
}
|
||||||
|
|
||||||
|
printNewline();
|
||||||
|
var seconds = timer.elapsed() / 1000;
|
||||||
|
print('Finished in ' + seconds + ' ' + plural('second', seconds));
|
||||||
|
printNewline();
|
||||||
|
|
||||||
|
for(i = 0; i < failedSuites.length; i++) {
|
||||||
|
suiteFailureDetails(failedSuites[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
onComplete(failureCount === 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.specDone = function(result) {
|
||||||
|
specCount++;
|
||||||
|
|
||||||
|
if (result.status == 'pending') {
|
||||||
|
pendingCount++;
|
||||||
|
print(colored('yellow', '*'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.status == 'passed') {
|
||||||
|
print(colored('green', '.'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.status == 'failed') {
|
||||||
|
failureCount++;
|
||||||
|
failedSpecs.push(result);
|
||||||
|
print(colored('red', 'F'));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.suiteDone = function(result) {
|
||||||
|
if (result.failedExpectations && result.failedExpectations.length > 0) {
|
||||||
|
failureCount++;
|
||||||
|
failedSuites.push(result);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return this;
|
||||||
|
|
||||||
|
function printNewline() {
|
||||||
|
print('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
function colored(color, str) {
|
||||||
|
return showColors ? (ansi[color] + str + ansi.none) : str;
|
||||||
|
}
|
||||||
|
|
||||||
|
function plural(str, count) {
|
||||||
|
return count == 1 ? str : str + 's';
|
||||||
|
}
|
||||||
|
|
||||||
|
function repeat(thing, times) {
|
||||||
|
var arr = [];
|
||||||
|
for (var i = 0; i < times; i++) {
|
||||||
|
arr.push(thing);
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
function indent(str, spaces) {
|
||||||
|
var lines = (str || '').split('\n');
|
||||||
|
var newArr = [];
|
||||||
|
for (var i = 0; i < lines.length; i++) {
|
||||||
|
newArr.push(repeat(' ', spaces).join('') + lines[i]);
|
||||||
|
}
|
||||||
|
return newArr.join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
function specFailureDetails(result) {
|
||||||
|
printNewline();
|
||||||
|
print(result.fullName);
|
||||||
|
|
||||||
|
for (var i = 0; i < result.failedExpectations.length; i++) {
|
||||||
|
var failedExpectation = result.failedExpectations[i];
|
||||||
|
printNewline();
|
||||||
|
print(indent(failedExpectation.message, 2));
|
||||||
|
print(indent(failedExpectation.stack, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
printNewline();
|
||||||
|
}
|
||||||
|
|
||||||
|
function suiteFailureDetails(result) {
|
||||||
|
for (var i = 0; i < result.failedExpectations.length; i++) {
|
||||||
|
printNewline();
|
||||||
|
print(colored('red', 'An error was thrown in an afterAll'));
|
||||||
|
printNewline();
|
||||||
|
print(colored('red', 'AfterAll ' + result.failedExpectations[i].message));
|
||||||
|
|
||||||
|
}
|
||||||
|
printNewline();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ConsoleReporter;
|
||||||
|
};
|
@ -0,0 +1,37 @@
|
|||||||
|
module.exports = require("./jasmine-core/jasmine.js");
|
||||||
|
module.exports.boot = require('./jasmine-core/node_boot.js');
|
||||||
|
|
||||||
|
var path = require('path'),
|
||||||
|
fs = require('fs');
|
||||||
|
|
||||||
|
var rootPath = path.join(__dirname, "jasmine-core"),
|
||||||
|
bootFiles = ['boot.js'],
|
||||||
|
nodeBootFiles = ['node_boot.js'],
|
||||||
|
cssFiles = [],
|
||||||
|
jsFiles = [],
|
||||||
|
jsFilesToSkip = ['jasmine.js'].concat(bootFiles, nodeBootFiles);
|
||||||
|
|
||||||
|
fs.readdirSync(rootPath).forEach(function(file) {
|
||||||
|
if(fs.statSync(path.join(rootPath, file)).isFile()) {
|
||||||
|
switch(path.extname(file)) {
|
||||||
|
case '.css':
|
||||||
|
cssFiles.push(file);
|
||||||
|
break;
|
||||||
|
case '.js':
|
||||||
|
if (jsFilesToSkip.indexOf(file) < 0) {
|
||||||
|
jsFiles.push(file);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports.files = {
|
||||||
|
path: rootPath,
|
||||||
|
bootDir: rootPath,
|
||||||
|
bootFiles: bootFiles,
|
||||||
|
nodeBootFiles: nodeBootFiles,
|
||||||
|
cssFiles: cssFiles,
|
||||||
|
jsFiles: ['jasmine.js'].concat(jsFiles),
|
||||||
|
imagesDir: path.join(__dirname, '../images')
|
||||||
|
};
|
@ -0,0 +1,143 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2008-2015 Pivotal Labs
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
Starting with version 2.0, this file "boots" Jasmine, performing all of the necessary initialization before executing the loaded environment and all of a project's specs. This file should be loaded after `jasmine.js` and `jasmine_html.js`, but before any project source files or spec files are loaded. Thus this file can also be used to customize Jasmine for a project.
|
||||||
|
|
||||||
|
If a project is using Jasmine via the standalone distribution, this file can be customized directly. If a project is using Jasmine via the [Ruby gem][jasmine-gem], this file can be copied into the support directory via `jasmine copy_boot_js`. Other environments (e.g., Python) will have different mechanisms.
|
||||||
|
|
||||||
|
The location of `boot.js` can be specified and/or overridden in `jasmine.yml`.
|
||||||
|
|
||||||
|
[jasmine-gem]: http://github.com/pivotal/jasmine-gem
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ## Require & Instantiate
|
||||||
|
*
|
||||||
|
* Require Jasmine's core files. Specifically, this requires and attaches all of Jasmine's code to the `jasmine` reference.
|
||||||
|
*/
|
||||||
|
window.jasmine = jasmineRequire.core(jasmineRequire);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Since this is being run in a browser and the results should populate to an HTML page, require the HTML-specific Jasmine code, injecting the same reference.
|
||||||
|
*/
|
||||||
|
jasmineRequire.html(jasmine);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the Jasmine environment. This is used to run all specs in a project.
|
||||||
|
*/
|
||||||
|
var env = jasmine.getEnv();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ## The Global Interface
|
||||||
|
*
|
||||||
|
* Build up the functions that will be exposed as the Jasmine public interface. A project can customize, rename or alias any of these functions as desired, provided the implementation remains unchanged.
|
||||||
|
*/
|
||||||
|
var jasmineInterface = jasmineRequire.interface(jasmine, env);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add all of the Jasmine global/public interface to the proper global, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`.
|
||||||
|
*/
|
||||||
|
if (typeof window == "undefined" && typeof exports == "object") {
|
||||||
|
extend(exports, jasmineInterface);
|
||||||
|
} else {
|
||||||
|
extend(window, jasmineInterface);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ## Runner Parameters
|
||||||
|
*
|
||||||
|
* More browser specific code - wrap the query string in an object and to allow for getting/setting parameters from the runner user interface.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var queryString = new jasmine.QueryString({
|
||||||
|
getWindowLocation: function() { return window.location; }
|
||||||
|
});
|
||||||
|
|
||||||
|
var catchingExceptions = queryString.getParam("catch");
|
||||||
|
env.catchExceptions(typeof catchingExceptions === "undefined" ? true : catchingExceptions);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ## Reporters
|
||||||
|
* The `HtmlReporter` builds all of the HTML UI for the runner page. This reporter paints the dots, stars, and x's for specs, as well as all spec names and all failures (if any).
|
||||||
|
*/
|
||||||
|
var htmlReporter = new jasmine.HtmlReporter({
|
||||||
|
env: env,
|
||||||
|
onRaiseExceptionsClick: function() { queryString.navigateWithNewParam("catch", !env.catchingExceptions()); },
|
||||||
|
addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); },
|
||||||
|
getContainer: function() { return document.body; },
|
||||||
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
||||||
|
createTextNode: function() { return document.createTextNode.apply(document, arguments); },
|
||||||
|
timer: new jasmine.Timer()
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The `jsApiReporter` also receives spec results, and is used by any environment that needs to extract the results from JavaScript.
|
||||||
|
*/
|
||||||
|
env.addReporter(jasmineInterface.jsApiReporter);
|
||||||
|
env.addReporter(htmlReporter);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter which specs will be run by matching the start of the full name against the `spec` query param.
|
||||||
|
*/
|
||||||
|
var specFilter = new jasmine.HtmlSpecFilter({
|
||||||
|
filterString: function() { return queryString.getParam("spec"); }
|
||||||
|
});
|
||||||
|
|
||||||
|
env.specFilter = function(spec) {
|
||||||
|
return specFilter.matches(spec.getFullName());
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setting up timing functions to be able to be overridden. Certain browsers (Safari, IE 8, phantomjs) require this hack.
|
||||||
|
*/
|
||||||
|
window.setTimeout = window.setTimeout;
|
||||||
|
window.setInterval = window.setInterval;
|
||||||
|
window.clearTimeout = window.clearTimeout;
|
||||||
|
window.clearInterval = window.clearInterval;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ## Execution
|
||||||
|
*
|
||||||
|
* Replace the browser window's `onload`, ensure it's called, and then run all of the loaded specs. This includes initializing the `HtmlReporter` instance and then executing the loaded Jasmine environment. All of this will happen after all of the specs are loaded.
|
||||||
|
*/
|
||||||
|
var currentWindowOnload = window.onload;
|
||||||
|
|
||||||
|
window.onload = function() {
|
||||||
|
if (currentWindowOnload) {
|
||||||
|
currentWindowOnload();
|
||||||
|
}
|
||||||
|
htmlReporter.initialize();
|
||||||
|
env.execute();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function for readability above.
|
||||||
|
*/
|
||||||
|
function extend(destination, source) {
|
||||||
|
for (var property in source) destination[property] = source[property];
|
||||||
|
return destination;
|
||||||
|
}
|
||||||
|
|
||||||
|
}());
|
@ -0,0 +1,24 @@
|
|||||||
|
function Player() {
|
||||||
|
}
|
||||||
|
Player.prototype.play = function(song) {
|
||||||
|
this.currentlyPlayingSong = song;
|
||||||
|
this.isPlaying = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
Player.prototype.pause = function() {
|
||||||
|
this.isPlaying = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
Player.prototype.resume = function() {
|
||||||
|
if (this.isPlaying) {
|
||||||
|
throw new Error("song is already playing");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isPlaying = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
Player.prototype.makeFavorite = function() {
|
||||||
|
this.currentlyPlayingSong.persistFavoriteStatus(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = Player;
|
@ -0,0 +1,9 @@
|
|||||||
|
function Song() {
|
||||||
|
}
|
||||||
|
|
||||||
|
Song.prototype.persistFavoriteStatus = function(value) {
|
||||||
|
// something complicated
|
||||||
|
throw new Error("not yet implemented");
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = Song;
|
@ -0,0 +1,416 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2008-2015 Pivotal Labs
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
jasmineRequire.html = function(j$) {
|
||||||
|
j$.ResultsNode = jasmineRequire.ResultsNode();
|
||||||
|
j$.HtmlReporter = jasmineRequire.HtmlReporter(j$);
|
||||||
|
j$.QueryString = jasmineRequire.QueryString();
|
||||||
|
j$.HtmlSpecFilter = jasmineRequire.HtmlSpecFilter();
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmineRequire.HtmlReporter = function(j$) {
|
||||||
|
|
||||||
|
var noopTimer = {
|
||||||
|
start: function() {},
|
||||||
|
elapsed: function() { return 0; }
|
||||||
|
};
|
||||||
|
|
||||||
|
function HtmlReporter(options) {
|
||||||
|
var env = options.env || {},
|
||||||
|
getContainer = options.getContainer,
|
||||||
|
createElement = options.createElement,
|
||||||
|
createTextNode = options.createTextNode,
|
||||||
|
onRaiseExceptionsClick = options.onRaiseExceptionsClick || function() {},
|
||||||
|
addToExistingQueryString = options.addToExistingQueryString || defaultQueryString,
|
||||||
|
timer = options.timer || noopTimer,
|
||||||
|
results = [],
|
||||||
|
specsExecuted = 0,
|
||||||
|
failureCount = 0,
|
||||||
|
pendingSpecCount = 0,
|
||||||
|
htmlReporterMain,
|
||||||
|
symbols,
|
||||||
|
failedSuites = [];
|
||||||
|
|
||||||
|
this.initialize = function() {
|
||||||
|
clearPrior();
|
||||||
|
htmlReporterMain = createDom('div', {className: 'jasmine_html-reporter'},
|
||||||
|
createDom('div', {className: 'banner'},
|
||||||
|
createDom('a', {className: 'title', href: 'http://jasmine.github.io/', target: '_blank'}),
|
||||||
|
createDom('span', {className: 'version'}, j$.version)
|
||||||
|
),
|
||||||
|
createDom('ul', {className: 'symbol-summary'}),
|
||||||
|
createDom('div', {className: 'alert'}),
|
||||||
|
createDom('div', {className: 'results'},
|
||||||
|
createDom('div', {className: 'failures'})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
getContainer().appendChild(htmlReporterMain);
|
||||||
|
|
||||||
|
symbols = find('.symbol-summary');
|
||||||
|
};
|
||||||
|
|
||||||
|
var totalSpecsDefined;
|
||||||
|
this.jasmineStarted = function(options) {
|
||||||
|
totalSpecsDefined = options.totalSpecsDefined || 0;
|
||||||
|
timer.start();
|
||||||
|
};
|
||||||
|
|
||||||
|
var summary = createDom('div', {className: 'summary'});
|
||||||
|
|
||||||
|
var topResults = new j$.ResultsNode({}, '', null),
|
||||||
|
currentParent = topResults;
|
||||||
|
|
||||||
|
this.suiteStarted = function(result) {
|
||||||
|
currentParent.addChild(result, 'suite');
|
||||||
|
currentParent = currentParent.last();
|
||||||
|
};
|
||||||
|
|
||||||
|
this.suiteDone = function(result) {
|
||||||
|
if (result.status == 'failed') {
|
||||||
|
failedSuites.push(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentParent == topResults) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentParent = currentParent.parent;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.specStarted = function(result) {
|
||||||
|
currentParent.addChild(result, 'spec');
|
||||||
|
};
|
||||||
|
|
||||||
|
var failures = [];
|
||||||
|
this.specDone = function(result) {
|
||||||
|
if(noExpectations(result) && typeof console !== 'undefined' && typeof console.error !== 'undefined') {
|
||||||
|
console.error('Spec \'' + result.fullName + '\' has no expectations.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.status != 'disabled') {
|
||||||
|
specsExecuted++;
|
||||||
|
}
|
||||||
|
|
||||||
|
symbols.appendChild(createDom('li', {
|
||||||
|
className: noExpectations(result) ? 'empty' : result.status,
|
||||||
|
id: 'spec_' + result.id,
|
||||||
|
title: result.fullName
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
if (result.status == 'failed') {
|
||||||
|
failureCount++;
|
||||||
|
|
||||||
|
var failure =
|
||||||
|
createDom('div', {className: 'spec-detail failed'},
|
||||||
|
createDom('div', {className: 'description'},
|
||||||
|
createDom('a', {title: result.fullName, href: specHref(result)}, result.fullName)
|
||||||
|
),
|
||||||
|
createDom('div', {className: 'messages'})
|
||||||
|
);
|
||||||
|
var messages = failure.childNodes[1];
|
||||||
|
|
||||||
|
for (var i = 0; i < result.failedExpectations.length; i++) {
|
||||||
|
var expectation = result.failedExpectations[i];
|
||||||
|
messages.appendChild(createDom('div', {className: 'result-message'}, expectation.message));
|
||||||
|
messages.appendChild(createDom('div', {className: 'stack-trace'}, expectation.stack));
|
||||||
|
}
|
||||||
|
|
||||||
|
failures.push(failure);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.status == 'pending') {
|
||||||
|
pendingSpecCount++;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.jasmineDone = function() {
|
||||||
|
var banner = find('.banner');
|
||||||
|
banner.appendChild(createDom('span', {className: 'duration'}, 'finished in ' + timer.elapsed() / 1000 + 's'));
|
||||||
|
|
||||||
|
var alert = find('.alert');
|
||||||
|
|
||||||
|
alert.appendChild(createDom('span', { className: 'exceptions' },
|
||||||
|
createDom('label', { className: 'label', 'for': 'raise-exceptions' }, 'raise exceptions'),
|
||||||
|
createDom('input', {
|
||||||
|
className: 'raise',
|
||||||
|
id: 'raise-exceptions',
|
||||||
|
type: 'checkbox'
|
||||||
|
})
|
||||||
|
));
|
||||||
|
var checkbox = find('#raise-exceptions');
|
||||||
|
|
||||||
|
checkbox.checked = !env.catchingExceptions();
|
||||||
|
checkbox.onclick = onRaiseExceptionsClick;
|
||||||
|
|
||||||
|
if (specsExecuted < totalSpecsDefined) {
|
||||||
|
var skippedMessage = 'Ran ' + specsExecuted + ' of ' + totalSpecsDefined + ' specs - run all';
|
||||||
|
alert.appendChild(
|
||||||
|
createDom('span', {className: 'bar skipped'},
|
||||||
|
createDom('a', {href: '?', title: 'Run all specs'}, skippedMessage)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
var statusBarMessage = '';
|
||||||
|
var statusBarClassName = 'bar ';
|
||||||
|
|
||||||
|
if (totalSpecsDefined > 0) {
|
||||||
|
statusBarMessage += pluralize('spec', specsExecuted) + ', ' + pluralize('failure', failureCount);
|
||||||
|
if (pendingSpecCount) { statusBarMessage += ', ' + pluralize('pending spec', pendingSpecCount); }
|
||||||
|
statusBarClassName += (failureCount > 0) ? 'failed' : 'passed';
|
||||||
|
} else {
|
||||||
|
statusBarClassName += 'skipped';
|
||||||
|
statusBarMessage += 'No specs found';
|
||||||
|
}
|
||||||
|
|
||||||
|
alert.appendChild(createDom('span', {className: statusBarClassName}, statusBarMessage));
|
||||||
|
|
||||||
|
for(i = 0; i < failedSuites.length; i++) {
|
||||||
|
var failedSuite = failedSuites[i];
|
||||||
|
for(var j = 0; j < failedSuite.failedExpectations.length; j++) {
|
||||||
|
var errorBarMessage = 'AfterAll ' + failedSuite.failedExpectations[j].message;
|
||||||
|
var errorBarClassName = 'bar errored';
|
||||||
|
alert.appendChild(createDom('span', {className: errorBarClassName}, errorBarMessage));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var results = find('.results');
|
||||||
|
results.appendChild(summary);
|
||||||
|
|
||||||
|
summaryList(topResults, summary);
|
||||||
|
|
||||||
|
function summaryList(resultsTree, domParent) {
|
||||||
|
var specListNode;
|
||||||
|
for (var i = 0; i < resultsTree.children.length; i++) {
|
||||||
|
var resultNode = resultsTree.children[i];
|
||||||
|
if (resultNode.type == 'suite') {
|
||||||
|
var suiteListNode = createDom('ul', {className: 'suite', id: 'suite-' + resultNode.result.id},
|
||||||
|
createDom('li', {className: 'suite-detail'},
|
||||||
|
createDom('a', {href: specHref(resultNode.result)}, resultNode.result.description)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
summaryList(resultNode, suiteListNode);
|
||||||
|
domParent.appendChild(suiteListNode);
|
||||||
|
}
|
||||||
|
if (resultNode.type == 'spec') {
|
||||||
|
if (domParent.getAttribute('class') != 'specs') {
|
||||||
|
specListNode = createDom('ul', {className: 'specs'});
|
||||||
|
domParent.appendChild(specListNode);
|
||||||
|
}
|
||||||
|
var specDescription = resultNode.result.description;
|
||||||
|
if(noExpectations(resultNode.result)) {
|
||||||
|
specDescription = 'SPEC HAS NO EXPECTATIONS ' + specDescription;
|
||||||
|
}
|
||||||
|
if(resultNode.result.status === 'pending' && resultNode.result.pendingReason !== '') {
|
||||||
|
specDescription = specDescription + ' PENDING WITH MESSAGE: ' + resultNode.result.pendingReason;
|
||||||
|
}
|
||||||
|
specListNode.appendChild(
|
||||||
|
createDom('li', {
|
||||||
|
className: resultNode.result.status,
|
||||||
|
id: 'spec-' + resultNode.result.id
|
||||||
|
},
|
||||||
|
createDom('a', {href: specHref(resultNode.result)}, specDescription)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (failures.length) {
|
||||||
|
alert.appendChild(
|
||||||
|
createDom('span', {className: 'menu bar spec-list'},
|
||||||
|
createDom('span', {}, 'Spec List | '),
|
||||||
|
createDom('a', {className: 'failures-menu', href: '#'}, 'Failures')));
|
||||||
|
alert.appendChild(
|
||||||
|
createDom('span', {className: 'menu bar failure-list'},
|
||||||
|
createDom('a', {className: 'spec-list-menu', href: '#'}, 'Spec List'),
|
||||||
|
createDom('span', {}, ' | Failures ')));
|
||||||
|
|
||||||
|
find('.failures-menu').onclick = function() {
|
||||||
|
setMenuModeTo('failure-list');
|
||||||
|
};
|
||||||
|
find('.spec-list-menu').onclick = function() {
|
||||||
|
setMenuModeTo('spec-list');
|
||||||
|
};
|
||||||
|
|
||||||
|
setMenuModeTo('failure-list');
|
||||||
|
|
||||||
|
var failureNode = find('.failures');
|
||||||
|
for (var i = 0; i < failures.length; i++) {
|
||||||
|
failureNode.appendChild(failures[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return this;
|
||||||
|
|
||||||
|
function find(selector) {
|
||||||
|
return getContainer().querySelector('.jasmine_html-reporter ' + selector);
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearPrior() {
|
||||||
|
// return the reporter
|
||||||
|
var oldReporter = find('');
|
||||||
|
|
||||||
|
if(oldReporter) {
|
||||||
|
getContainer().removeChild(oldReporter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function createDom(type, attrs, childrenVarArgs) {
|
||||||
|
var el = createElement(type);
|
||||||
|
|
||||||
|
for (var i = 2; i < arguments.length; i++) {
|
||||||
|
var child = arguments[i];
|
||||||
|
|
||||||
|
if (typeof child === 'string') {
|
||||||
|
el.appendChild(createTextNode(child));
|
||||||
|
} else {
|
||||||
|
if (child) {
|
||||||
|
el.appendChild(child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var attr in attrs) {
|
||||||
|
if (attr == 'className') {
|
||||||
|
el[attr] = attrs[attr];
|
||||||
|
} else {
|
||||||
|
el.setAttribute(attr, attrs[attr]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return el;
|
||||||
|
}
|
||||||
|
|
||||||
|
function pluralize(singular, count) {
|
||||||
|
var word = (count == 1 ? singular : singular + 's');
|
||||||
|
|
||||||
|
return '' + count + ' ' + word;
|
||||||
|
}
|
||||||
|
|
||||||
|
function specHref(result) {
|
||||||
|
return addToExistingQueryString('spec', result.fullName);
|
||||||
|
}
|
||||||
|
|
||||||
|
function defaultQueryString(key, value) {
|
||||||
|
return '?' + key + '=' + value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setMenuModeTo(mode) {
|
||||||
|
htmlReporterMain.setAttribute('class', 'jasmine_html-reporter ' + mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
function noExpectations(result) {
|
||||||
|
return (result.failedExpectations.length + result.passedExpectations.length) === 0 &&
|
||||||
|
result.status === 'passed';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return HtmlReporter;
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmineRequire.HtmlSpecFilter = function() {
|
||||||
|
function HtmlSpecFilter(options) {
|
||||||
|
var filterString = options && options.filterString() && options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
||||||
|
var filterPattern = new RegExp(filterString);
|
||||||
|
|
||||||
|
this.matches = function(specName) {
|
||||||
|
return filterPattern.test(specName);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return HtmlSpecFilter;
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmineRequire.ResultsNode = function() {
|
||||||
|
function ResultsNode(result, type, parent) {
|
||||||
|
this.result = result;
|
||||||
|
this.type = type;
|
||||||
|
this.parent = parent;
|
||||||
|
|
||||||
|
this.children = [];
|
||||||
|
|
||||||
|
this.addChild = function(result, type) {
|
||||||
|
this.children.push(new ResultsNode(result, type, this));
|
||||||
|
};
|
||||||
|
|
||||||
|
this.last = function() {
|
||||||
|
return this.children[this.children.length - 1];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResultsNode;
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmineRequire.QueryString = function() {
|
||||||
|
function QueryString(options) {
|
||||||
|
|
||||||
|
this.navigateWithNewParam = function(key, value) {
|
||||||
|
options.getWindowLocation().search = this.fullStringWithNewParam(key, value);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.fullStringWithNewParam = function(key, value) {
|
||||||
|
var paramMap = queryStringToParamMap();
|
||||||
|
paramMap[key] = value;
|
||||||
|
return toQueryString(paramMap);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getParam = function(key) {
|
||||||
|
return queryStringToParamMap()[key];
|
||||||
|
};
|
||||||
|
|
||||||
|
return this;
|
||||||
|
|
||||||
|
function toQueryString(paramMap) {
|
||||||
|
var qStrPairs = [];
|
||||||
|
for (var prop in paramMap) {
|
||||||
|
qStrPairs.push(encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop]));
|
||||||
|
}
|
||||||
|
return '?' + qStrPairs.join('&');
|
||||||
|
}
|
||||||
|
|
||||||
|
function queryStringToParamMap() {
|
||||||
|
var paramStr = options.getWindowLocation().search.substring(1),
|
||||||
|
params = [],
|
||||||
|
paramMap = {};
|
||||||
|
|
||||||
|
if (paramStr.length > 0) {
|
||||||
|
params = paramStr.split('&');
|
||||||
|
for (var i = 0; i < params.length; i++) {
|
||||||
|
var p = params[i].split('=');
|
||||||
|
var value = decodeURIComponent(p[1]);
|
||||||
|
if (value === 'true' || value === 'false') {
|
||||||
|
value = JSON.parse(value);
|
||||||
|
}
|
||||||
|
paramMap[decodeURIComponent(p[0])] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return paramMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return QueryString;
|
||||||
|
};
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,489 @@
|
|||||||
|
/*
|
||||||
|
json2.js
|
||||||
|
2014-02-04
|
||||||
|
|
||||||
|
Public Domain.
|
||||||
|
|
||||||
|
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
|
||||||
|
|
||||||
|
See http://www.JSON.org/js.html
|
||||||
|
|
||||||
|
|
||||||
|
This code should be minified before deployment.
|
||||||
|
See http://javascript.crockford.com/jsmin.html
|
||||||
|
|
||||||
|
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
|
||||||
|
NOT CONTROL.
|
||||||
|
|
||||||
|
|
||||||
|
This file creates a global JSON object containing two methods: stringify
|
||||||
|
and parse.
|
||||||
|
|
||||||
|
JSON.stringify(value, replacer, space)
|
||||||
|
value any JavaScript value, usually an object or array.
|
||||||
|
|
||||||
|
replacer an optional parameter that determines how object
|
||||||
|
values are stringified for objects. It can be a
|
||||||
|
function or an array of strings.
|
||||||
|
|
||||||
|
space an optional parameter that specifies the indentation
|
||||||
|
of nested structures. If it is omitted, the text will
|
||||||
|
be packed without extra whitespace. If it is a number,
|
||||||
|
it will specify the number of spaces to indent at each
|
||||||
|
level. If it is a string (such as '\t' or ' '),
|
||||||
|
it contains the characters used to indent at each level.
|
||||||
|
|
||||||
|
This method produces a JSON text from a JavaScript value.
|
||||||
|
|
||||||
|
When an object value is found, if the object contains a toJSON
|
||||||
|
method, its toJSON method will be called and the result will be
|
||||||
|
stringified. A toJSON method does not serialize: it returns the
|
||||||
|
value represented by the name/value pair that should be serialized,
|
||||||
|
or undefined if nothing should be serialized. The toJSON method
|
||||||
|
will be passed the key associated with the value, and this will be
|
||||||
|
bound to the value
|
||||||
|
|
||||||
|
For example, this would serialize Dates as ISO strings.
|
||||||
|
|
||||||
|
Date.prototype.toJSON = function (key) {
|
||||||
|
function f(n) {
|
||||||
|
// Format integers to have at least two digits.
|
||||||
|
return n < 10 ? '0' + n : n;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.getUTCFullYear() + '-' +
|
||||||
|
f(this.getUTCMonth() + 1) + '-' +
|
||||||
|
f(this.getUTCDate()) + 'T' +
|
||||||
|
f(this.getUTCHours()) + ':' +
|
||||||
|
f(this.getUTCMinutes()) + ':' +
|
||||||
|
f(this.getUTCSeconds()) + 'Z';
|
||||||
|
};
|
||||||
|
|
||||||
|
You can provide an optional replacer method. It will be passed the
|
||||||
|
key and value of each member, with this bound to the containing
|
||||||
|
object. The value that is returned from your method will be
|
||||||
|
serialized. If your method returns undefined, then the member will
|
||||||
|
be excluded from the serialization.
|
||||||
|
|
||||||
|
If the replacer parameter is an array of strings, then it will be
|
||||||
|
used to select the members to be serialized. It filters the results
|
||||||
|
such that only members with keys listed in the replacer array are
|
||||||
|
stringified.
|
||||||
|
|
||||||
|
Values that do not have JSON representations, such as undefined or
|
||||||
|
functions, will not be serialized. Such values in objects will be
|
||||||
|
dropped; in arrays they will be replaced with null. You can use
|
||||||
|
a replacer function to replace those with JSON values.
|
||||||
|
JSON.stringify(undefined) returns undefined.
|
||||||
|
|
||||||
|
The optional space parameter produces a stringification of the
|
||||||
|
value that is filled with line breaks and indentation to make it
|
||||||
|
easier to read.
|
||||||
|
|
||||||
|
If the space parameter is a non-empty string, then that string will
|
||||||
|
be used for indentation. If the space parameter is a number, then
|
||||||
|
the indentation will be that many spaces.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
text = JSON.stringify(['e', {pluribus: 'unum'}]);
|
||||||
|
// text is '["e",{"pluribus":"unum"}]'
|
||||||
|
|
||||||
|
|
||||||
|
text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
|
||||||
|
// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
|
||||||
|
|
||||||
|
text = JSON.stringify([new Date()], function (key, value) {
|
||||||
|
return this[key] instanceof Date ?
|
||||||
|
'Date(' + this[key] + ')' : value;
|
||||||
|
});
|
||||||
|
// text is '["Date(---current time---)"]'
|
||||||
|
|
||||||
|
|
||||||
|
JSON.parse(text, reviver)
|
||||||
|
This method parses a JSON text to produce an object or array.
|
||||||
|
It can throw a SyntaxError exception.
|
||||||
|
|
||||||
|
The optional reviver parameter is a function that can filter and
|
||||||
|
transform the results. It receives each of the keys and values,
|
||||||
|
and its return value is used instead of the original value.
|
||||||
|
If it returns what it received, then the structure is not modified.
|
||||||
|
If it returns undefined then the member is deleted.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
// Parse the text. Values that look like ISO date strings will
|
||||||
|
// be converted to Date objects.
|
||||||
|
|
||||||
|
myData = JSON.parse(text, function (key, value) {
|
||||||
|
var a;
|
||||||
|
if (typeof value === 'string') {
|
||||||
|
a =
|
||||||
|
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
|
||||||
|
if (a) {
|
||||||
|
return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
|
||||||
|
+a[5], +a[6]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
});
|
||||||
|
|
||||||
|
myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
|
||||||
|
var d;
|
||||||
|
if (typeof value === 'string' &&
|
||||||
|
value.slice(0, 5) === 'Date(' &&
|
||||||
|
value.slice(-1) === ')') {
|
||||||
|
d = new Date(value.slice(5, -1));
|
||||||
|
if (d) {
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
This is a reference implementation. You are free to copy, modify, or
|
||||||
|
redistribute.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*jslint evil: true, regexp: true */
|
||||||
|
|
||||||
|
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
|
||||||
|
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
|
||||||
|
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
|
||||||
|
lastIndex, length, parse, prototype, push, replace, slice, stringify,
|
||||||
|
test, toJSON, toString, valueOf
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// Create a JSON object only if one does not already exist. We create the
|
||||||
|
// methods in a closure to avoid creating global variables.
|
||||||
|
|
||||||
|
if (typeof JSON !== 'object') {
|
||||||
|
JSON = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
function f(n) {
|
||||||
|
// Format integers to have at least two digits.
|
||||||
|
return n < 10 ? '0' + n : n;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof Date.prototype.toJSON !== 'function') {
|
||||||
|
|
||||||
|
Date.prototype.toJSON = function () {
|
||||||
|
|
||||||
|
return isFinite(this.valueOf())
|
||||||
|
? this.getUTCFullYear() + '-' +
|
||||||
|
f(this.getUTCMonth() + 1) + '-' +
|
||||||
|
f(this.getUTCDate()) + 'T' +
|
||||||
|
f(this.getUTCHours()) + ':' +
|
||||||
|
f(this.getUTCMinutes()) + ':' +
|
||||||
|
f(this.getUTCSeconds()) + 'Z'
|
||||||
|
: null;
|
||||||
|
};
|
||||||
|
|
||||||
|
String.prototype.toJSON =
|
||||||
|
Number.prototype.toJSON =
|
||||||
|
Boolean.prototype.toJSON = function () {
|
||||||
|
return this.valueOf();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var cx,
|
||||||
|
escapable,
|
||||||
|
gap,
|
||||||
|
indent,
|
||||||
|
meta,
|
||||||
|
rep;
|
||||||
|
|
||||||
|
|
||||||
|
function quote(string) {
|
||||||
|
|
||||||
|
// If the string contains no control characters, no quote characters, and no
|
||||||
|
// backslash characters, then we can safely slap some quotes around it.
|
||||||
|
// Otherwise we must also replace the offending characters with safe escape
|
||||||
|
// sequences.
|
||||||
|
|
||||||
|
escapable.lastIndex = 0;
|
||||||
|
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
|
||||||
|
var c = meta[a];
|
||||||
|
return typeof c === 'string'
|
||||||
|
? c
|
||||||
|
: '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
||||||
|
}) + '"' : '"' + string + '"';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function str(key, holder) {
|
||||||
|
|
||||||
|
// Produce a string from holder[key].
|
||||||
|
|
||||||
|
var i, // The loop counter.
|
||||||
|
k, // The member key.
|
||||||
|
v, // The member value.
|
||||||
|
length,
|
||||||
|
mind = gap,
|
||||||
|
partial,
|
||||||
|
value = holder[key];
|
||||||
|
|
||||||
|
// If the value has a toJSON method, call it to obtain a replacement value.
|
||||||
|
|
||||||
|
if (value && typeof value === 'object' &&
|
||||||
|
typeof value.toJSON === 'function') {
|
||||||
|
value = value.toJSON(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we were called with a replacer function, then call the replacer to
|
||||||
|
// obtain a replacement value.
|
||||||
|
|
||||||
|
if (typeof rep === 'function') {
|
||||||
|
value = rep.call(holder, key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// What happens next depends on the value's type.
|
||||||
|
|
||||||
|
switch (typeof value) {
|
||||||
|
case 'string':
|
||||||
|
return quote(value);
|
||||||
|
|
||||||
|
case 'number':
|
||||||
|
|
||||||
|
// JSON numbers must be finite. Encode non-finite numbers as null.
|
||||||
|
|
||||||
|
return isFinite(value) ? String(value) : 'null';
|
||||||
|
|
||||||
|
case 'boolean':
|
||||||
|
case 'null':
|
||||||
|
|
||||||
|
// If the value is a boolean or null, convert it to a string. Note:
|
||||||
|
// typeof null does not produce 'null'. The case is included here in
|
||||||
|
// the remote chance that this gets fixed someday.
|
||||||
|
|
||||||
|
return String(value);
|
||||||
|
|
||||||
|
// If the type is 'object', we might be dealing with an object or an array or
|
||||||
|
// null.
|
||||||
|
|
||||||
|
case 'object':
|
||||||
|
|
||||||
|
// Due to a specification blunder in ECMAScript, typeof null is 'object',
|
||||||
|
// so watch out for that case.
|
||||||
|
|
||||||
|
if (!value) {
|
||||||
|
return 'null';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make an array to hold the partial results of stringifying this object value.
|
||||||
|
|
||||||
|
gap += indent;
|
||||||
|
partial = [];
|
||||||
|
|
||||||
|
// Is the value an array?
|
||||||
|
|
||||||
|
if (Object.prototype.toString.apply(value) === '[object Array]') {
|
||||||
|
|
||||||
|
// The value is an array. Stringify every element. Use null as a placeholder
|
||||||
|
// for non-JSON values.
|
||||||
|
|
||||||
|
length = value.length;
|
||||||
|
for (i = 0; i < length; i += 1) {
|
||||||
|
partial[i] = str(i, value) || 'null';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Join all of the elements together, separated with commas, and wrap them in
|
||||||
|
// brackets.
|
||||||
|
|
||||||
|
v = partial.length === 0
|
||||||
|
? '[]'
|
||||||
|
: gap
|
||||||
|
? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
|
||||||
|
: '[' + partial.join(',') + ']';
|
||||||
|
gap = mind;
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the replacer is an array, use it to select the members to be stringified.
|
||||||
|
|
||||||
|
if (rep && typeof rep === 'object') {
|
||||||
|
length = rep.length;
|
||||||
|
for (i = 0; i < length; i += 1) {
|
||||||
|
if (typeof rep[i] === 'string') {
|
||||||
|
k = rep[i];
|
||||||
|
v = str(k, value);
|
||||||
|
if (v) {
|
||||||
|
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Otherwise, iterate through all of the keys in the object.
|
||||||
|
|
||||||
|
for (k in value) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
||||||
|
v = str(k, value);
|
||||||
|
if (v) {
|
||||||
|
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Join all of the member texts together, separated with commas,
|
||||||
|
// and wrap them in braces.
|
||||||
|
|
||||||
|
v = partial.length === 0
|
||||||
|
? '{}'
|
||||||
|
: gap
|
||||||
|
? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
|
||||||
|
: '{' + partial.join(',') + '}';
|
||||||
|
gap = mind;
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the JSON object does not yet have a stringify method, give it one.
|
||||||
|
|
||||||
|
if (typeof JSON.stringify !== 'function') {
|
||||||
|
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
|
||||||
|
meta = { // table of character substitutions
|
||||||
|
'\b': '\\b',
|
||||||
|
'\t': '\\t',
|
||||||
|
'\n': '\\n',
|
||||||
|
'\f': '\\f',
|
||||||
|
'\r': '\\r',
|
||||||
|
'"' : '\\"',
|
||||||
|
'\\': '\\\\'
|
||||||
|
};
|
||||||
|
JSON.stringify = function (value, replacer, space) {
|
||||||
|
|
||||||
|
// The stringify method takes a value and an optional replacer, and an optional
|
||||||
|
// space parameter, and returns a JSON text. The replacer can be a function
|
||||||
|
// that can replace values, or an array of strings that will select the keys.
|
||||||
|
// A default replacer method can be provided. Use of the space parameter can
|
||||||
|
// produce text that is more easily readable.
|
||||||
|
|
||||||
|
var i;
|
||||||
|
gap = '';
|
||||||
|
indent = '';
|
||||||
|
|
||||||
|
// If the space parameter is a number, make an indent string containing that
|
||||||
|
// many spaces.
|
||||||
|
|
||||||
|
if (typeof space === 'number') {
|
||||||
|
for (i = 0; i < space; i += 1) {
|
||||||
|
indent += ' ';
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the space parameter is a string, it will be used as the indent string.
|
||||||
|
|
||||||
|
} else if (typeof space === 'string') {
|
||||||
|
indent = space;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there is a replacer, it must be a function or an array.
|
||||||
|
// Otherwise, throw an error.
|
||||||
|
|
||||||
|
rep = replacer;
|
||||||
|
if (replacer && typeof replacer !== 'function' &&
|
||||||
|
(typeof replacer !== 'object' ||
|
||||||
|
typeof replacer.length !== 'number')) {
|
||||||
|
throw new Error('JSON.stringify');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make a fake root object containing our value under the key of ''.
|
||||||
|
// Return the result of stringifying the value.
|
||||||
|
|
||||||
|
return str('', {'': value});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// If the JSON object does not yet have a parse method, give it one.
|
||||||
|
|
||||||
|
if (typeof JSON.parse !== 'function') {
|
||||||
|
cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
|
||||||
|
JSON.parse = function (text, reviver) {
|
||||||
|
|
||||||
|
// The parse method takes a text and an optional reviver function, and returns
|
||||||
|
// a JavaScript value if the text is a valid JSON text.
|
||||||
|
|
||||||
|
var j;
|
||||||
|
|
||||||
|
function walk(holder, key) {
|
||||||
|
|
||||||
|
// The walk method is used to recursively walk the resulting structure so
|
||||||
|
// that modifications can be made.
|
||||||
|
|
||||||
|
var k, v, value = holder[key];
|
||||||
|
if (value && typeof value === 'object') {
|
||||||
|
for (k in value) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
||||||
|
v = walk(value, k);
|
||||||
|
if (v !== undefined) {
|
||||||
|
value[k] = v;
|
||||||
|
} else {
|
||||||
|
delete value[k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return reviver.call(holder, key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Parsing happens in four stages. In the first stage, we replace certain
|
||||||
|
// Unicode characters with escape sequences. JavaScript handles many characters
|
||||||
|
// incorrectly, either silently deleting them, or treating them as line endings.
|
||||||
|
|
||||||
|
text = String(text);
|
||||||
|
cx.lastIndex = 0;
|
||||||
|
if (cx.test(text)) {
|
||||||
|
text = text.replace(cx, function (a) {
|
||||||
|
return '\\u' +
|
||||||
|
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// In the second stage, we run the text against regular expressions that look
|
||||||
|
// for non-JSON patterns. We are especially concerned with '()' and 'new'
|
||||||
|
// because they can cause invocation, and '=' because it can cause mutation.
|
||||||
|
// But just to be safe, we want to reject all unexpected forms.
|
||||||
|
|
||||||
|
// We split the second stage into 4 regexp operations in order to work around
|
||||||
|
// crippling inefficiencies in IE's and Safari's regexp engines. First we
|
||||||
|
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
|
||||||
|
// replace all simple value tokens with ']' characters. Third, we delete all
|
||||||
|
// open brackets that follow a colon or comma or that begin the text. Finally,
|
||||||
|
// we look to see that the remaining characters are only whitespace or ']' or
|
||||||
|
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
|
||||||
|
|
||||||
|
if (/^[\],:{}\s]*$/
|
||||||
|
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
|
||||||
|
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
|
||||||
|
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
||||||
|
|
||||||
|
// In the third stage we use the eval function to compile the text into a
|
||||||
|
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
|
||||||
|
// in JavaScript: it can begin a block or an object literal. We wrap the text
|
||||||
|
// in parens to eliminate the ambiguity.
|
||||||
|
|
||||||
|
j = eval('(' + text + ')');
|
||||||
|
|
||||||
|
// In the optional fourth stage, we recursively walk the new structure, passing
|
||||||
|
// each name/value pair to a reviver function for possible transformation.
|
||||||
|
|
||||||
|
return typeof reviver === 'function'
|
||||||
|
? walk({'': j}, '')
|
||||||
|
: j;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the text is not JSON parseable, then a SyntaxError is thrown.
|
||||||
|
|
||||||
|
throw new SyntaxError('JSON.parse');
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}());
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2008-2015 Pivotal Labs
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
module.exports = function(jasmineRequire) {
|
||||||
|
var jasmine = jasmineRequire.core(jasmineRequire);
|
||||||
|
|
||||||
|
var consoleFns = require('../console/console.js');
|
||||||
|
consoleFns.console(consoleFns, jasmine);
|
||||||
|
|
||||||
|
var env = jasmine.getEnv();
|
||||||
|
|
||||||
|
var jasmineInterface = jasmineRequire.interface(jasmine, env);
|
||||||
|
|
||||||
|
extend(global, jasmineInterface);
|
||||||
|
|
||||||
|
function extend(destination, source) {
|
||||||
|
for (var property in source) destination[property] = source[property];
|
||||||
|
return destination;
|
||||||
|
}
|
||||||
|
|
||||||
|
return jasmine;
|
||||||
|
};
|
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"name": "jasmine-core",
|
||||||
|
"license": "MIT",
|
||||||
|
"version": "2.2.1",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/jasmine/jasmine.git"
|
||||||
|
},
|
||||||
|
"description": "Official packaging of Jasmine's core files for use by Node.js projects.",
|
||||||
|
"homepage": "http://jasmine.github.io",
|
||||||
|
"main": "./lib/jasmine-core.js",
|
||||||
|
"devDependencies": {
|
||||||
|
"grunt": "~0.4.1",
|
||||||
|
"grunt-contrib-jshint": "~0.7.0",
|
||||||
|
"grunt-contrib-concat": "~0.3.0",
|
||||||
|
"grunt-contrib-compass": "~0.6.0",
|
||||||
|
"grunt-contrib-compress": "~0.5.2",
|
||||||
|
"shelljs": "~0.1.4",
|
||||||
|
"glob": "~3.2.9",
|
||||||
|
"jasmine": "https://github.com/jasmine/jasmine-npm/archive/master.tar.gz",
|
||||||
|
"load-grunt-tasks": "^0.4.0"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
ordereddict==1.1
|
Loading…
Reference in New Issue