ibolmo / jasmine-jstd-adapter Goto Github PK
View Code? Open in Web Editor NEW(unsupported) Jasmine JsTestDriver Adapter. Write Jasmine BDD code, and run it on JsTD.
(unsupported) Jasmine JsTestDriver Adapter. Write Jasmine BDD code, and run it on JsTD.
Jasmine have ability to add custom equality testers. However when these testers added in global scope (e.g not during actual test run) using following syntax:
jasmine.getEnv().addEqualityTester(MyEqualityTester);
they will be cleaned by jasmine adapter. Reason is that adapter recreate environment before all test are executed in the JSTD register function:
jstestdriver.pluginRegistrar.register({
name: 'jasmine',
runTestConfiguration: function(config, onTestDone, onComplete){
if (config.getTestCaseInfo().getType() != JASMINE_TYPE) return false;
(jasmine.currentEnv_ = new Env(onTestDone, onComplete)).execute();
return true;
},
onTestsFinish: function(){
jasmine.currentEnv_ = null;
collectMode = true;
}
});
line:
(jasmine.currentEnv_ = new Env(onTestDone, onComplete)).execute();
In order to fix this adapter should extend already instantiated environment instead of creating new.
After any spec, test spies should be removed.
This does not work with JSTD adapter.
I will analyze this problem and solve.
Hello,
I already filed that problem http://code.google.com/p/js-test-driver/issues/detail?id=428&can=1&sort=-id but the rejected it and told me to report it to you... so is it a problem of the adapter?
Prerequisites
curl.js + jasmine
create a js-Module without giving it a name:
---- src/Crap.js ------------
define(function() {
return function() {
return "Hello World";
}
create a test for testing that module (I use jasmine as testing-framework):
---- test/Crap.test.js ------
curl(["Crap"], function(Crap) {
describe("Crap-Test", function() {
it("shouasdld write Hello World", function() {
expect(Crap()).toBe("Hallo Welt");
});
})
create a suitable jsTestDriver.conf and provide the needed files as shown
load:
run the test
What is the expected output? What do you see instead?
One test should fail but instead
jsTestDriver can't find the 'Crap' Module, throwing:
No tests found. Please check 'test:' section of the configuration file.
Empty test suite.
What version of the product are you using? On what operating system?
- JsTestDriver-1.3.5-patched.jar provided by Webstorm 6.0.1
- Windows 7 HomePremium 64bit
Please provide any additional information below.
As soon as you give the module a name the test works:
---- src/Crap.js ------------
define("Crap", function() {
return function() {
return "Hello World";
}
});
-----------------------------
This is an odd issue to explain, but I'll try to do it as best I can.
Whenever I change my tests, JsTestDriver seems to "cache" the old tests, and combine the old results with the new results. As an example, one of my spec files has 7 tests in it. This works fine the first time I run JsTestDriver, and also works fine on a second run without changing anything. However, if I change my spec file (even insignificantly - ie. adding whitespace) and run the tests again, JsTestDriver now says I have 14 tests!
If I change a test to fail intentionally and then change it back so it passes, the fail remains and appears on every single test run, until I restart the JsTestDriver server.
I'm using Jasmine 1.1.0, JsTestDriver 1.1.3d, Prototype 1.7, and the Jasmine Prototype adapter.
It appears that the variable 'frame' in the function 'frame(parent, name)' was inlined. The problem with that is that the variable 'frame' is used inside a function in its definition, leading to this error. Introducing the variable 'frame' and returning it fixes the issue.
Hi!, I would like to continue in a fork the support for jasmine.
What should I Know to continue the support?
here is the bug
describe('bug', function(){
var state = 'initial';
it('should have state initial', function(){
expect(state).toEqual('initial');
state = 'asserted';
});
it('should have state reset to initial', function(){
expect(state).toEqual('initial'); // this FAILS
state = 'asserted';
});
});
Hi!
I need windows support, I cannot run tests from phpstorm on windows with this adapter :S
Hi,
I appreciate your efforts to write this adapter, while this is brilliant for jasmine's older version e.g. 1.x it fails for latest version of jasmine.
I checked, that you moved to karma, still asking for help in this case. If possible, please update this for latest versions.
describe('bug', function(){
it('should spy on function', function(){
var fn = jasmine.createSpy();
this.spyOn(fn).andReturn(123); // <- this fails as this.spyOn is undefined
});
});
Methods waits(), waitsFor() does not work with jstd adapter...
http://pivotal.github.com/jasmine/async.html
The adapter is able to run all tests included in the JSTestDriver configuration file (--tests all).
But it isn't possible to run single test or test case (--tests TestCaseName). JasmineAdapter runs all tests instead.
On two separate machines running the Jasmine Adapter with Chrome 19.0.1084.46 file loading is now failing because "/test/" is prepended to the file names. The adapter worked fine on both machines with the previous version of Chrome.
error loading file: /test//[file_name_here]
Hello:
I updated the jasmine lib to 2.0.0 version and have found adapter doesn't support it. Will it support the newest version?
Best Regards,
Youth
We at VersionEye are working hard to keep up the quality of the bower's registry.
We just finished our initial analysis of the quality of the Bower.io registry:
7530 - registered packages, 224 of them doesnt exists anymore;
We analysed 7306 existing packages and 1070 of them don't have bower.json on the master branch ( that's where a Bower client pulls a data ).
Sadly, your library ibolmo/jasmine-jstd-adapter
is one of them.
Can you spare 15 minutes to help us to make Bower better?
Just add a new file bower.json
and change attributes.
{
"name": "ibolmo/jasmine-jstd-adapter",
"version": "1.0.0",
"main": "path/to/main.css",
"description": "please add it",
"license": "Eclipse",
"ignore": [
".jshintrc",
"**/*.txt"
],
"dependencies": {
"<dependency_name>": "<semantic_version>",
"<dependency_name>": "<Local_folder>",
"<dependency_name>": "<package>"
},
"devDependencies": {
"<test-framework-name>": "<version>"
}
}
Read more about bower.json on the official spefication and nodejs semver library has great examples of proper versioning.
NB! Please validate your bower.json with jsonlint before commiting your updates.
Thank you!
Timo,
twitter: @versioneye
email: [email protected]
VersionEye - no more legacy software!
I'm running jsTestDriver with Jasmine and this adapter. Every time I update any of the JS files in the config file, specs appear to be duplicated and appended to the existing test suite.
e.g. this first run:
......
Total 6 tests (Passed: 6; Fails: 0; Errors: 0) (3.00 ms)
Firefox 4.0 Windows: Run 6 tests (Passed: 6; Fails: 0; Errors 0) (3.00 ms)
can easily turn into this, by simply adding spaces and saving any JS file...
..............................................
Total 46 tests (Passed: 46; Fails: 0; Errors: 0) (3.00 ms)
Firefox 4.0 Windows: Run 46 tests (Passed: 46; Fails: 0; Errors 0) (3.00 ms)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.