MACHIN
This commit is contained in:
3
6/node_modules/jasmine-node/.travis.yml
generated
vendored
Normal file
3
6/node_modules/jasmine-node/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
23
6/node_modules/jasmine-node/LICENSE
generated
vendored
Normal file
23
6/node_modules/jasmine-node/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2018-present Christopher J. Brody and other contributors
|
||||
Copyright (c) 2010 Adam Abrons and Misko Hevery http://getangular.com
|
||||
|
||||
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.
|
||||
|
||||
314
6/node_modules/jasmine-node/README.md
generated
vendored
Normal file
314
6/node_modules/jasmine-node/README.md
generated
vendored
Normal file
@@ -0,0 +1,314 @@
|
||||
jasmine-node
|
||||
======
|
||||
|
||||
[](./LICENSE)
|
||||
[](https://www.npmjs.com/package/jasmine-node)
|
||||
[](https://github.com/mhevery/jasmine-node/graphs/contributors)
|
||||
|
||||
This node.js module makes the wonderful [Pivotal Lab's jasmine](http://github.com/pivotal/jasmine)
|
||||
spec framework (version 1) available in node.js.
|
||||
|
||||
|
||||
Project status
|
||||
--------------
|
||||
|
||||
This project is now in maintenance mode. It is recommended to use the `jasmine` or `jasmine-npm`
|
||||
package whenever possible.
|
||||
|
||||
|
||||
jasmine
|
||||
-------
|
||||
|
||||
Version `1.3.1` of Jasmine is currently included with node-jasmine. This is a forked version from the
|
||||
[Karma project](https://github.com/karma-runner/karma-jasmine), which allows you to use the
|
||||
`ddescribe` and `iit` functions to run individual suites or specs.
|
||||
|
||||
NOTICE: BETA `2.0.0` Support in the `Jasmine2.0` branch (with rewrite in CoffeeScript) is now abandoned and no longer supported.
|
||||
|
||||
Supported Node.js versions
|
||||
--------------------------
|
||||
|
||||
* Current:
|
||||
- 10
|
||||
- 12
|
||||
* Deprecated:
|
||||
- 8 (EOL in December 2019)
|
||||
- 6 (already past EOL)
|
||||
- 4 (already past EOL)
|
||||
|
||||
Older versions of Node.js are no longer supported. It is *highly* recommended to upgrade to a supported version of Node.js.
|
||||
|
||||
what's new
|
||||
----------
|
||||
* Growl notifications with the `--growl` flag (requires Growl to be installed)
|
||||
* Ability to test specs written in Literate CoffeeScript
|
||||
* Teamcity Reporter reinstated.
|
||||
* Ability to specify multiple files to test via list in command line
|
||||
* Ability to suppress stack trace with `--noStack`
|
||||
* Async tests now run in the expected context instead of the global one
|
||||
* `--config` flag that allows you to assign variables to process.env
|
||||
* Terminal Reporters are now available in the Jasmine Object #184
|
||||
* Done is now available in all timeout specs #199
|
||||
* `afterEach` is available in requirejs #179
|
||||
* Editors that replace instead of changing files should work with autotest #198
|
||||
* Jasmine Mock Clock now works!
|
||||
* Autotest now works!
|
||||
* Using the latest Jasmine!
|
||||
* Verbose mode tabs `describe` blocks much more accurately!
|
||||
* `--coffee` now allows specs written in Literate CoffeeScript (`.litcoffee`)
|
||||
|
||||
install
|
||||
------
|
||||
|
||||
To install the latest official version, use NPM:
|
||||
|
||||
```sh
|
||||
npm install jasmine-node -g
|
||||
```
|
||||
|
||||
To install the latest _bleeding edge_ version, clone this repository and check
|
||||
out the `beta` branch.
|
||||
|
||||
usage
|
||||
------
|
||||
|
||||
Write the specifications for your code in `*.js` and `*.coffee` files in the `spec/` directory.
|
||||
You can use sub-directories to better organise your specs. In the specs use `describe()`, `it()` etc. exactly
|
||||
as you would in client-side jasmine specs.
|
||||
|
||||
**Note**: your specification files must be named as `*spec.js`, `*spec.coffee` or `*spec.litcoffee`,
|
||||
which matches the regular expression `/spec\.(js|coffee|litcoffee)$/i`;
|
||||
otherwise jasmine-node won't find them!
|
||||
For example, `sampleSpecs.js` is wrong, `sampleSpec.js` is right.
|
||||
|
||||
If you have installed the npm package, you can run it with:
|
||||
|
||||
```sh
|
||||
jasmine-node spec/
|
||||
```
|
||||
|
||||
If you aren't using npm, you should add `pwd`/lib to the `$NODE_PATH`
|
||||
environment variable, then run:
|
||||
|
||||
```sh
|
||||
node lib/jasmine-node/cli.js
|
||||
```
|
||||
|
||||
|
||||
You can supply the following arguments:
|
||||
|
||||
* `--autotest`, provides automatic execution of specs after each change
|
||||
* `--watch`, when used with `--autotest`, paths after `--watch` will be
|
||||
watched for changes, allowing to watch for changes outside of specs directory
|
||||
* `--coffee`, allow execution of `.coffee` and `.litcoffee` specs
|
||||
* `--color`, indicates spec output should uses color to
|
||||
indicates passing (green) or failing (red) specs
|
||||
* `--noColor`, do not use color in the output
|
||||
* `-m, --match REGEXP`, match only specs containing "REGEXPspec"
|
||||
* `--matchall`, relax requirement of "spec" in spec file names
|
||||
* `--verbose`, verbose output as the specs are run
|
||||
* `--junitreport`, export tests results as junitreport xml format
|
||||
* `--output FOLDER`, defines the output folder for junitreport files
|
||||
* `--teamcity`, converts all console output to teamcity custom test runner commands. (Normally auto detected.)
|
||||
* `--growl`, display test run summary in a growl notification (in addition to other outputs)
|
||||
* `--runWithRequireJs`, loads all specs using requirejs instead of node's native require method
|
||||
* `--requireJsSetup`, file run before specs to include and configure RequireJS
|
||||
* `--test-dir`, the absolute root directory path where tests are located
|
||||
* `--nohelpers`, does not load helpers
|
||||
* `--forceexit`, force exit once tests complete
|
||||
* `--captureExceptions`, listen to global exceptions, report them and exit (interferes with Domains in NodeJs, so do not use if using Domains as well
|
||||
* `--config NAME VALUE`, set a global variable in `process.env`
|
||||
* `--noStack`, suppress the stack trace generated from a test failure
|
||||
|
||||
Individual files to test can be added as bare arguments to the end of the args.
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
jasmine-node --coffee spec/AsyncSpec.coffee spec/CoffeeSpec.coffee spec/SampleSpec.js
|
||||
```
|
||||
|
||||
async tests
|
||||
-----------
|
||||
|
||||
jasmine-node includes an alternate syntax for writing asynchronous tests. Accepting
|
||||
a done callback in the specification will trigger jasmine-node to run the test
|
||||
asynchronously waiting until the `done()` callback is called.
|
||||
|
||||
```javascript
|
||||
var request = require('request');
|
||||
|
||||
it("should respond with hello world", function(done) {
|
||||
request("http://localhost:3000/hello", function(error, response, body){
|
||||
expect(body).toEqual("hello world");
|
||||
done();
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
An asynchronous test will fail after `5000` ms if `done()` is not called. This timeout
|
||||
can be changed by setting `jasmine.getEnv().defaultTimeoutInterval` or by passing a timeout
|
||||
interval in the specification.
|
||||
|
||||
```javascript
|
||||
var request = require('request');
|
||||
|
||||
it("should respond with hello world", function(done) {
|
||||
request("http://localhost:3000/hello", function(error, response, body){
|
||||
done();
|
||||
});
|
||||
}, 250); // timeout after 250 ms
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```javascript
|
||||
var request = require('request');
|
||||
|
||||
jasmine.getEnv().defaultTimeoutInterval = 500;
|
||||
|
||||
it("should respond with hello world", function(done) {
|
||||
request("http://localhost:3000/hello", function(error, response, body){
|
||||
done();
|
||||
}); // timeout after 500 ms
|
||||
});
|
||||
```
|
||||
|
||||
Checkout [`spec/SampleSpecs.js`](https://github.com/mhevery/jasmine-node/blob/master/spec/SampleSpecs.js) to see how to use it.
|
||||
|
||||
|
||||
requirejs
|
||||
---------
|
||||
|
||||
There is a sample project in `/spec-requirejs`. It is comprised of:
|
||||
|
||||
1. `requirejs-setup.js`, this pulls in our wrapper template (next)
|
||||
1. `requirejs-wrapper-template`, this builds up requirejs settings
|
||||
1. `requirejs.sut.js`, this is a __SU__bject To __T__est, something required by requirejs
|
||||
1. `requirejs.spec.js`, the actual jasmine spec for testing
|
||||
|
||||
To run it:
|
||||
|
||||
```sh
|
||||
node lib/jasmine-node/cli.js --runWithRequireJs --requireJsSetup ./spec-requirejs/requirejs-setup.js ./spec-requirejs/
|
||||
```
|
||||
|
||||
exceptions
|
||||
----------
|
||||
|
||||
Often you'll want to capture an uncaught exception and log it to the console,
|
||||
this is accomplished by using the `--captureExceptions` flag. Exceptions will
|
||||
be reported to the console, but jasmine-node will attempt to recover and
|
||||
continue. It was decided to not change the current functionality until `2.0`. So,
|
||||
until then, jasmine-node will still return `0` and continue on without this flag.
|
||||
|
||||
### Scenario ###
|
||||
|
||||
You require a module, but it doesn't exist, ie `require('Q')` instead of
|
||||
`require('q')`. Jasmine-Node reports the error to the console, but carries on
|
||||
and returns `0`. This messes up Travis-CI because you need it to return a
|
||||
non-zero status while doing CI tests.
|
||||
|
||||
### Mitigation ###
|
||||
|
||||
Before `--captureExceptions`
|
||||
|
||||
```sh
|
||||
> jasmine-node --coffee spec
|
||||
> echo $status
|
||||
0
|
||||
```
|
||||
|
||||
Run jasmine node with the `--captureExceptions` flag.
|
||||
|
||||
```sh
|
||||
> jasmine-node --coffee --captureExceptions spec
|
||||
> echo $status
|
||||
1
|
||||
```
|
||||
|
||||
|
||||
growl notifications
|
||||
-------------------
|
||||
|
||||
Jasmine node can display [Growl](http://growl.info) notifications of test
|
||||
run summaries in addition to other reports.
|
||||
Growl must be installed separately, see [node-growl](https://github.com/visionmedia/node-growl)
|
||||
for platform-specific instructions. Pass the `--growl` flag to enable the notifications.
|
||||
|
||||
|
||||
development
|
||||
-----------
|
||||
|
||||
Install the dependent packages by running:
|
||||
|
||||
```sh
|
||||
npm install
|
||||
```
|
||||
|
||||
Run the specs before you send your pull request:
|
||||
|
||||
```sh
|
||||
specs.sh
|
||||
```
|
||||
|
||||
__Note:__ Some tests are designed to fail in the specs.sh. After each of the
|
||||
individual runs completes, there is a line that lists what the expected
|
||||
Pass/Assert/Fail count should be. If you add/remove/edit tests, please be sure
|
||||
to update this with your PR.
|
||||
|
||||
|
||||
changelog
|
||||
---------
|
||||
|
||||
* `1.16.2` Back to `jasmine-growl-reporter@~0.2.0` (needed by Node.js pre-4.0)
|
||||
* `1.16.1` Use `~` instead of `^` in `dependencies` (may be needed by some really old npm versions)
|
||||
* `1.16.0` Fix `dependencies` to prevent major package updates
|
||||
* `1.15.0` Switch to coffeescript package
|
||||
* `1.14.6` Update dependencies to resolve `npm audit` issues
|
||||
* `1.14.5` Using `~` instead of `^` for reporter version (thanks to [Maxim-Filimonov](https://github.com/Maxim-Filimonov))
|
||||
* `1.14.4` Rolled back jasmine reporter version (thanks to [tjmcduffie](https://github.com/tjmcduffie))
|
||||
* `1.14.3` Added 'onComplete' callback to TeamCityReporter (thanks to [JoergFiedler](https://github.com/JoergFiedler))
|
||||
* `1.14.2` Uhhh...not sure what happened here.
|
||||
* `1.14.1` Default to noColors if not in a TTY
|
||||
* `1.14.0` Add support for `iit`, `ddescribe` (thanks to [mgcrea](https://github.com/mgcrea))
|
||||
* `1.13.1` Add coffee-script support for 1.7.x (thanks to [nathancarter](https://github.com/nathancarter))
|
||||
* `1.13.0` Added timing to the verbose reporter (thanks to [rick-kilgore](https://github.com/rick-kilgore))
|
||||
* `1.12.1` Fixed an issue where an undefined variable caused an unhelpful
|
||||
exception in --watch Resolves #278
|
||||
* `1.12.0`
|
||||
* Changed `util.print` to `stdout.write` (thanks to [nrstott](https://github.com/nrstott))
|
||||
* Don’t affect line numbers with --requireJsSetup (thanks to [daviddaurelio](https://github.com/davidaurelio))
|
||||
* Catch errors when loading helpers (thanks to [pimterry](https://github.com/pimterry))
|
||||
* Keep autotesting until all tests have passed (thanks to [notclive](https://github.com/notclive))
|
||||
* `1.11.0` Added Growl notification option `--growl` (thanks to
|
||||
[AlphaHydrae](https://github.com/AlphaHydrae))
|
||||
* `1.10.2` Restored stack filter which was accidentally removed (thanks to
|
||||
[kevinsawicki](https://github.com/kevinsawicki))
|
||||
* `1.10.1` `beforeEach` and `afterEach` now properly handle the async-timeout function
|
||||
* `1.10.0` Skipped tests now show in the terminal reporter's output (thanks
|
||||
to [kevinsawicki](https://github.com/kevinsawicki))
|
||||
* `1.9.1` Timeout now consistent between Async and Non-Async Calls (thanks to
|
||||
[codemnky](https://github.com/codemnky))
|
||||
* `1.9.0` Now re-throwing the file-not-found error, added info to README.md,
|
||||
printing version with `--version`
|
||||
* `1.8.1` Fixed silent failure due to invalid REGEX (thanks to
|
||||
[pimterry](https://github.com/pimterry))
|
||||
* `1.8.0` Fixed bug in autotest with multiple paths and added `--watch` feature
|
||||
(thanks to [davegb3](https://github.com/davegb3))
|
||||
* `1.7.1` Removed unneeded fs dependency (thanks to
|
||||
[kevinsawicki](https://github.com/kevinsawicki)) Fixed broken fs call in
|
||||
node `0.6` (thanks to [abe33](https://github.com/abe33))
|
||||
* `1.7.0` Literate CoffeeScript now testable (thanks to [magicmoose](https://github.com/magicmoose))
|
||||
* `1.6.0` Teamcity Reporter Reinstated (thanks to [bhcleek](https://github.com/bhcleek))
|
||||
* `1.5.1` Missing files and require exceptions will now report instead of failing silently
|
||||
* `1.5.0` Now takes multiple files for execution. (thanks to [abe33](https://github.com/abe33))
|
||||
* `1.4.0` Optional flag to suppress stack trace on test failure (thanks to [Lastalas](https://github.com/Lastalas))
|
||||
* `1.3.1` Fixed context for async tests (thanks to [omryn](https://github.com/omryn))
|
||||
* `1.3.0` Added `--config` flag for changeable testing environments
|
||||
* `1.2.3` Fixed #179, #184, #198, #199. Fixes autotest, afterEach in requirejs, terminal reporter is in jasmine object, done function missing in async tests
|
||||
* `1.2.2` Revert Exception Capturing to avoid Breaking Domain Tests
|
||||
* `1.2.1` Emergency fix for path reference missing
|
||||
* `1.2.0` Fixed #149, #152, #171, #181, #195. `--autotest` now works as expected, jasmine clock now responds to the fake ticking as requested, and removed the path.exists warning
|
||||
* `1.1.1` Fixed #173, #169 (Blocks were not indented in verbose properly, added more documentation to address #180
|
||||
* `1.1.0` Updated Jasmine to `1.3.1`, fixed fs missing, catching uncaught exceptions, other fixes
|
||||
6
6/node_modules/jasmine-node/bin/jasmine-node
generated
vendored
Normal file
6
6/node_modules/jasmine-node/bin/jasmine-node
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
if( !process.env.NODE_ENV ) process.env.NODE_ENV = 'test';
|
||||
|
||||
var path = require('path');
|
||||
require(path.join(__dirname,'../lib/jasmine-node/cli.js'));
|
||||
19
6/node_modules/jasmine-node/bower.json
generated
vendored
Normal file
19
6/node_modules/jasmine-node/bower.json
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "jasmine-node",
|
||||
"version": "1.12.0",
|
||||
"homepage": "https://github.com/mhevery/jasmine-node",
|
||||
"authors": [
|
||||
"Misko Hevery <https://github.com/mhevery>",
|
||||
"Chris M <http://www.endgame.com>"
|
||||
],
|
||||
"description": "Integration of Jasmine Spec framework with Node.js",
|
||||
"main": "lib/jasmine-node",
|
||||
"keywords": [
|
||||
"jasmine",
|
||||
"node",
|
||||
"commonjs",
|
||||
"node"
|
||||
],
|
||||
"license": "MIT",
|
||||
"private": true
|
||||
}
|
||||
61
6/node_modules/jasmine-node/lib/jasmine-node/async-callback.js
generated
vendored
Normal file
61
6/node_modules/jasmine-node/lib/jasmine-node/async-callback.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
(function() {
|
||||
var withoutAsync = {};
|
||||
|
||||
["it", "beforeEach", "afterEach"].forEach(function(jasmineFunction) {
|
||||
withoutAsync[jasmineFunction] = jasmine.Env.prototype[jasmineFunction];
|
||||
return jasmine.Env.prototype[jasmineFunction] = function() {
|
||||
var args = Array.prototype.slice.call(arguments, 0);
|
||||
var timeout = null;
|
||||
if (isLastArgumentATimeout(args)) {
|
||||
timeout = args.pop();
|
||||
// The changes to the jasmine test runner causes undef to be passed when
|
||||
// calling all it()'s now. If the last argument isn't a timeout and the
|
||||
// last argument IS undefined, let's just pop it off. Since out of bounds
|
||||
// items are undefined anyways, *hopefully* removing an undef item won't
|
||||
// hurt.
|
||||
} else if (args[args.length-1] == undefined) {
|
||||
args.pop();
|
||||
}
|
||||
if (isLastArgumentAnAsyncSpecFunction(args))
|
||||
{
|
||||
var specFunction = args.pop();
|
||||
args.push(function() {
|
||||
return asyncSpec(specFunction, this, timeout);
|
||||
});
|
||||
}
|
||||
return withoutAsync[jasmineFunction].apply(this, args);
|
||||
};
|
||||
});
|
||||
|
||||
function isLastArgumentATimeout(args)
|
||||
{
|
||||
return args.length > 0 && (typeof args[args.length-1]) === "number";
|
||||
}
|
||||
|
||||
function isLastArgumentAnAsyncSpecFunction(args)
|
||||
{
|
||||
return args.length > 0 && (typeof args[args.length-1]) === "function" && args[args.length-1].length > 0;
|
||||
}
|
||||
|
||||
function asyncSpec(specFunction, spec, timeout) {
|
||||
if (timeout == null) timeout = jasmine.getEnv().defaultTimeoutInterval || 1000;
|
||||
var done = false;
|
||||
spec.runs(function() {
|
||||
try {
|
||||
return specFunction.call(spec, function(error) {
|
||||
done = true;
|
||||
if (error != null) return spec.fail(error);
|
||||
});
|
||||
} catch (e) {
|
||||
done = true;
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
return spec.waitsFor(function() {
|
||||
if (done === true) {
|
||||
return true;
|
||||
}
|
||||
}, "spec to complete", timeout);
|
||||
};
|
||||
|
||||
}).call(this);
|
||||
118
6/node_modules/jasmine-node/lib/jasmine-node/autotest.js
generated
vendored
Normal file
118
6/node_modules/jasmine-node/lib/jasmine-node/autotest.js
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
var walkdir = require('walkdir');
|
||||
var collection = require('./spec-collection');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var child_process = require('child_process');
|
||||
var gaze = require('gaze');
|
||||
var _ = require('underscore');
|
||||
|
||||
var baseArgv = [];
|
||||
|
||||
for(var i = 0; i < process.argv.length; i++) {
|
||||
if(process.argv[i] !== '--autotest') {
|
||||
baseArgv.push(process.argv[i]);
|
||||
}
|
||||
}
|
||||
|
||||
var run_external = function(command, args, callback) {
|
||||
var child = child_process.spawn(command, args);
|
||||
child.stdout.on('data', function(data) {
|
||||
process.stdout.write(data);
|
||||
});
|
||||
child.stderr.on('data', function(data) {
|
||||
process.stderr.write(data);
|
||||
});
|
||||
if(typeof callback == 'function') {
|
||||
child.on('exit', callback);
|
||||
}
|
||||
}
|
||||
|
||||
var last_run_successful = false;
|
||||
|
||||
var run_everything = function() {
|
||||
// run the suite when it starts
|
||||
var argv = [].concat(baseArgv);
|
||||
run_external(argv.shift(), argv, function (code) {
|
||||
last_run_successful = code === 0
|
||||
});
|
||||
}
|
||||
|
||||
exports.start = function(loadpaths, watchFolders, patterns) {
|
||||
var watchPatterns;
|
||||
|
||||
loadpaths.forEach(function(loadpath){
|
||||
|
||||
// If loadpath is just a single file, we should just watch that file
|
||||
stats = fs.statSync(loadpath);
|
||||
if (stats.isFile()) {
|
||||
watchPatterns = loadpath;
|
||||
} else {
|
||||
watchPatterns = patterns.map(function(p) {
|
||||
return path.join(loadpath, p);
|
||||
});
|
||||
}
|
||||
|
||||
changedFunc = function(event, file) {
|
||||
console.log(file + ' was changed');
|
||||
|
||||
var match = path.basename(file, path.extname(file)) + ".*";
|
||||
match = match.replace(new RegExp("spec", "i"), "");
|
||||
|
||||
var argv = [].concat(baseArgv, ["--match", match]);
|
||||
run_external(argv.shift(), argv, function(code) {
|
||||
// run everything if we fixed some bugs
|
||||
if(code == 0) {
|
||||
if(!last_run_successful) {
|
||||
run_everything();
|
||||
}
|
||||
} else {
|
||||
last_run_successful = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Vim seems to change a file multiple times, with non-scientific testing
|
||||
// the only time we didn't duplicate the call to onChanged was at 2.5s
|
||||
// Passing true to have onChanged run on the leading edge of the timeout
|
||||
var onChanged = _.debounce(changedFunc, 2500, true);
|
||||
|
||||
gaze(watchPatterns, function(err, watcher) {
|
||||
// Get all watched files
|
||||
console.log("Watching for changes in " + loadpath);
|
||||
|
||||
// On file changed
|
||||
this.on('all', onChanged);
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
watchFolders.forEach(function(watchPath) {
|
||||
// If watchPath is just a single file, we should just watch that file
|
||||
stats = fs.statSync(watchPath);
|
||||
if (stats.isFile()) {
|
||||
watchPatterns = watchPath;
|
||||
} else {
|
||||
watchPatterns = patterns.map(function(p) {
|
||||
return path.join(watchPath, p);
|
||||
});
|
||||
}
|
||||
|
||||
// We debounce run_everything here due to the Vim issue described above.
|
||||
var onChanged = _.debounce(run_everything, 2500, true);
|
||||
|
||||
|
||||
gaze(watchPatterns, function(err, watcher) {
|
||||
console.log("Watching for changes in " + watchPath);
|
||||
|
||||
this.on('all', onChanged);
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
run_everything();
|
||||
};
|
||||
287
6/node_modules/jasmine-node/lib/jasmine-node/cli.js
generated
vendored
Normal file
287
6/node_modules/jasmine-node/lib/jasmine-node/cli.js
generated
vendored
Normal file
@@ -0,0 +1,287 @@
|
||||
var util,
|
||||
Path= require('path'),
|
||||
fs = require('fs');
|
||||
|
||||
var jasmine = require('./index');
|
||||
|
||||
|
||||
try {
|
||||
util = require('util')
|
||||
} catch(e) {
|
||||
util = require('sys')
|
||||
}
|
||||
|
||||
var helperCollection = require('./spec-collection');
|
||||
|
||||
var specFolders = [];
|
||||
var watchFolders = [];
|
||||
|
||||
// The following line keeps the jasmine setTimeout in the proper scope
|
||||
jasmine.setTimeout = jasmine.getGlobal().setTimeout;
|
||||
jasmine.setInterval = jasmine.getGlobal().setInterval;
|
||||
for (var key in jasmine)
|
||||
global[key] = jasmine[key];
|
||||
|
||||
var isVerbose = false;
|
||||
var showColors = true;
|
||||
// Disable if we're not on a TTY
|
||||
if (!process.stdout.isTTY) {
|
||||
showColors = false;
|
||||
}
|
||||
var teamcity = process.env.TEAMCITY_PROJECT_NAME || false;
|
||||
var useRequireJs = false;
|
||||
var extensions = "js";
|
||||
var match = '.';
|
||||
var matchall = false;
|
||||
var autotest = false;
|
||||
var useHelpers = true;
|
||||
var forceExit = false;
|
||||
var captureExceptions = false;
|
||||
var includeStackTrace = true;
|
||||
var growl = false;
|
||||
|
||||
var junitreport = {
|
||||
report: false,
|
||||
savePath : "./reports/",
|
||||
useDotNotation: true,
|
||||
consolidate: true
|
||||
}
|
||||
|
||||
var args = process.argv.slice(2);
|
||||
var existsSync = fs.existsSync || Path.existsSync;
|
||||
|
||||
while(args.length) {
|
||||
var arg = args.shift();
|
||||
|
||||
switch(arg)
|
||||
{
|
||||
case '--version':
|
||||
printVersion();
|
||||
case '--color':
|
||||
showColors = true;
|
||||
break;
|
||||
case '--noColor':
|
||||
case '--nocolor':
|
||||
showColors = false;
|
||||
break;
|
||||
case '--verbose':
|
||||
isVerbose = true;
|
||||
break;
|
||||
case '--coffee':
|
||||
try {
|
||||
require('coffeescript/register'); // support CoffeeScript >=1.7.0
|
||||
} catch ( e ) {
|
||||
require('coffeescript'); // support CoffeeScript <=1.6.3
|
||||
}
|
||||
extensions = "js|coffee|litcoffee";
|
||||
break;
|
||||
case '-m':
|
||||
case '--match':
|
||||
match = args.shift();
|
||||
break;
|
||||
case '--matchall':
|
||||
matchall = true;
|
||||
break;
|
||||
case '--junitreport':
|
||||
junitreport.report = true;
|
||||
break;
|
||||
case '--output':
|
||||
junitreport.savePath = args.shift();
|
||||
break;
|
||||
case '--teamcity':
|
||||
teamcity = true;
|
||||
break;
|
||||
case '--requireJsSetup':
|
||||
var setup = args.shift();
|
||||
|
||||
if(!existsSync(setup))
|
||||
throw new Error("RequireJS setup '" + setup + "' doesn't exist!");
|
||||
|
||||
useRequireJs = setup;
|
||||
break;
|
||||
case '--runWithRequireJs':
|
||||
useRequireJs = useRequireJs || true;
|
||||
break;
|
||||
case '--nohelpers':
|
||||
useHelpers = false;
|
||||
break;
|
||||
case '--test-dir':
|
||||
var dir = args.shift();
|
||||
|
||||
if(!existsSync(dir))
|
||||
throw new Error("Test root path '" + dir + "' doesn't exist!");
|
||||
|
||||
specFolders.push(dir); // NOTE: Does not look from current working directory.
|
||||
break;
|
||||
case '--autotest':
|
||||
autotest = true;
|
||||
break;
|
||||
case '--watch':
|
||||
var nextWatchDir;
|
||||
|
||||
// Add the following arguments, until we see another argument starting with '-'
|
||||
while (args[0] && args[0][0] !== '-') {
|
||||
nextWatchDir = args.shift();
|
||||
watchFolders.push(nextWatchDir);
|
||||
|
||||
if (!existsSync(nextWatchDir))
|
||||
throw new Error("Watch path '" + nextWatchDir + "' doesn't exist!");
|
||||
}
|
||||
break;
|
||||
|
||||
case '--forceexit':
|
||||
forceExit = true;
|
||||
break;
|
||||
case '--captureExceptions':
|
||||
captureExceptions = true;
|
||||
break;
|
||||
case '--noStack':
|
||||
includeStackTrace = false;
|
||||
break;
|
||||
case '--growl':
|
||||
growl = true;
|
||||
break;
|
||||
case '--config':
|
||||
var configKey = args.shift();
|
||||
var configValue = args.shift();
|
||||
process.env[configKey]=configValue;
|
||||
break;
|
||||
case '-h':
|
||||
help();
|
||||
default:
|
||||
if (arg.match(/^--params=.*/)) {
|
||||
break;
|
||||
}
|
||||
if (arg.match(/^--/)) help();
|
||||
if (arg.match(/^\/.*/)) {
|
||||
specFolders.push(arg);
|
||||
} else {
|
||||
specFolders.push(Path.join(process.cwd(), arg));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (specFolders.length === 0) {
|
||||
help();
|
||||
} else {
|
||||
// Check to see if all our files exist
|
||||
for (var idx = 0; idx < specFolders.length; idx++) {
|
||||
if (!existsSync(specFolders[idx])) {
|
||||
console.log("File: " + specFolders[idx] + " is missing.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (autotest) {
|
||||
var patterns = ['**/*.js'];
|
||||
|
||||
if (extensions.indexOf("coffee") !== -1) {
|
||||
patterns.push('**/*.coffee');
|
||||
}
|
||||
|
||||
require('./autotest').start(specFolders, watchFolders, patterns);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var exitCode = 0;
|
||||
|
||||
if (captureExceptions) {
|
||||
process.on('uncaughtException', function(e) {
|
||||
console.error(e.stack || e);
|
||||
exitCode = 1;
|
||||
process.exit(exitCode);
|
||||
});
|
||||
}
|
||||
|
||||
process.on("exit", onExit);
|
||||
|
||||
function onExit() {
|
||||
process.removeListener("exit", onExit);
|
||||
process.exit(exitCode);
|
||||
}
|
||||
|
||||
var onComplete = function(runner, log) {
|
||||
process.stdout.write('\n');
|
||||
if (runner.results().failedCount == 0) {
|
||||
exitCode = 0;
|
||||
} else {
|
||||
exitCode = 1;
|
||||
}
|
||||
if (forceExit) {
|
||||
process.exit(exitCode);
|
||||
}
|
||||
};
|
||||
|
||||
if(useHelpers){
|
||||
specFolders.forEach(function(path){
|
||||
jasmine.loadHelpersInFolder(path,
|
||||
new RegExp("helpers?\\.(" + extensions + ")$", 'i'));
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
try {
|
||||
var regExpSpec = new RegExp(match + (matchall ? "" : "spec\\.") + "(" + extensions + ")$", 'i')
|
||||
} catch (error) {
|
||||
console.error("Failed to build spec-matching regex: " + error);
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
|
||||
var options = {
|
||||
specFolders: specFolders,
|
||||
onComplete: onComplete,
|
||||
isVerbose: isVerbose,
|
||||
showColors: showColors,
|
||||
teamcity: teamcity,
|
||||
useRequireJs: useRequireJs,
|
||||
regExpSpec: regExpSpec,
|
||||
junitreport: junitreport,
|
||||
includeStackTrace: includeStackTrace,
|
||||
growl: growl
|
||||
}
|
||||
|
||||
jasmine.executeSpecsInFolder(options);
|
||||
|
||||
|
||||
function help(){
|
||||
process.stdout.write([
|
||||
'USAGE: jasmine-node [--color|--noColor] [--verbose] [--coffee] directory'
|
||||
, ''
|
||||
, 'Options:'
|
||||
, ' --autotest - rerun automatically the specs when a file changes'
|
||||
, ' --watch PATH - when used with --autotest, watches the given path(s) and runs all tests if a change is detected'
|
||||
, ' --color - use color coding for output'
|
||||
, ' --noColor - do not use color coding for output'
|
||||
, ' -m, --match REGEXP - load only specs containing "REGEXPspec"'
|
||||
, ' --matchall - relax requirement of "spec" in spec file names'
|
||||
, ' --verbose - print extra information per each test run'
|
||||
, ' --coffee - load coffeescript which allows execution .coffee files'
|
||||
, ' --junitreport - export tests results as junitreport xml format'
|
||||
, ' --output - defines the output folder for junitreport files'
|
||||
, ' --teamcity - converts all console output to teamcity custom test runner commands. (Normally auto detected.)'
|
||||
, ' --growl - display test run summary in a growl notification (in addition to other outputs)'
|
||||
, ' --runWithRequireJs - loads all specs using requirejs instead of node\'s native require method'
|
||||
, ' --requireJsSetup - file run before specs to include and configure RequireJS'
|
||||
, ' --test-dir - the absolute root directory path where tests are located'
|
||||
, ' --nohelpers - does not load helpers.'
|
||||
, ' --forceexit - force exit once tests complete.'
|
||||
, ' --captureExceptions- listen to global exceptions, report them and exit (interferes with Domains)'
|
||||
, ' --config NAME VALUE- set a global variable in process.env'
|
||||
, ' --noStack - suppress the stack trace generated from a test failure'
|
||||
, ' --version - show the current version'
|
||||
, ' -h, --help - display this help and exit'
|
||||
, ''
|
||||
].join("\n"));
|
||||
|
||||
process.exit(-1);
|
||||
}
|
||||
|
||||
function printVersion(){
|
||||
const package = require(__dirname + '/../../package.json')
|
||||
console.log(package.version);
|
||||
process.exit(0);
|
||||
}
|
||||
160
6/node_modules/jasmine-node/lib/jasmine-node/cs.js
generated
vendored
Normal file
160
6/node_modules/jasmine-node/lib/jasmine-node/cs.js
generated
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
/**
|
||||
* @license cs 0.4.2 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
|
||||
* Available via the MIT or new BSD license.
|
||||
* see: http://github.com/jrburke/require-cs for details
|
||||
*/
|
||||
|
||||
/*jslint */
|
||||
/*global define, window, XMLHttpRequest, importScripts, Packages, java,
|
||||
ActiveXObject, process, require */
|
||||
|
||||
define(['coffeescript'], function (CoffeeScript) {
|
||||
'use strict';
|
||||
var fs, getXhr,
|
||||
progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'],
|
||||
fetchText = function () {
|
||||
throw new Error('Environment unsupported.');
|
||||
},
|
||||
buildMap = {};
|
||||
|
||||
if (typeof process !== "undefined" &&
|
||||
process.versions &&
|
||||
!!process.versions.node) {
|
||||
//Using special require.nodeRequire, something added by r.js.
|
||||
fs = require.nodeRequire('fs');
|
||||
fetchText = function (path, callback) {
|
||||
callback(fs.readFileSync(path, 'utf8'));
|
||||
};
|
||||
} else if ((typeof window !== "undefined" && window.navigator && window.document) || typeof importScripts !== "undefined") {
|
||||
// Browser action
|
||||
getXhr = function () {
|
||||
//Would love to dump the ActiveX crap in here. Need IE 6 to die first.
|
||||
var xhr, i, progId;
|
||||
if (typeof XMLHttpRequest !== "undefined") {
|
||||
return new XMLHttpRequest();
|
||||
} else {
|
||||
for (i = 0; i < 3; i++) {
|
||||
progId = progIds[i];
|
||||
try {
|
||||
xhr = new ActiveXObject(progId);
|
||||
} catch (e) {}
|
||||
|
||||
if (xhr) {
|
||||
progIds = [progId]; // so faster next time
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!xhr) {
|
||||
throw new Error("getXhr(): XMLHttpRequest not available");
|
||||
}
|
||||
|
||||
return xhr;
|
||||
};
|
||||
|
||||
fetchText = function (url, callback) {
|
||||
var xhr = getXhr();
|
||||
xhr.open('GET', url, true);
|
||||
xhr.onreadystatechange = function (evt) {
|
||||
//Do not explicitly handle errors, those should be
|
||||
//visible via console output in the browser.
|
||||
if (xhr.readyState === 4) {
|
||||
callback(xhr.responseText);
|
||||
}
|
||||
};
|
||||
xhr.send(null);
|
||||
};
|
||||
// end browser.js adapters
|
||||
} else if (typeof Packages !== 'undefined') {
|
||||
//Why Java, why is this so awkward?
|
||||
fetchText = function (path, callback) {
|
||||
var encoding = "utf-8",
|
||||
file = new java.io.File(path),
|
||||
lineSeparator = java.lang.System.getProperty("line.separator"),
|
||||
input = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(file), encoding)),
|
||||
stringBuffer, line,
|
||||
content = '';
|
||||
try {
|
||||
stringBuffer = new java.lang.StringBuffer();
|
||||
line = input.readLine();
|
||||
|
||||
// Byte Order Mark (BOM) - The Unicode Standard, version 3.0, page 324
|
||||
// http://www.unicode.org/faq/utf_bom.html
|
||||
|
||||
// Note that when we use utf-8, the BOM should appear as "EF BB BF", but it doesn't due to this bug in the JDK:
|
||||
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058
|
||||
if (line && line.length() && line.charAt(0) === 0xfeff) {
|
||||
// Eat the BOM, since we've already found the encoding on this file,
|
||||
// and we plan to concatenating this buffer with others; the BOM should
|
||||
// only appear at the top of a file.
|
||||
line = line.substring(1);
|
||||
}
|
||||
|
||||
stringBuffer.append(line);
|
||||
|
||||
while ((line = input.readLine()) !== null) {
|
||||
stringBuffer.append(lineSeparator);
|
||||
stringBuffer.append(line);
|
||||
}
|
||||
//Make sure we return a JavaScript string and not a Java string.
|
||||
content = String(stringBuffer.toString()); //String
|
||||
} finally {
|
||||
input.close();
|
||||
}
|
||||
callback(content);
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
get: function () {
|
||||
return CoffeeScript;
|
||||
},
|
||||
|
||||
write: function (pluginName, name, write) {
|
||||
if (buildMap.hasOwnProperty(name)) {
|
||||
var text = buildMap[name];
|
||||
write.asModule(pluginName + "!" + name, text);
|
||||
}
|
||||
},
|
||||
|
||||
version: '0.4.2',
|
||||
|
||||
load: function (name, parentRequire, load, config) {
|
||||
var path = parentRequire.toUrl(name + '.coffee');
|
||||
fetchText(path, function (text) {
|
||||
|
||||
//Do CoffeeScript transform.
|
||||
try {
|
||||
text = CoffeeScript.compile(text, config.CoffeeScript);
|
||||
}
|
||||
catch (err) {
|
||||
err.message = "In " + path + ", " + err.message;
|
||||
throw(err);
|
||||
}
|
||||
|
||||
//Hold on to the transformed text if a build.
|
||||
if (config.isBuild) {
|
||||
buildMap[name] = text;
|
||||
}
|
||||
|
||||
//IE with conditional comments on cannot handle the
|
||||
//sourceURL trick, so skip it if enabled.
|
||||
/*@if (@_jscript) @else @*/
|
||||
if (!config.isBuild) {
|
||||
text += "\r\n//@ sourceURL=" + path;
|
||||
}
|
||||
/*@end@*/
|
||||
|
||||
load.fromText(name, text);
|
||||
|
||||
//Give result to load. Need to wait until the module
|
||||
//is fully parse, which will happen after this
|
||||
//execution.
|
||||
parentRequire([name], function (value) {
|
||||
load(value);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
204
6/node_modules/jasmine-node/lib/jasmine-node/index.js
generated
vendored
Normal file
204
6/node_modules/jasmine-node/lib/jasmine-node/index.js
generated
vendored
Normal file
@@ -0,0 +1,204 @@
|
||||
var fs = require('fs');
|
||||
var mkdirp = require('mkdirp');
|
||||
var util;
|
||||
try {
|
||||
util = require('util')
|
||||
} catch(e) {
|
||||
util = require('sys')
|
||||
}
|
||||
|
||||
var path = require('path');
|
||||
|
||||
var filename = __dirname + '/jasmine-1.3.1.js';
|
||||
var isWindowUndefined = typeof global.window === 'undefined';
|
||||
if (isWindowUndefined) {
|
||||
global.window = {
|
||||
setTimeout: setTimeout,
|
||||
clearTimeout: clearTimeout,
|
||||
setInterval: setInterval,
|
||||
clearInterval: clearInterval
|
||||
};
|
||||
}
|
||||
|
||||
var src = fs.readFileSync(filename);
|
||||
// Put jasmine in the global context, this is somewhat like running in a
|
||||
// browser where every file will have access to `jasmine`
|
||||
var jasmine = require('vm').runInThisContext(src + "\njasmine;", filename);
|
||||
|
||||
|
||||
if (isWindowUndefined) {
|
||||
delete global.window;
|
||||
}
|
||||
require("./async-callback");
|
||||
require("jasmine-reporters");
|
||||
var nodeReporters = require('./reporter').jasmineNode;
|
||||
jasmine.TerminalVerboseReporter = nodeReporters.TerminalVerboseReporter;
|
||||
jasmine.TerminalReporter = nodeReporters.TerminalReporter;
|
||||
jasmine.TeamcityReporter = nodeReporters.TeamcityReporter;
|
||||
jasmine.GrowlReporter = require('jasmine-growl-reporter');
|
||||
|
||||
|
||||
jasmine.loadHelpersInFolder = function(folder, matcher) {
|
||||
// Check to see if the folder is actually a file, if so, back up to the
|
||||
// parent directory and find some helpers
|
||||
folderStats = fs.statSync(folder);
|
||||
if (folderStats.isFile()) {
|
||||
folder = path.dirname(folder);
|
||||
}
|
||||
|
||||
var helpers = [],
|
||||
helperCollection = require('./spec-collection');
|
||||
|
||||
helperCollection.load([folder], matcher);
|
||||
helpers = helperCollection.getSpecs();
|
||||
|
||||
for (var i = 0, len = helpers.length; i < len; ++i) {
|
||||
var file = helpers[i].path();
|
||||
|
||||
try {
|
||||
var helper = require(file.replace(/\.*$/, ""));
|
||||
} catch (e) {
|
||||
console.log("Exception loading helper: " + file)
|
||||
console.log(e);
|
||||
throw e; // If any of the helpers fail to load, fail everything
|
||||
}
|
||||
|
||||
for (var key in helper) {
|
||||
global[key]= helper[key];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function removeJasmineFrames(text) {
|
||||
if (!text) {
|
||||
return text;
|
||||
}
|
||||
|
||||
var lines = [];
|
||||
text.split(/\n/).forEach(function(line){
|
||||
if (line.indexOf(filename) == -1) {
|
||||
lines.push(line);
|
||||
}
|
||||
});
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
jasmine.executeSpecsInFolder = function(options){
|
||||
var folders = options['specFolders'];
|
||||
var done = options['onComplete'];
|
||||
var isVerbose = options['isVerbose'];
|
||||
var showColors = options['showColors'];
|
||||
var teamcity = options['teamcity'];
|
||||
var useRequireJs = options['useRequireJs'];
|
||||
var matcher = options['regExpSpec'];
|
||||
var junitreport = options['junitreport'];
|
||||
var includeStackTrace = options['includeStackTrace'];
|
||||
var growl = options['growl'];
|
||||
|
||||
// Overwriting it allows us to handle custom async specs
|
||||
it = function(desc, func, timeout) {
|
||||
return jasmine.getEnv().it(desc, func, timeout);
|
||||
}
|
||||
beforeEach = function(func, timeout) {
|
||||
return jasmine.getEnv().beforeEach(func, timeout);
|
||||
}
|
||||
afterEach = function(func, timeout) {
|
||||
return jasmine.getEnv().afterEach(func, timeout);
|
||||
}
|
||||
var fileMatcher = matcher || new RegExp(".(js)$", "i"),
|
||||
colors = showColors || false,
|
||||
specs = require('./spec-collection'),
|
||||
jasmineEnv = jasmine.getEnv();
|
||||
|
||||
specs.load(folders, fileMatcher);
|
||||
|
||||
if(junitreport && junitreport.report) {
|
||||
var existsSync = fs.existsSync || path.existsSync;
|
||||
if(!existsSync(junitreport.savePath)) {
|
||||
console.log('creating junit xml report save path: ' + junitreport.savePath);
|
||||
mkdirp.sync(junitreport.savePath, "0755");
|
||||
}
|
||||
jasmineEnv.addReporter(new jasmine.JUnitXmlReporter(junitreport.savePath,
|
||||
junitreport.consolidate,
|
||||
junitreport.useDotNotation));
|
||||
}
|
||||
|
||||
if(teamcity){
|
||||
jasmineEnv.addReporter(new jasmine.TeamcityReporter({onComplete: done}));
|
||||
} else if(isVerbose) {
|
||||
jasmineEnv.addReporter(new jasmine.TerminalVerboseReporter({ print: print,
|
||||
color: showColors,
|
||||
onComplete: done,
|
||||
stackFilter: removeJasmineFrames}));
|
||||
} else {
|
||||
jasmineEnv.addReporter(new jasmine.TerminalReporter({print: print,
|
||||
color: showColors,
|
||||
includeStackTrace: includeStackTrace,
|
||||
onComplete: done,
|
||||
stackFilter: removeJasmineFrames}));
|
||||
}
|
||||
|
||||
if (growl) {
|
||||
jasmineEnv.addReporter(new jasmine.GrowlReporter());
|
||||
}
|
||||
|
||||
if (useRequireJs) {
|
||||
require('./requirejs-runner').executeJsRunner(
|
||||
specs,
|
||||
done,
|
||||
jasmineEnv,
|
||||
typeof useRequireJs === 'string' ? useRequireJs : null
|
||||
);
|
||||
} else {
|
||||
var specsList = specs.getSpecs();
|
||||
|
||||
for (var i = 0, len = specsList.length; i < len; ++i) {
|
||||
var filename = specsList[i];
|
||||
delete require.cache[filename.path()];
|
||||
// Catch exceptions in loading the spec
|
||||
try {
|
||||
require(filename.path().replace(/\.\w+$/, ""));
|
||||
} catch (e) {
|
||||
console.log("Exception loading: " + filename.path());
|
||||
console.log(e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
jasmineEnv.execute();
|
||||
}
|
||||
};
|
||||
|
||||
function now(){
|
||||
return new Date().getTime();
|
||||
}
|
||||
|
||||
jasmine.asyncSpecWait = function(){
|
||||
var wait = jasmine.asyncSpecWait;
|
||||
wait.start = now();
|
||||
wait.done = false;
|
||||
(function innerWait(){
|
||||
waits(10);
|
||||
runs(function() {
|
||||
if (wait.start + wait.timeout < now()) {
|
||||
expect('timeout waiting for spec').toBeNull();
|
||||
} else if (wait.done) {
|
||||
wait.done = false;
|
||||
} else {
|
||||
innerWait();
|
||||
}
|
||||
});
|
||||
})();
|
||||
};
|
||||
jasmine.asyncSpecWait.timeout = 4 * 1000;
|
||||
jasmine.asyncSpecDone = function(){
|
||||
jasmine.asyncSpecWait.done = true;
|
||||
};
|
||||
|
||||
function print(str) {
|
||||
process.stdout.write(util.format(str));
|
||||
}
|
||||
|
||||
for ( var key in jasmine) {
|
||||
exports[key] = jasmine[key];
|
||||
}
|
||||
2683
6/node_modules/jasmine-node/lib/jasmine-node/jasmine-1.3.1.js
generated
vendored
Normal file
2683
6/node_modules/jasmine-node/lib/jasmine-node/jasmine-1.3.1.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
342
6/node_modules/jasmine-node/lib/jasmine-node/reporter.js
generated
vendored
Normal file
342
6/node_modules/jasmine-node/lib/jasmine-node/reporter.js
generated
vendored
Normal file
@@ -0,0 +1,342 @@
|
||||
(function() {
|
||||
//
|
||||
// Imports
|
||||
//
|
||||
var util;
|
||||
try {
|
||||
util = require('util')
|
||||
} catch(e) {
|
||||
util = require('sys')
|
||||
}
|
||||
|
||||
var jasmineNode = {};
|
||||
//
|
||||
// Helpers
|
||||
//
|
||||
function noop() {}
|
||||
|
||||
|
||||
jasmineNode.TerminalReporter = function(config) {
|
||||
this.print_ = config.print || function (str) { process.stdout.write(util.format(str)); };
|
||||
this.color_ = config.color ? this.ANSIColors : this.NoColors;
|
||||
|
||||
this.started_ = false;
|
||||
this.finished_ = false;
|
||||
|
||||
this.callback_ = config.onComplete || false
|
||||
|
||||
this.suites_ = [];
|
||||
this.specResults_ = {};
|
||||
this.failures_ = [];
|
||||
this.includeStackTrace_ = config.includeStackTrace === false ? false : true;
|
||||
this.stackFilter_ = config.stackFilter || function(t) { return t; };
|
||||
}
|
||||
|
||||
|
||||
jasmineNode.TerminalReporter.prototype = {
|
||||
reportRunnerStarting: function(runner) {
|
||||
this.started_ = true;
|
||||
this.startedAt = new Date();
|
||||
var suites = runner.topLevelSuites();
|
||||
for (var i = 0; i < suites.length; i++) {
|
||||
var suite = suites[i];
|
||||
this.suites_.push(this.summarize_(suite));
|
||||
}
|
||||
},
|
||||
|
||||
ANSIColors: {
|
||||
pass: function() { return '\033[32m'; }, // Green
|
||||
fail: function() { return '\033[31m'; }, // Red
|
||||
specTiming: function() { return '\033[34m'; }, // Blue
|
||||
suiteTiming: function() { return '\033[33m'; }, // Yelow
|
||||
ignore: function() { return '\033[37m'; }, // Light Gray
|
||||
neutral: function() { return '\033[0m'; } // Normal
|
||||
},
|
||||
|
||||
NoColors: {
|
||||
pass: function() { return ''; },
|
||||
fail: function() { return ''; },
|
||||
specTiming: function() { return ''; },
|
||||
suiteTiming: function() { return ''; },
|
||||
ignore: function() { return ''; },
|
||||
neutral: function() { return ''; }
|
||||
},
|
||||
|
||||
summarize_: function(suiteOrSpec) {
|
||||
var isSuite = suiteOrSpec instanceof jasmine.Suite;
|
||||
|
||||
// We could use a separate object for suite and spec
|
||||
var summary = {
|
||||
id: suiteOrSpec.id,
|
||||
name: suiteOrSpec.description,
|
||||
type: isSuite? 'suite' : 'spec',
|
||||
suiteNestingLevel: 0,
|
||||
children: []
|
||||
};
|
||||
|
||||
if (isSuite) {
|
||||
var calculateNestingLevel = function(examinedSuite) {
|
||||
var nestingLevel = 0;
|
||||
while (examinedSuite.parentSuite !== null) {
|
||||
nestingLevel += 1;
|
||||
examinedSuite = examinedSuite.parentSuite;
|
||||
}
|
||||
return nestingLevel;
|
||||
};
|
||||
|
||||
summary.suiteNestingLevel = calculateNestingLevel(suiteOrSpec);
|
||||
|
||||
var children = suiteOrSpec.children();
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
summary.children.push(this.summarize_(children[i]));
|
||||
}
|
||||
}
|
||||
|
||||
return summary;
|
||||
},
|
||||
|
||||
// This is heavily influenced by Jasmine's Html/Trivial Reporter
|
||||
reportRunnerResults: function(runner) {
|
||||
this.reportFailures_();
|
||||
|
||||
var results = runner.results();
|
||||
var resultColor = (results.failedCount > 0) ? this.color_.fail() : this.color_.pass();
|
||||
|
||||
var specs = runner.specs();
|
||||
var specCount = specs.length;
|
||||
|
||||
var message = "\n\nFinished in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + " seconds";
|
||||
this.printLine_(message);
|
||||
|
||||
// This is what jasmine-html.js has
|
||||
//message = "" + specCount + " spec" + ( specCount === 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount === 1) ? "" : "s");
|
||||
|
||||
this.printLine_(this.stringWithColor_(this.printRunnerResults_(runner), resultColor));
|
||||
|
||||
this.finished_ = true;
|
||||
if(this.callback_) { this.callback_(runner); }
|
||||
},
|
||||
|
||||
reportFailures_: function() {
|
||||
if (this.failures_.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var indent = ' ', failure;
|
||||
this.printLine_('\n');
|
||||
|
||||
this.print_('Failures:');
|
||||
|
||||
for (var i = 0; i < this.failures_.length; i++) {
|
||||
failure = this.failures_[i];
|
||||
this.printLine_('\n');
|
||||
this.printLine_(' ' + (i + 1) + ') ' + failure.spec);
|
||||
this.printLine_(' Message:');
|
||||
this.printLine_(' ' + this.stringWithColor_(failure.message, this.color_.fail()));
|
||||
if (this.includeStackTrace_) {
|
||||
this.printLine_(' Stacktrace:');
|
||||
this.print_(' ' + this.stackFilter_(failure.stackTrace));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
reportSuiteResults: function(suite) {
|
||||
// Not used in this context
|
||||
},
|
||||
|
||||
reportSpecResults: function(spec) {
|
||||
var result = spec.results();
|
||||
var msg = '';
|
||||
if (result.skipped) {
|
||||
msg = this.stringWithColor_('-', this.color_.ignore());
|
||||
} else if (result.passed()) {
|
||||
msg = this.stringWithColor_('.', this.color_.pass());
|
||||
} else {
|
||||
msg = this.stringWithColor_('F', this.color_.fail());
|
||||
this.addFailureToFailures_(spec);
|
||||
}
|
||||
this.spec_results += msg;
|
||||
this.print_(msg);
|
||||
},
|
||||
|
||||
addFailureToFailures_: function(spec) {
|
||||
var result = spec.results();
|
||||
var failureItem = null;
|
||||
|
||||
var items_length = result.items_.length;
|
||||
for (var i = 0; i < items_length; i++) {
|
||||
if (result.items_[i].passed_ === false) {
|
||||
failureItem = result.items_[i];
|
||||
|
||||
var failure = {
|
||||
spec: spec.suite.getFullName() + " " + spec.description,
|
||||
message: failureItem.message,
|
||||
stackTrace: failureItem.trace.stack
|
||||
}
|
||||
|
||||
this.failures_.push(failure);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
printRunnerResults_: function(runner){
|
||||
var results = runner.results();
|
||||
var specs = runner.specs();
|
||||
var msg = '';
|
||||
var skippedCount = 0;
|
||||
specs.forEach(function(spec) {
|
||||
if (spec.results().skipped) {
|
||||
skippedCount++;
|
||||
}
|
||||
});
|
||||
var passedCount = specs.length - skippedCount;
|
||||
msg += passedCount + ' test' + ((passedCount === 1) ? '' : 's') + ', ';
|
||||
msg += results.totalCount + ' assertion' + ((results.totalCount === 1) ? '' : 's') + ', ';
|
||||
msg += results.failedCount + ' failure' + ((results.failedCount === 1) ? '' : 's') + ', ';
|
||||
msg += skippedCount + ' skipped' + '\n';
|
||||
return msg;
|
||||
},
|
||||
|
||||
// Helper Methods //
|
||||
stringWithColor_: function(stringValue, color) {
|
||||
return (color || this.color_.neutral()) + stringValue + this.color_.neutral();
|
||||
},
|
||||
|
||||
printLine_: function(stringValue) {
|
||||
this.print_(stringValue);
|
||||
this.print_('\n');
|
||||
}
|
||||
};
|
||||
|
||||
// ***************************************************************
|
||||
// TerminalVerboseReporter uses the TerminalReporter's constructor
|
||||
// ***************************************************************
|
||||
jasmineNode.TerminalVerboseReporter = function(config) {
|
||||
jasmineNode.TerminalReporter.call(this, config);
|
||||
// The extra field in this object
|
||||
this.indent_ = 0;
|
||||
this.specTimes_ = {};
|
||||
this.suiteTimes_ = {};
|
||||
this.suiteResults_ = {};
|
||||
}
|
||||
|
||||
|
||||
jasmineNode.TerminalVerboseReporter.prototype = {
|
||||
|
||||
reportSpecStarting: function(spec) {
|
||||
now = new Date().getTime();
|
||||
this.specTimes_[spec.id] = now;
|
||||
var suite = spec.suite;
|
||||
while (suite) {
|
||||
if (!this.suiteTimes_[suite.id]) {
|
||||
this.suiteTimes_[suite.id] = now;
|
||||
}
|
||||
suite = suite.parentSuite;
|
||||
}
|
||||
},
|
||||
|
||||
reportSpecResults: function(spec) {
|
||||
var elapsed = new Date().getTime() - this.specTimes_[spec.id];
|
||||
|
||||
if (spec.results().failedCount > 0) {
|
||||
this.addFailureToFailures_(spec);
|
||||
}
|
||||
|
||||
this.specResults_[spec.id] = {
|
||||
messages: spec.results().getItems(),
|
||||
result: spec.results().failedCount > 0 ? 'failed' : 'passed',
|
||||
runtime: elapsed
|
||||
};
|
||||
},
|
||||
|
||||
reportSuiteResults: function(suite) {
|
||||
var startTime = this.suiteTimes_[suite.id];
|
||||
if (startTime) {
|
||||
var elapsed = new Date().getTime() - startTime;
|
||||
this.suiteResults_[suite.id] = {
|
||||
runtime: elapsed
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
reportRunnerResults: function(runner) {
|
||||
var messages = new Array();
|
||||
this.buildMessagesFromResults_(messages, this.suites_);
|
||||
|
||||
var messages_length = messages.length;
|
||||
for (var i = 0; i < messages_length-1; i++) {
|
||||
this.printLine_(messages[i]);
|
||||
}
|
||||
|
||||
this.print_(messages[messages_length-1]);
|
||||
|
||||
// Call the parent object's method
|
||||
jasmineNode.TerminalReporter.prototype.reportRunnerResults.call(this, runner);
|
||||
},
|
||||
|
||||
buildMessagesFromResults_: function(messages, results, depth) {
|
||||
var element, specResult, specIndentSpaces, msg = '';
|
||||
depth = (depth === undefined) ? 0 : depth;
|
||||
|
||||
var results_length = results.length;
|
||||
for (var i = 0; i < results_length; i++) {
|
||||
element = results[i];
|
||||
|
||||
if (element.type === 'spec') {
|
||||
specResult = this.specResults_[element.id.toString()];
|
||||
|
||||
if (specResult.result === 'passed') {
|
||||
msg = this.stringWithColor_(this.indentMessage_(element.name, depth), this.color_.pass());
|
||||
} else {
|
||||
msg = this.stringWithColor_(this.indentMessage_(element.name, depth), this.color_.fail());
|
||||
}
|
||||
msg += this.stringWithColor_(" - " + specResult.runtime + " ms",
|
||||
this.color_.specTiming());
|
||||
|
||||
messages.push(msg);
|
||||
} else {
|
||||
messages.push('');
|
||||
msg = this.indentMessage_(element.name, depth)
|
||||
if (element.id != null) {
|
||||
suiteResult = this.suiteResults_[element.id.toString()];
|
||||
if (suiteResult) {
|
||||
msg += this.stringWithColor_(" - " + suiteResult.runtime + " ms", this.color_.suiteTiming());
|
||||
}
|
||||
}
|
||||
messages.push(msg);
|
||||
}
|
||||
|
||||
this.buildMessagesFromResults_(messages, element.children, depth + 2);
|
||||
}
|
||||
},
|
||||
|
||||
indentMessage_: function(message, indentCount) {
|
||||
var _indent = '';
|
||||
for (var i = 0; i < indentCount; i++) {
|
||||
_indent += ' ';
|
||||
}
|
||||
return (_indent + message);
|
||||
}
|
||||
};
|
||||
|
||||
// Inherit from TerminalReporter
|
||||
jasmineNode.TerminalVerboseReporter.prototype.__proto__ = jasmineNode.TerminalReporter.prototype;
|
||||
|
||||
// Extend Teamcity Reporter
|
||||
jasmineNode.TeamcityReporter = function(config) {
|
||||
var callback_ = config.onComplete || false;
|
||||
|
||||
(function(superFn) {
|
||||
jasmineNode.TeamcityReporter.prototype.reportRunnerResults = function(runner) {
|
||||
superFn.call(this, runner);
|
||||
if (callback_) {callback_(runner)}
|
||||
}
|
||||
}(jasmine.TeamcityReporter.prototype.reportRunnerResults));
|
||||
};
|
||||
jasmineNode.TeamcityReporter.prototype = new jasmine.TeamcityReporter;
|
||||
|
||||
//
|
||||
// Exports
|
||||
//
|
||||
exports.jasmineNode = jasmineNode;
|
||||
})();
|
||||
86
6/node_modules/jasmine-node/lib/jasmine-node/requirejs-runner.js
generated
vendored
Normal file
86
6/node_modules/jasmine-node/lib/jasmine-node/requirejs-runner.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
exports.executeJsRunner = function(specCollection, done, jasmineEnv, setupFile) {
|
||||
var specs,
|
||||
specLoader = require('./requirejs-spec-loader'),
|
||||
requirejs = require('requirejs'),
|
||||
vm = require('vm'),
|
||||
fs = require('fs'),
|
||||
coffeescript = require('coffeescript'),
|
||||
template = fs.readFileSync(
|
||||
setupFile || (__dirname + '/requirejs-wrapper-template.js'),
|
||||
'utf8'
|
||||
),
|
||||
ensureUnixPath = function(path){
|
||||
return path.replace(/^(.):/, '/$1').replace(/\\/g, '/');
|
||||
},
|
||||
buildNewContext = function(spec){
|
||||
var context = {
|
||||
describe: describe,
|
||||
it: it,
|
||||
xdescribe: xdescribe,
|
||||
xit: xit,
|
||||
beforeEach: beforeEach,
|
||||
afterEach: afterEach,
|
||||
spyOn: spyOn,
|
||||
waitsFor: waitsFor,
|
||||
waits: waits,
|
||||
runs: runs,
|
||||
jasmine: jasmine,
|
||||
expect: expect,
|
||||
require: require,
|
||||
console: console,
|
||||
process: process,
|
||||
module: module,
|
||||
specLoader: specLoader,
|
||||
__dirname: spec.directory(),
|
||||
__filename: spec.path(),
|
||||
baseUrl: buildRelativeDirName(spec.directory()),
|
||||
csPath: __dirname + '/cs'
|
||||
};
|
||||
|
||||
context.global = context;
|
||||
|
||||
return context;
|
||||
},
|
||||
buildRelativeDirName = function(dir){
|
||||
var retVal = "",
|
||||
thisDir = ensureUnixPath(process.cwd()),
|
||||
toDir = ensureUnixPath(dir).split('/'),
|
||||
index = 0;
|
||||
|
||||
thisDir = thisDir.split('/');
|
||||
|
||||
for(; index < thisDir.length || index < toDir.length; index++) {
|
||||
if(thisDir[index] != toDir[index]){
|
||||
for(var i = index; i < thisDir.length-1; i++){
|
||||
retVal += '../';
|
||||
}
|
||||
|
||||
for(var i = index; i < toDir.length; i++){
|
||||
retVal += toDir[i] + '/';
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return retVal.trim('/');
|
||||
};
|
||||
|
||||
specCollection.getSpecs().forEach(function(s){
|
||||
var script = fs.readFileSync(s.path(), 'utf8');
|
||||
|
||||
if (s.filename().substr(-6).toLowerCase() == 'coffee') {
|
||||
script = coffeescript.compile(script);
|
||||
}
|
||||
|
||||
var newContext = buildNewContext(s);
|
||||
newContext.setTimeout = jasmine.getGlobal().setTimeout;
|
||||
newContext.setInterval = jasmine.getGlobal().setInterval;
|
||||
|
||||
var vmContext = vm.createContext(newContext);
|
||||
vm.runInContext(template, vmContext);
|
||||
vm.runInContext(script, vmContext, s.path());
|
||||
});
|
||||
|
||||
specLoader.executeWhenAllSpecsAreComplete(jasmineEnv);
|
||||
};
|
||||
48
6/node_modules/jasmine-node/lib/jasmine-node/requirejs-spec-loader.js
generated
vendored
Normal file
48
6/node_modules/jasmine-node/lib/jasmine-node/requirejs-spec-loader.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
var _ = require('underscore'),
|
||||
registry = {},
|
||||
timeout = 120000,
|
||||
now = function() {
|
||||
return new Date().getTime();
|
||||
},
|
||||
loader = {
|
||||
register: function(name) {
|
||||
registry[name] = false;
|
||||
},
|
||||
completed: function(name){
|
||||
registry[name] = true;
|
||||
}
|
||||
},
|
||||
specLoader = {
|
||||
defineLoader: function(requirejs) {
|
||||
requirejs.define('jasmine-spec-loader', function() {
|
||||
return loader;
|
||||
});
|
||||
},
|
||||
executeWhenAllSpecsAreComplete: function(jasmineEnv) {
|
||||
var allComplete = false,
|
||||
wait = now(),
|
||||
timeoutCallback = function() {
|
||||
allComplete = _.all(registry, function(value) {
|
||||
return value;
|
||||
});
|
||||
|
||||
if(!allComplete && wait + timeout > now()) {
|
||||
setTimeout(timeoutCallback, 100);
|
||||
} else if (!allComplete) {
|
||||
console.log('Failed to load all specs within timeout window.');
|
||||
process.exit(-1);
|
||||
} else {
|
||||
jasmineEnv.execute();
|
||||
}
|
||||
};
|
||||
|
||||
setTimeout(timeoutCallback, 100);
|
||||
},
|
||||
setTimeoutInterval: function(value) {
|
||||
timeout = value;
|
||||
},
|
||||
};
|
||||
|
||||
for(var key in specLoader) {
|
||||
exports[key] = specLoader[key];
|
||||
}
|
||||
78
6/node_modules/jasmine-node/lib/jasmine-node/requirejs-wrapper-template.js
generated
vendored
Normal file
78
6/node_modules/jasmine-node/lib/jasmine-node/requirejs-wrapper-template.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
/* Setup file run before spec files to setup the context (and RequireJS
|
||||
* specifically) to execute the spec file.
|
||||
*
|
||||
* Defined by caller:
|
||||
* - Jasmine predefines
|
||||
* - require (Node require)
|
||||
* - __dirname, __filename
|
||||
* - baseUrl (Relative path to the directory containing this file)
|
||||
* - csPath (Path to require-cs module)
|
||||
*
|
||||
* See requirejs-runner source for full invocation details.
|
||||
*/
|
||||
var define,
|
||||
requirejsOrig = require('requirejs'),
|
||||
ostring = Object.prototype.toString,
|
||||
path = require('path'),
|
||||
isArray = function(it){
|
||||
return ostring.call(it) === '[object Array]';
|
||||
},
|
||||
isFunction = function(it){
|
||||
return ostring.call(it) === '[object Function]';
|
||||
},
|
||||
requirejs = function(deps, callback){
|
||||
var retVal;
|
||||
|
||||
if(!isArray(deps) && typeof deps !== 'string'){
|
||||
if(isArray(callback)){
|
||||
retVal = requirejsOrig(deps, callback, arguments[2]);
|
||||
} else {
|
||||
retVal = requirejsOrig(deps, [], callback);
|
||||
}
|
||||
} else {
|
||||
retVal = requirejsOrig(deps, callback);
|
||||
}
|
||||
|
||||
return retVal;
|
||||
};
|
||||
|
||||
requirejsOrig.config({
|
||||
baseUrl: baseUrl,
|
||||
nodeRequire: require,
|
||||
paths: {
|
||||
cs: csPath
|
||||
}
|
||||
});
|
||||
|
||||
for(var key in requirejsOrig) {
|
||||
requirejs[key] = requirejsOrig[key];
|
||||
}
|
||||
|
||||
requirejs.config = function(config){
|
||||
var alteredConfig = {};
|
||||
|
||||
for(var key in config) {
|
||||
alteredConfig[key] = config[key];
|
||||
}
|
||||
|
||||
if(alteredConfig.baseUrl){
|
||||
var base = baseUrl.replace(/\\/g, '/'),
|
||||
splitUrl = alteredConfig.baseUrl.replace(/\\/g, '/').split('/'),
|
||||
index = 0;
|
||||
|
||||
for(; index < splitUrl.length; index++){
|
||||
if(splitUrl[index] === '..'){
|
||||
base = path.dirname(base);
|
||||
} else {
|
||||
base += '/' + splitUrl[index];
|
||||
}
|
||||
}
|
||||
|
||||
alteredConfig.baseUrl = base;
|
||||
}
|
||||
|
||||
return requirejsOrig.config(alteredConfig);
|
||||
};
|
||||
|
||||
require = requirejs;
|
||||
define = requirejs.define;
|
||||
44
6/node_modules/jasmine-node/lib/jasmine-node/spec-collection.js
generated
vendored
Normal file
44
6/node_modules/jasmine-node/lib/jasmine-node/spec-collection.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
var walkdir = require('walkdir');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var specs;
|
||||
|
||||
var createSpecObj = function(path, root) {
|
||||
return {
|
||||
path: function() { return path; },
|
||||
relativePath: function() { return path.replace(root, '').replace(/^[\/\\]/, '').replace(/\\/g, '/'); },
|
||||
directory: function() { return path.replace(/[\/\\][\s\w\.-]*$/, "").replace(/\\/g, '/'); },
|
||||
relativeDirectory: function() { return relativePath().replace(/[\/\\][\s\w\.-]*$/, "").replace(/\\/g, '/'); },
|
||||
filename: function() { return path.replace(/^.*[\\\/]/, ''); }
|
||||
};
|
||||
};
|
||||
|
||||
exports.load = function(loadpaths, matcher) {
|
||||
var wannaBeSpecs = []
|
||||
specs = [];
|
||||
loadpaths.forEach(function(loadpath){
|
||||
wannaBeSpecs = walkdir.sync(loadpath, { follow_symlinks: true });
|
||||
for (var i = 0; i < wannaBeSpecs.length; i++) {
|
||||
var file = wannaBeSpecs[i];
|
||||
try {
|
||||
if (fs.statSync(file).isFile()) {
|
||||
if (!/.*node_modules.*/.test(path.relative(loadpath, file)) &
|
||||
matcher.test(path.basename(file))) {
|
||||
specs.push(createSpecObj(file));
|
||||
}
|
||||
}
|
||||
} catch(e) {
|
||||
// nothing to do here
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports.getSpecs = function() {
|
||||
// Sorts spec paths in ascending alphabetical order to be able to
|
||||
// run tests in a deterministic order.
|
||||
specs.sort(function(a, b) {
|
||||
return a.path().localeCompare(b.path());
|
||||
});
|
||||
return specs;
|
||||
};
|
||||
33
6/node_modules/jasmine-node/package.json
generated
vendored
Normal file
33
6/node_modules/jasmine-node/package.json
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "jasmine-node",
|
||||
"version": "3.0.0",
|
||||
"description": "DOM-less simple JavaScript BDD testing framework for Node",
|
||||
"homepage": "https://github.com/mhevery/jasmine-node",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mhevery/jasmine-node.git"
|
||||
},
|
||||
"keywords": [
|
||||
"testing",
|
||||
"bdd"
|
||||
],
|
||||
"author": "Misko Hevery <misko@hevery.com>",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"coffeescript": "~1.12.7",
|
||||
"gaze": "~1.1.2",
|
||||
"jasmine-growl-reporter": "~2.0.0",
|
||||
"jasmine-reporters": "~1.0.0",
|
||||
"mkdirp": "~0.3.5",
|
||||
"requirejs": "~2.3.6",
|
||||
"underscore": "~1.9.1",
|
||||
"walkdir": "~0.0.12"
|
||||
},
|
||||
"bin": "bin/jasmine-node",
|
||||
"preferGlobal": true,
|
||||
"main": "lib/jasmine-node",
|
||||
"scripts": {
|
||||
"test": "node lib/jasmine-node/cli.js spec"
|
||||
},
|
||||
"devDependencies": {}
|
||||
}
|
||||
37
6/node_modules/jasmine-node/scripts/specs
generated
vendored
Normal file
37
6/node_modules/jasmine-node/scripts/specs
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
entry="node lib/jasmine-node/cli.js "
|
||||
|
||||
if [ $# -ne 0 ]; then
|
||||
command=$entry"$1 spec"
|
||||
echo $command
|
||||
$command
|
||||
else
|
||||
echo "Running all tests located in the spec directory"
|
||||
command=$entry"spec"
|
||||
echo $command
|
||||
time $command #/nested/uber-nested
|
||||
echo -e "\033[1;35m--- Should have 40 tests and 71 assertions and 1 Failure. ---\033[0m"
|
||||
echo ""
|
||||
|
||||
echo "Running all tests located in the spec directory with coffee option"
|
||||
command=$entry"--coffee spec"
|
||||
echo $command
|
||||
time $command #/nested/uber-nested
|
||||
echo -e "\033[1;35m--- Should have 40 tests and 71 assertions and 1 Failure. ---\033[0m"
|
||||
echo ""
|
||||
|
||||
echo "Running all tests located in the spec directory with requirejs option"
|
||||
#command=$entry"--nohelpers --runWithRequireJs spec-requirejs"
|
||||
command=$entry"--runWithRequireJs spec"
|
||||
echo $command
|
||||
time $command
|
||||
echo -e "\033[1;35m--- Should have 40 tests and 71 assertions and 1 Failure. ---\033[0m"
|
||||
|
||||
echo "Running all tests located in the spec-requirejs directory with requirejs"
|
||||
#command=$entry"--nohelpers --runWithRequireJs spec-requirejs"
|
||||
command=$entry"--runWithRequireJs spec-requirejs"
|
||||
echo $command
|
||||
time $command
|
||||
echo -e "\033[1;35m--- Should have 1 test and 2 assertions and 0 Failures. ---\033[0m"
|
||||
fi
|
||||
5
6/node_modules/jasmine-node/spec-requirejs-coffee/RequireCsSpec.coffee
generated
vendored
Normal file
5
6/node_modules/jasmine-node/spec-requirejs-coffee/RequireCsSpec.coffee
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
require [ "cs!requirecs.sut" ], (sut) ->
|
||||
describe "RequireJs basic tests with spec and sut in CoffeeScript", ->
|
||||
it "should load coffeescript sut", ->
|
||||
expect(sut.name).toBe "CoffeeScript To Test"
|
||||
expect(sut.method(2)).toBe 4
|
||||
5
6/node_modules/jasmine-node/spec-requirejs-coffee/RequireJsSpec.coffee
generated
vendored
Normal file
5
6/node_modules/jasmine-node/spec-requirejs-coffee/RequireJsSpec.coffee
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
require [ "requirecs.sut" ], (sut) ->
|
||||
describe "RequireJs basic tests with spec in CoffeeScript", ->
|
||||
it "should load javascript sut", ->
|
||||
expect(sut.name).toBe "CoffeeScript To Test"
|
||||
expect(sut.method(2)).toBe 4
|
||||
3
6/node_modules/jasmine-node/spec-requirejs-coffee/requirecs.sut.coffee
generated
vendored
Normal file
3
6/node_modules/jasmine-node/spec-requirejs-coffee/requirecs.sut.coffee
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
define ->
|
||||
name: 'CoffeeScript To Test'
|
||||
method: (input) -> 2 * input
|
||||
13
6/node_modules/jasmine-node/spec-requirejs-coffee/requirejs-setup.js
generated
vendored
Normal file
13
6/node_modules/jasmine-node/spec-requirejs-coffee/requirejs-setup.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
/** Custom RequireJS setup file to test user-specified setup files */
|
||||
|
||||
/* We want to minimize behavior changes between this test setup file and the
|
||||
* default setup file to avoid breaking tests which rely on any (current or
|
||||
* future) default behavior. So we:
|
||||
* - Run the normal setup file
|
||||
* - Avoid introducing additional global variables
|
||||
* - Avoid maintaining two copies of the setup file
|
||||
*/
|
||||
eval(require('fs').readFileSync(baseUrl + '../lib/jasmine-node/requirejs-wrapper-template.js', 'utf8'));
|
||||
|
||||
// This is our indicator that this custom setup script has run
|
||||
var setupHasRun = true;
|
||||
13
6/node_modules/jasmine-node/spec-requirejs/requirejs-setup.js
generated
vendored
Normal file
13
6/node_modules/jasmine-node/spec-requirejs/requirejs-setup.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
/** Custom RequireJS setup file to test user-specified setup files */
|
||||
|
||||
/* We want to minimize behavior changes between this test setup file and the
|
||||
* default setup file to avoid breaking tests which rely on any (current or
|
||||
* future) default behavior. So we:
|
||||
* - Run the normal setup file
|
||||
* - Avoid introducing additional global variables
|
||||
* - Avoid maintaining two copies of the setup file
|
||||
*/
|
||||
eval(require('fs').readFileSync(baseUrl + '../lib/jasmine-node/requirejs-wrapper-template.js', 'utf8'));
|
||||
|
||||
// This is our indicator that this custom setup script has run
|
||||
var setupHasRun = true;
|
||||
78
6/node_modules/jasmine-node/spec-requirejs/requirejs-wrapper-template.js
generated
vendored
Normal file
78
6/node_modules/jasmine-node/spec-requirejs/requirejs-wrapper-template.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
/* Setup file run before spec files to setup the context (and RequireJS
|
||||
* specifically) to execute the spec file.
|
||||
*
|
||||
* Defined by caller:
|
||||
* - Jasmine predefines
|
||||
* - require (Node require)
|
||||
* - __dirname, __filename
|
||||
* - baseUrl (Relative path to the directory containing this file)
|
||||
* - csPath (Path to require-cs module)
|
||||
*
|
||||
* See requirejs-runner source for full invocation details.
|
||||
*/
|
||||
var define,
|
||||
requirejsOrig = require('requirejs'),
|
||||
ostring = Object.prototype.toString,
|
||||
path = require('path'),
|
||||
isArray = function(it){
|
||||
return ostring.call(it) === '[object Array]';
|
||||
},
|
||||
isFunction = function(it){
|
||||
return ostring.call(it) === '[object Function]';
|
||||
},
|
||||
requirejs = function(deps, callback){
|
||||
var retVal;
|
||||
|
||||
if(!isArray(deps) && typeof deps !== 'string'){
|
||||
if(isArray(callback)){
|
||||
retVal = requirejsOrig(deps, callback, arguments[2]);
|
||||
} else {
|
||||
retVal = requirejsOrig(deps, [], callback);
|
||||
}
|
||||
} else {
|
||||
retVal = requirejsOrig(deps, callback);
|
||||
}
|
||||
|
||||
return retVal;
|
||||
};
|
||||
|
||||
requirejsOrig.config({
|
||||
baseUrl: baseUrl,
|
||||
nodeRequire: require,
|
||||
paths: {
|
||||
cs: csPath
|
||||
}
|
||||
});
|
||||
|
||||
for(var key in requirejsOrig) {
|
||||
requirejs[key] = requirejsOrig[key];
|
||||
}
|
||||
|
||||
requirejs.config = function(config){
|
||||
var alteredConfig = {};
|
||||
|
||||
for(var key in config) {
|
||||
alteredConfig[key] = config[key];
|
||||
}
|
||||
|
||||
if(alteredConfig.baseUrl){
|
||||
var base = baseUrl.replace(/\\/g, '/'),
|
||||
splitUrl = alteredConfig.baseUrl.replace(/\\/g, '/').split('/'),
|
||||
index = 0;
|
||||
|
||||
for(; index < splitUrl.length; index++){
|
||||
if(splitUrl[index] === '..'){
|
||||
base = path.dirname(base);
|
||||
} else {
|
||||
base += '/' + splitUrl[index];
|
||||
}
|
||||
}
|
||||
|
||||
alteredConfig.baseUrl = base;
|
||||
}
|
||||
|
||||
return requirejsOrig.config(alteredConfig);
|
||||
};
|
||||
|
||||
require = requirejs;
|
||||
define = requirejs.define;
|
||||
19
6/node_modules/jasmine-node/spec-requirejs/requirejs.spec.js
generated
vendored
Normal file
19
6/node_modules/jasmine-node/spec-requirejs/requirejs.spec.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
require(['requirejs.sut'], function(sut){
|
||||
describe('RequireJs basic tests', function(){
|
||||
beforeEach(function(){
|
||||
expect(true).toBeTruthy();
|
||||
});
|
||||
afterEach(function(){
|
||||
expect(true).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should load sut', function(){
|
||||
expect(sut.name).toBe('Subject To Test');
|
||||
expect(sut.method(2)).toBe(3);
|
||||
});
|
||||
|
||||
it('should run setup', function(){
|
||||
expect(typeof setupHasRun).toBe('boolean');
|
||||
});
|
||||
});
|
||||
});
|
||||
8
6/node_modules/jasmine-node/spec-requirejs/requirejs.sut.js
generated
vendored
Normal file
8
6/node_modules/jasmine-node/spec-requirejs/requirejs.sut.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
define(function(){
|
||||
return {
|
||||
name: 'Subject To Test',
|
||||
method: function(input){
|
||||
return 1+input;
|
||||
}
|
||||
};
|
||||
});
|
||||
11
6/node_modules/jasmine-node/spec/AsyncSpec.coffee
generated
vendored
Normal file
11
6/node_modules/jasmine-node/spec/AsyncSpec.coffee
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
#=============================================================================
|
||||
# Async spec, that will be time outed
|
||||
#=============================================================================
|
||||
describe 'async', ->
|
||||
it 'should be timed out', ->
|
||||
waitsFor (-> false), 'MIRACLE', 500
|
||||
|
||||
doneFunc = (done) ->
|
||||
setTimeout(done, 10000)
|
||||
|
||||
it "should timeout after 100 ms", doneFunc, 100
|
||||
4
6/node_modules/jasmine-node/spec/CoffeeSpec.coffee
generated
vendored
Normal file
4
6/node_modules/jasmine-node/spec/CoffeeSpec.coffee
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
describe 'jasmine-node', ->
|
||||
|
||||
it 'should pass', ->
|
||||
expect(1+2).toEqual(3)
|
||||
22
6/node_modules/jasmine-node/spec/GrammarHelper.coffee
generated
vendored
Normal file
22
6/node_modules/jasmine-node/spec/GrammarHelper.coffee
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
global.testClass = (description, specDefinitions) ->
|
||||
suite = jasmine.getEnv().describe('Class: ' + description, specDefinitions)
|
||||
suite.tags = ['class']
|
||||
suite.isIntermediate = true;
|
||||
suite
|
||||
|
||||
global.feature = (description, specDefinitions) ->
|
||||
suite = jasmine.getEnv().describe('Feature: ' + description, specDefinitions)
|
||||
suite.tags = ['feature']
|
||||
suite.isIntermediate = true;
|
||||
suite
|
||||
|
||||
global.scenario = (desc, func) ->
|
||||
suite = jasmine.getEnv().describe('Scenario: ' + desc, func)
|
||||
suite.tags = ['scenario']
|
||||
suite.isIntermediate = true;
|
||||
suite
|
||||
|
||||
global.should = (description, specDefinitions) ->
|
||||
suite = jasmine.getEnv().it('It should ' + description, specDefinitions)
|
||||
suite.tags = ['should']
|
||||
suite
|
||||
6
6/node_modules/jasmine-node/spec/HelperSpec.coffee
generated
vendored
Normal file
6
6/node_modules/jasmine-node/spec/HelperSpec.coffee
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
testClass 'HelperLoader', ->
|
||||
feature 'Loading order', ->
|
||||
should 'load the helpers before the specs.', ->
|
||||
expect(true).toBeTruthy()
|
||||
# will fail to parse the spec if the helper was not loaded first
|
||||
25
6/node_modules/jasmine-node/spec/SampleSpecs.js
generated
vendored
Normal file
25
6/node_modules/jasmine-node/spec/SampleSpecs.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
describe('jasmine-node', function(){
|
||||
|
||||
it('should pass', function(){
|
||||
expect(1+2).toEqual(3);
|
||||
});
|
||||
|
||||
it('shows asynchronous test', function(){
|
||||
setTimeout(function(){
|
||||
expect('second').toEqual('second');
|
||||
asyncSpecDone();
|
||||
}, 1);
|
||||
expect('first').toEqual('first');
|
||||
asyncSpecWait();
|
||||
});
|
||||
|
||||
it('shows asynchronous test node-style', function(done){
|
||||
setTimeout(function(){
|
||||
expect('second').toEqual('second');
|
||||
// If you call done() with an argument, it will fail the spec
|
||||
// so you can use it as a handler for many async node calls
|
||||
done();
|
||||
}, 1);
|
||||
expect('first').toEqual('first');
|
||||
});
|
||||
});
|
||||
100
6/node_modules/jasmine-node/spec/TestSpec.js
generated
vendored
Normal file
100
6/node_modules/jasmine-node/spec/TestSpec.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
|
||||
describe('jasmine-node-flat', function(){
|
||||
it('should pass', function(){
|
||||
expect(1+2).toEqual(3);
|
||||
});
|
||||
});
|
||||
|
||||
describe('beforeEach Timeout', function(){
|
||||
beforeEach(function(done) {
|
||||
setTimeout(done, 1000);
|
||||
}, 100);
|
||||
it('should fail', function(){
|
||||
expect(1+2).toEqual(3);
|
||||
});
|
||||
});
|
||||
|
||||
describe('afterEach Timeout', function(){
|
||||
afterEach(function(done) {
|
||||
setTimeout(done, 1000);
|
||||
}, 100);
|
||||
it('should pass and then afterEach will fail', function(){
|
||||
expect(1+2).toEqual(3);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Testing some characters', function() {
|
||||
var chars = ['&', '\'', '"', '<', '>'];
|
||||
for(var i = 0; i < chars.length; i+=1) {
|
||||
currentChar = chars[i];
|
||||
it('should reject ' + currentChar, (function(currentChar) {
|
||||
expect(false).toEqual(false);
|
||||
})(currentChar));
|
||||
}
|
||||
});
|
||||
|
||||
describe('Testing waitsfor functionality', function() {
|
||||
it("Runs and then waitsFor", function() {
|
||||
runs(function() {
|
||||
1+1;
|
||||
});
|
||||
waitsFor(function() {
|
||||
return true === false;
|
||||
}, "the impossible", 1000);
|
||||
runs(function() {
|
||||
expect(true).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('root', function () {
|
||||
|
||||
describe('nested', function () {
|
||||
|
||||
xit('nested statement', function () {
|
||||
expect(1).toBeTruthy();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
it('root statement', function () {
|
||||
expect(1).toBeTruthy();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe("Top level describe block", function() {
|
||||
it("first it block in top level describe", function() {
|
||||
expect(true).toEqual(true);
|
||||
});
|
||||
describe("Second level describe block", function() {
|
||||
it("first it block in second level describe", function() {
|
||||
expect(true).toBe(true);
|
||||
});
|
||||
});
|
||||
it("second it block in top level describe", function() {
|
||||
expect(true).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('async', function () {
|
||||
|
||||
var request = function (str, func) {
|
||||
func('1', '2', 'hello world');
|
||||
};
|
||||
|
||||
it("should respond with hello world", function(done) {
|
||||
request("http://localhost:3000/hello", function(error, response, body){
|
||||
expect(body).toEqual("hello world");
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it("should respond with hello world", function(done) {
|
||||
request("http://localhost:3000/hello", function(error, response, body){
|
||||
expect(body).toEqual("hello world");
|
||||
done();
|
||||
});
|
||||
}, 250); // timeout after 250 ms
|
||||
|
||||
});
|
||||
34
6/node_modules/jasmine-node/spec/TimerSpec.js
generated
vendored
Normal file
34
6/node_modules/jasmine-node/spec/TimerSpec.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
describe("Manually ticking the Jasmine Mock Clock", function() {
|
||||
var timerCallback;
|
||||
|
||||
beforeEach(function() {
|
||||
timerCallback = jasmine.createSpy('timerCallback');
|
||||
jasmine.Clock.useMock();
|
||||
});
|
||||
|
||||
it("causes a timeout to be called synchronously", function() {
|
||||
setTimeout(timerCallback, 100);
|
||||
|
||||
expect(timerCallback).not.toHaveBeenCalled();
|
||||
|
||||
jasmine.Clock.tick(101);
|
||||
|
||||
expect(timerCallback).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("causes an interval to be called synchronously", function() {
|
||||
setInterval(timerCallback, 100);
|
||||
|
||||
expect(timerCallback).not.toHaveBeenCalled();
|
||||
|
||||
jasmine.Clock.tick(102);
|
||||
expect(timerCallback).toHaveBeenCalled();
|
||||
expect(timerCallback.callCount).toEqual(1);
|
||||
|
||||
jasmine.Clock.tick(50);
|
||||
expect(timerCallback.callCount).toEqual(1);
|
||||
|
||||
jasmine.Clock.tick(50);
|
||||
expect(timerCallback.callCount).toEqual(2);
|
||||
});
|
||||
});
|
||||
174
6/node_modules/jasmine-node/spec/async-callback_spec.js
generated
vendored
Normal file
174
6/node_modules/jasmine-node/spec/async-callback_spec.js
generated
vendored
Normal file
@@ -0,0 +1,174 @@
|
||||
describe('async-callback', function() {
|
||||
var env;
|
||||
beforeEach(function() {
|
||||
env = new jasmine.Env();
|
||||
});
|
||||
|
||||
describe('it', function() {
|
||||
|
||||
it("should time out if callback is not called", function() {
|
||||
env.describe("it", function() {
|
||||
env.it("doesn't wait", function(done) {
|
||||
expect(1+2).toEqual(3);
|
||||
});
|
||||
});
|
||||
|
||||
env.currentRunner().execute();
|
||||
|
||||
waitsFor(function() {
|
||||
return env.currentRunner().results().totalCount > 0;
|
||||
}, 6000);
|
||||
|
||||
runs(function() {
|
||||
expect(env.currentRunner().results().failedCount).toEqual(1);
|
||||
expect(firstResult(env.currentRunner()).message).toMatch(/timeout/);;
|
||||
});
|
||||
});
|
||||
|
||||
it("should accept timeout for individual spec", function() {
|
||||
env.describe("it", function() {
|
||||
env.it("doesn't wait", function(done) {
|
||||
expect(1+2).toEqual(3);
|
||||
}, 250);
|
||||
});
|
||||
|
||||
env.currentRunner().execute();
|
||||
|
||||
waitsFor(function() {
|
||||
return env.currentRunner().results().totalCount > 0;
|
||||
}, 500);
|
||||
|
||||
runs(function() {
|
||||
expect(env.currentRunner().results().failedCount).toEqual(1);
|
||||
expect(firstResult(env.currentRunner()).message).toMatch(/timeout/);;
|
||||
});
|
||||
});
|
||||
|
||||
it("should fail if callback is passed error", function() {
|
||||
env.describe("it", function() {
|
||||
env.it("doesn't wait", function(done) {
|
||||
process.nextTick(function() {
|
||||
done("Failed asynchronously");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
env.currentRunner().execute();
|
||||
|
||||
waitsFor(function() {
|
||||
return env.currentRunner().results().totalCount > 0;
|
||||
});
|
||||
|
||||
runs(function() {
|
||||
expect(env.currentRunner().results().failedCount).toEqual(1);
|
||||
expect(firstResult(env.currentRunner()).message).toEqual("Failed asynchronously");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it("should finish after callback is called", function() {
|
||||
env.describe("it", function() {
|
||||
env.it("waits", function(done) {
|
||||
process.nextTick(function() {
|
||||
env.currentSpec.expect(1+2).toEqual(3);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
env.currentRunner().execute();
|
||||
|
||||
waitsFor(function() {
|
||||
return env.currentRunner().results().totalCount > 0;
|
||||
}, 2000);
|
||||
|
||||
runs(function() {
|
||||
expect(env.currentRunner().results().passedCount).toEqual(1);
|
||||
});
|
||||
});
|
||||
|
||||
it('should run in the context of the current spec', function(){
|
||||
var actualContext;
|
||||
var jasmineSpecContext;
|
||||
env.describe("it", function() {
|
||||
env.it("register context", function(done) {
|
||||
actualContext = this;
|
||||
jasmineSpecContext = env.currentSpec;
|
||||
env.expect(this).toBe(jasmineSpecContext);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
env.currentRunner().execute();
|
||||
|
||||
waitsFor(function() {
|
||||
return env.currentRunner().results().totalCount > 0;
|
||||
}, 'tested jasmine env runner to run the test', 100);
|
||||
|
||||
runs(function() {
|
||||
expect(actualContext).not.toBe(global);
|
||||
expect(actualContext).toBe(jasmineSpecContext);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe("beforeEach", function() {
|
||||
it("should wait for callback", function() {
|
||||
env.describe("beforeEach", function() {
|
||||
var waited = false;
|
||||
env.beforeEach(function(done) {
|
||||
process.nextTick(function() {
|
||||
waited = true;
|
||||
done();
|
||||
});
|
||||
});
|
||||
env.it("waited", function() {
|
||||
env.currentSpec.expect(waited).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
env.currentRunner().execute();
|
||||
|
||||
waitsFor(function() {
|
||||
return env.currentRunner().results().totalCount > 0;
|
||||
});
|
||||
|
||||
runs(function() {
|
||||
expect(env.currentRunner().results().passedCount).toEqual(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("afterEach", function() {
|
||||
it("should be passed async callback", function() {
|
||||
var completed = false;
|
||||
env.describe("afterEach", function() {
|
||||
env.afterEach(function(done) {
|
||||
process.nextTick(function() {
|
||||
done('Failed in afterEach');
|
||||
completed = true;
|
||||
});
|
||||
});
|
||||
env.it("should pass", function() {
|
||||
this.expect(1+2).toEqual(3);
|
||||
});
|
||||
});
|
||||
|
||||
env.currentRunner().execute();
|
||||
|
||||
waitsFor(function() {
|
||||
return completed === true;
|
||||
});
|
||||
|
||||
runs(function() {
|
||||
expect(env.currentRunner().results().passedCount).toEqual(1);
|
||||
expect(env.currentRunner().results().failedCount).toEqual(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function firstResult(runner) {
|
||||
return runner.results().getItems()[0].getItems()[0].getItems()[0];
|
||||
}
|
||||
7
6/node_modules/jasmine-node/spec/helper_spec.js
generated
vendored
Normal file
7
6/node_modules/jasmine-node/spec/helper_spec.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
describe("helper", function() {
|
||||
it("should load the helpers", function() {
|
||||
var expectation= expect(true);
|
||||
|
||||
expect(typeof(expectation.toHaveProperty)).toBe('function');
|
||||
});
|
||||
});
|
||||
9
6/node_modules/jasmine-node/spec/litcoffee/Litcoffee.spec.litcoffee
generated
vendored
Normal file
9
6/node_modules/jasmine-node/spec/litcoffee/Litcoffee.spec.litcoffee
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
Literate CoffeeScript
|
||||
====================
|
||||
|
||||
This is a spec using written in Literate CoffeeScript
|
||||
|
||||
describe 'Coffee.litcoffee', ->
|
||||
|
||||
it 'should pass', ->
|
||||
expect(1+2).toEqual(3)
|
||||
5
6/node_modules/jasmine-node/spec/nested.js/NestedSpec.js
generated
vendored
Normal file
5
6/node_modules/jasmine-node/spec/nested.js/NestedSpec.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
describe('jasmine-node-nested.js', function(){
|
||||
it('should pass', function(){
|
||||
expect(1+2).toEqual(3);
|
||||
});
|
||||
});
|
||||
5
6/node_modules/jasmine-node/spec/nested/NestedSpec.js
generated
vendored
Normal file
5
6/node_modules/jasmine-node/spec/nested/NestedSpec.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
describe('jasmine-node-nested', function(){
|
||||
it('should pass', function(){
|
||||
expect(1+2).toEqual(3);
|
||||
});
|
||||
});
|
||||
11
6/node_modules/jasmine-node/spec/nested/uber-nested/UberNestedSpec.js
generated
vendored
Normal file
11
6/node_modules/jasmine-node/spec/nested/uber-nested/UberNestedSpec.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
describe('jasmine-node-uber-nested', function(){
|
||||
it('should pass', function(){
|
||||
expect(1+2).toEqual(3);
|
||||
});
|
||||
|
||||
describe('failure', function(){
|
||||
it('should report failure (THIS IS EXPECTED)', function(){
|
||||
expect(true).toBeFalsy();
|
||||
});
|
||||
});
|
||||
});
|
||||
495
6/node_modules/jasmine-node/spec/reporter_spec.js
generated
vendored
Normal file
495
6/node_modules/jasmine-node/spec/reporter_spec.js
generated
vendored
Normal file
@@ -0,0 +1,495 @@
|
||||
var jasmineNode = require(__dirname + "/../lib/jasmine-node/reporter").jasmineNode;
|
||||
|
||||
describe('TerminalReporter', function() {
|
||||
beforeEach(function() {
|
||||
var config = {}
|
||||
this.reporter = new jasmineNode.TerminalReporter(config);
|
||||
});
|
||||
|
||||
describe("initialize", function() {
|
||||
it('initializes print_ from config', function() {
|
||||
var config = { print: true };
|
||||
this.reporter = new jasmineNode.TerminalReporter(config);
|
||||
expect(this.reporter.print_).toBeTruthy();
|
||||
});
|
||||
|
||||
it('initializes color_ from config', function() {
|
||||
var config = { color: true }
|
||||
this.reporter = new jasmineNode.TerminalReporter(config);
|
||||
expect(this.reporter.color_).toEqual(jasmineNode.TerminalReporter.prototype.ANSIColors);
|
||||
});
|
||||
|
||||
it('initializes includeStackTrace_ from config', function () {
|
||||
var config = {}
|
||||
this.reporter = new jasmineNode.TerminalReporter(config);
|
||||
expect(this.reporter.includeStackTrace_).toBeTruthy();
|
||||
});
|
||||
|
||||
it('sets the started_ flag to false', function() {
|
||||
var config = {}
|
||||
this.reporter = new jasmineNode.TerminalReporter(config);
|
||||
expect(this.reporter.started_).toBeFalsy();
|
||||
});
|
||||
|
||||
it('sets the finished_ flag to false', function() {
|
||||
var config = {}
|
||||
this.reporter = new jasmineNode.TerminalReporter(config);
|
||||
expect(this.reporter.finished_).toBeFalsy();
|
||||
});
|
||||
|
||||
it('initializes the suites_ array', function() {
|
||||
var config = {}
|
||||
this.reporter = new jasmineNode.TerminalReporter(config);
|
||||
expect(this.reporter.suites_.length).toEqual(0);
|
||||
});
|
||||
|
||||
it('initializes the specResults_ to an Object', function() {
|
||||
var config = {}
|
||||
this.reporter = new jasmineNode.TerminalReporter(config);
|
||||
expect(this.reporter.specResults_).toBeDefined();
|
||||
});
|
||||
|
||||
it('initializes the failures_ array', function() {
|
||||
var config = {}
|
||||
this.reporter = new jasmineNode.TerminalReporter(config);
|
||||
expect(this.reporter.failures_.length).toEqual(0);
|
||||
});
|
||||
|
||||
it('sets the callback_ property to false by default', function() {
|
||||
var config = {}
|
||||
this.reporter = new jasmineNode.TerminalReporter(config);
|
||||
expect(this.reporter.callback_).toEqual(false)
|
||||
});
|
||||
|
||||
it('sets the callback_ property to onComplete if supplied', function() {
|
||||
var foo = function() { }
|
||||
var config = { onComplete: foo }
|
||||
this.reporter = new jasmineNode.TerminalReporter(config);
|
||||
expect(this.reporter.callback_).toBe(foo)
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the report runner starts', function() {
|
||||
beforeEach(function() {
|
||||
this.spy = spyOn(this.reporter, 'printLine_');
|
||||
|
||||
var runner = {
|
||||
topLevelSuites: function() {
|
||||
var suites = [];
|
||||
var suite = { id: 25 };
|
||||
suites.push(suite);
|
||||
return suites;
|
||||
}
|
||||
};
|
||||
this.reporter.reportRunnerStarting(runner);
|
||||
});
|
||||
|
||||
it('sets the started_ field to true', function() {
|
||||
expect(this.reporter.started_).toBeTruthy();
|
||||
});
|
||||
|
||||
it('sets the startedAt field', function() {
|
||||
// instanceof does not work cross-context (such as when run with requirejs)
|
||||
var ts = Object.prototype.toString;
|
||||
expect(ts.call(this.reporter.startedAt)).toBe(ts.call(new Date()));
|
||||
});
|
||||
|
||||
it('buildes the suites_ collection', function() {
|
||||
expect(this.reporter.suites_.length).toEqual(1);
|
||||
expect(this.reporter.suites_[0].id).toEqual(25);
|
||||
});
|
||||
});
|
||||
|
||||
describe('the summarize_ creates suite and spec tree', function() {
|
||||
beforeEach(function() {
|
||||
this.spec = {
|
||||
id: 1,
|
||||
description: 'the spec',
|
||||
isSuite: false
|
||||
}
|
||||
});
|
||||
|
||||
it('creates a summary object from spec', function() {
|
||||
var result = this.reporter.summarize_(this.spec);
|
||||
|
||||
expect(result.id).toEqual(1);
|
||||
expect(result.name).toEqual('the spec');
|
||||
expect(result.type).toEqual('spec');
|
||||
expect(result.children.length).toEqual(0);
|
||||
});
|
||||
|
||||
it('creates a summary object from suite with 1 spec', function() {
|
||||
var env = { nextSuiteId: false }
|
||||
var suite = new jasmine.Suite(env, 'suite name', undefined, undefined);
|
||||
suite.description = 'the suite';
|
||||
suite.parentSuite = null;
|
||||
suite.children_.push(this.spec);
|
||||
|
||||
var result = this.reporter.summarize_(suite);
|
||||
expect(result.name).toEqual('the suite');
|
||||
expect(result.type).toEqual('suite');
|
||||
expect(result.children.length).toEqual(1);
|
||||
|
||||
var suiteChildSpec = result.children[0];
|
||||
expect(suiteChildSpec.id).toEqual(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('reportRunnerResults', function() {
|
||||
beforeEach(function() {
|
||||
this.printLineSpy = spyOn(this.reporter, 'printLine_');
|
||||
});
|
||||
|
||||
it('generates the report', function() {
|
||||
var failuresSpy = spyOn(this.reporter, 'reportFailures_');
|
||||
var printRunnerResultsSpy = spyOn(this.reporter, 'printRunnerResults_').
|
||||
andReturn('this is the runner result');
|
||||
|
||||
var callbackSpy = spyOn(this.reporter, 'callback_');
|
||||
|
||||
var runner = {
|
||||
results: function() {
|
||||
var result = { failedCount: 0 };
|
||||
return result;
|
||||
},
|
||||
specs: function() { return []; }
|
||||
};
|
||||
this.reporter.startedAt = new Date();
|
||||
|
||||
this.reporter.reportRunnerResults(runner);
|
||||
|
||||
expect(failuresSpy).toHaveBeenCalled();
|
||||
expect(this.printLineSpy).toHaveBeenCalled();
|
||||
expect(callbackSpy).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('reportSpecResults', function() {
|
||||
beforeEach(function() {
|
||||
this.printSpy = spyOn(this.reporter, 'print_');
|
||||
this.spec = {
|
||||
id: 1,
|
||||
description: 'the spec',
|
||||
isSuite: false,
|
||||
results: function() {
|
||||
var result = {
|
||||
passed: function() { return true; }
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it('prints a \'.\' for pass', function() {
|
||||
this.reporter.reportSpecResults(this.spec);
|
||||
expect(this.printSpy).toHaveBeenCalledWith('.');
|
||||
});
|
||||
|
||||
it('prints an \'F\' for failure', function() {
|
||||
var addFailureToFailuresSpy = spyOn(this.reporter, 'addFailureToFailures_');
|
||||
var results = function() {
|
||||
var result = {
|
||||
passed: function() { return false; }
|
||||
}
|
||||
return result;
|
||||
}
|
||||
this.spec.results = results;
|
||||
|
||||
this.reporter.reportSpecResults(this.spec);
|
||||
|
||||
expect(this.printSpy).toHaveBeenCalledWith('F');
|
||||
expect(addFailureToFailuresSpy).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('addFailureToFailures', function() {
|
||||
it('adds message and stackTrace to failures_', function() {
|
||||
var spec = {
|
||||
suite: {
|
||||
getFullName: function() { return 'Suite name' }
|
||||
},
|
||||
description: 'the spec',
|
||||
results: function() {
|
||||
var result = {
|
||||
items_: function() {
|
||||
var theItems = new Array();
|
||||
var item = {
|
||||
passed_: false,
|
||||
message: 'the message',
|
||||
trace: {
|
||||
stack: 'the stack'
|
||||
}
|
||||
}
|
||||
theItems.push(item);
|
||||
return theItems;
|
||||
}.call()
|
||||
};
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
this.reporter.addFailureToFailures_(spec);
|
||||
|
||||
var failures = this.reporter.failures_;
|
||||
expect(failures.length).toEqual(1);
|
||||
var failure = failures[0];
|
||||
expect(failure.spec).toEqual('Suite name the spec');
|
||||
expect(failure.message).toEqual('the message');
|
||||
expect(failure.stackTrace).toEqual('the stack');
|
||||
});
|
||||
});
|
||||
|
||||
describe('prints the runner results', function() {
|
||||
beforeEach(function() {
|
||||
this.runner = {
|
||||
results: function() {
|
||||
var _results = {
|
||||
totalCount: 23,
|
||||
failedCount: 52
|
||||
};
|
||||
return _results;
|
||||
},
|
||||
specs: function() {
|
||||
var _specs = new Array();
|
||||
spec = {
|
||||
results: function() {
|
||||
var _results = {
|
||||
skipped: false
|
||||
}
|
||||
return _results;
|
||||
}
|
||||
};
|
||||
_specs.push(spec);
|
||||
return _specs;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
it('uses the specs\'s length, totalCount and failedCount', function() {
|
||||
var message = this.reporter.printRunnerResults_(this.runner);
|
||||
expect(message).toEqual('1 test, 23 assertions, 52 failures, 0 skipped\n');
|
||||
});
|
||||
});
|
||||
|
||||
describe('reports failures', function() {
|
||||
beforeEach(function() {
|
||||
this.printSpy = spyOn(this.reporter, 'print_');
|
||||
this.printLineSpy = spyOn(this.reporter, 'printLine_');
|
||||
});
|
||||
|
||||
it('does not report anything when there are no failures', function() {
|
||||
this.reporter.failures_ = new Array();
|
||||
|
||||
this.reporter.reportFailures_();
|
||||
|
||||
expect(this.printLineSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('prints the failures', function() {
|
||||
var failure = {
|
||||
spec: 'the spec',
|
||||
message: 'the message',
|
||||
stackTrace: 'the stackTrace'
|
||||
}
|
||||
|
||||
this.reporter.failures_ = new Array();
|
||||
this.reporter.failures_.push(failure);
|
||||
|
||||
this.reporter.reportFailures_();
|
||||
|
||||
var generatedOutput =
|
||||
[ [ '\n' ],
|
||||
[ '\n' ],
|
||||
[ ' 1) the spec' ],
|
||||
[ ' Message:' ],
|
||||
[ ' the message' ],
|
||||
[ ' Stacktrace:' ] ];
|
||||
|
||||
expect(this.printLineSpy).toHaveBeenCalled();
|
||||
expect(this.printLineSpy.argsForCall).toEqual(generatedOutput);
|
||||
|
||||
expect(this.printSpy).toHaveBeenCalled();
|
||||
expect(this.printSpy.argsForCall[0]).toEqual(['Failures:']);
|
||||
expect(this.printSpy.argsForCall[1]).toEqual([' the stackTrace']);
|
||||
});
|
||||
|
||||
it('prints the failures without a Stacktrace', function () {
|
||||
var config = { includeStackTrace: false };
|
||||
this.reporter = new jasmineNode.TerminalReporter(config);
|
||||
this.printSpy = spyOn(this.reporter, 'print_');
|
||||
this.printLineSpy = spyOn(this.reporter, 'printLine_');
|
||||
|
||||
var failure = {
|
||||
spec: 'the spec',
|
||||
message: 'the message',
|
||||
stackTrace: 'the stackTrace'
|
||||
}
|
||||
|
||||
this.reporter.failures_ = new Array();
|
||||
this.reporter.failures_.push(failure);
|
||||
|
||||
this.reporter.reportFailures_();
|
||||
|
||||
var generatedOutput =
|
||||
[ [ '\n' ],
|
||||
[ '\n' ],
|
||||
[ ' 1) the spec' ],
|
||||
[ ' Message:' ],
|
||||
[ ' the message' ] ];
|
||||
|
||||
expect(this.printLineSpy).toHaveBeenCalled();
|
||||
expect(this.printLineSpy.argsForCall).toEqual(generatedOutput);
|
||||
|
||||
expect(this.printSpy).toHaveBeenCalled();
|
||||
expect(this.printSpy.argsForCall[0]).toEqual(['Failures:']);
|
||||
expect(this.printSpy.argsForCall[1]).toBeUndefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('TerminalVerboseReporter', function() {
|
||||
beforeEach(function() {
|
||||
var config = {}
|
||||
this.verboseReporter = new jasmineNode.TerminalVerboseReporter(config);
|
||||
this.addFailureToFailuresSpy = spyOn(this.verboseReporter, 'addFailureToFailures_');
|
||||
this.spec = {
|
||||
id: 23,
|
||||
results: function() {
|
||||
return {
|
||||
failedCount: 1,
|
||||
getItems: function() {
|
||||
return ["this is the message"];
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
describe('#reportSpecResults', function() {
|
||||
it('adds the spec to the failures_', function() {
|
||||
this.verboseReporter.reportSpecResults(this.spec);
|
||||
|
||||
expect(this.addFailureToFailuresSpy).toHaveBeenCalledWith(this.spec);
|
||||
});
|
||||
|
||||
it('adds a new object to the specResults_', function() {
|
||||
this.verboseReporter.reportSpecResults(this.spec);
|
||||
|
||||
expect(this.verboseReporter.specResults_[23].messages).toEqual(['this is the message']);
|
||||
expect(this.verboseReporter.specResults_[23].result).toEqual('failed');
|
||||
});
|
||||
});
|
||||
|
||||
describe('#buildMessagesFromResults_', function() {
|
||||
beforeEach(function() {
|
||||
this.suite = {
|
||||
id: 17,
|
||||
type: 'suite',
|
||||
name: 'a describe block',
|
||||
suiteNestingLevel: 0,
|
||||
children: [],
|
||||
getFullName: function() { return "A spec"; },
|
||||
};
|
||||
|
||||
this.spec = {
|
||||
id: 23,
|
||||
type: 'spec',
|
||||
name: 'a spec block',
|
||||
children: []
|
||||
};
|
||||
|
||||
this.verboseReporter.specResults_['23'] = {
|
||||
result: 'passed',
|
||||
runtime: 200
|
||||
};
|
||||
|
||||
this.verboseReporter.suiteResults_['17'] = {
|
||||
runtime: 500
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
it('does not build anything when the results collection is empty', function() {
|
||||
var results = [],
|
||||
messages = [];
|
||||
|
||||
this.verboseReporter.buildMessagesFromResults_(messages, results);
|
||||
|
||||
expect(messages.length).toEqual(0);
|
||||
});
|
||||
|
||||
it('adds a single suite to the messages', function() {
|
||||
var results = [],
|
||||
messages = [];
|
||||
|
||||
results.push(this.suite);
|
||||
|
||||
this.verboseReporter.buildMessagesFromResults_(messages, results);
|
||||
|
||||
expect(messages.length).toEqual(2);
|
||||
expect(messages[0]).toEqual('');
|
||||
expect(messages[1]).toEqual('a describe block - 500 ms');
|
||||
});
|
||||
|
||||
it('adds a single spec with success to the messages', function() {
|
||||
var results = [],
|
||||
messages = [];
|
||||
|
||||
this.passSpy = spyOn(this.verboseReporter.color_, 'pass');
|
||||
|
||||
results.push(this.spec);
|
||||
|
||||
this.verboseReporter.buildMessagesFromResults_(messages, results);
|
||||
|
||||
expect(this.passSpy).toHaveBeenCalled();
|
||||
expect(messages.length).toEqual(1);
|
||||
expect(messages[0]).toEqual('a spec block - 200 ms');
|
||||
});
|
||||
|
||||
it('adds a single spec with failure to the messages', function() {
|
||||
var results = [],
|
||||
messages = [];
|
||||
|
||||
this.verboseReporter.specResults_['23'].result = 'failed';
|
||||
|
||||
this.passSpy = spyOn(this.verboseReporter.color_, 'pass');
|
||||
this.failSpy = spyOn(this.verboseReporter.color_, 'fail');
|
||||
|
||||
results.push(this.spec);
|
||||
|
||||
this.verboseReporter.buildMessagesFromResults_(messages, results);
|
||||
|
||||
expect(this.failSpy).toHaveBeenCalled();
|
||||
expect(this.passSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('adds a suite, a suite and a single spec with success to the messages', function() {
|
||||
var results = [],
|
||||
messages = [];
|
||||
|
||||
var subSuite = new Object();
|
||||
subSuite.id = '29';
|
||||
subSuite.type = 'suite';
|
||||
subSuite.name = 'a sub describe block';
|
||||
subSuite.suiteNestingLevel = 1;
|
||||
subSuite.children = [];
|
||||
subSuite.children.push(this.spec);
|
||||
|
||||
this.suite.children.push(subSuite);
|
||||
results.push(this.suite);
|
||||
|
||||
this.verboseReporter.suiteResults_['29'] = {
|
||||
runtime: 350
|
||||
};
|
||||
|
||||
this.verboseReporter.buildMessagesFromResults_(messages, results);
|
||||
|
||||
expect(messages.length).toEqual(5);
|
||||
expect(messages[0]).toEqual('');
|
||||
expect(messages[1]).toEqual('a describe block - 500 ms');
|
||||
expect(messages[2]).toEqual('');
|
||||
expect(messages[3]).toEqual(' a sub describe block - 350 ms');
|
||||
expect(messages[4]).toEqual(' a spec block - 200 ms');
|
||||
});
|
||||
});
|
||||
});
|
||||
15
6/node_modules/jasmine-node/spec/sample_helper.js
generated
vendored
Normal file
15
6/node_modules/jasmine-node/spec/sample_helper.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
(function(){
|
||||
|
||||
var objectToString = Object.prototype.toString;
|
||||
var PRIMITIVE_TYPES = [String, Number, RegExp, Boolean, Date];
|
||||
|
||||
jasmine.Matchers.prototype.toHaveProperty = function(prop) {
|
||||
try {
|
||||
return prop in this.actual;
|
||||
}
|
||||
catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
||||
37
6/node_modules/jasmine-node/specs.sh
generated
vendored
Normal file
37
6/node_modules/jasmine-node/specs.sh
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
entry="node lib/jasmine-node/cli.js --noStack "
|
||||
|
||||
echo "Running all tests located in the spec directory"
|
||||
command=$entry"spec"
|
||||
echo $command
|
||||
time $command #/nested/uber-nested
|
||||
echo -e "\033[1;35m--- Should have 59 tests and 104 assertions and 4 Failure. ---\033[0m"
|
||||
echo ""
|
||||
|
||||
echo "Running all tests located in the spec directory with coffee option"
|
||||
command=$entry"--coffee spec"
|
||||
echo $command
|
||||
time $command #/nested/uber-nested
|
||||
echo -e "\033[1;35m--- Should have 64 tests and 109 assertions and 6 Failures. ---\033[0m"
|
||||
echo ""
|
||||
|
||||
echo "Running all tests located in the spec directory with requirejs option"
|
||||
#command=$entry"--nohelpers --runWithRequireJs spec-requirejs"
|
||||
command=$entry"--runWithRequireJs spec"
|
||||
echo $command
|
||||
time $command
|
||||
echo -e "\033[1;35m--- Should have 59 tests and 104 assertions and 4 Failure. ---\033[0m"
|
||||
echo ""
|
||||
|
||||
echo "Running all tests located in the spec-requirejs directory with requirejs, requirejs setup, and coffee option"
|
||||
command=$entry"--runWithRequireJs --requireJsSetup spec-requirejs-coffee/requirejs-setup.js --coffee spec-requirejs-coffee"
|
||||
echo $command
|
||||
time $command
|
||||
echo -e "\033[1;35m--- Should have 2 tests and 4 assertions and 0 Failure. ---\033[0m"
|
||||
|
||||
echo "Running three specs file in the spec directory with coffee option"
|
||||
command=$entry"--coffee spec/AsyncSpec.coffee spec/CoffeeSpec.coffee spec/SampleSpecs.js"
|
||||
echo $command
|
||||
time $command
|
||||
echo -e "\033[1;35m--- Should have 3 tests and 3 assertions and 2 Failure. ---\033[0m"
|
||||
Reference in New Issue
Block a user