Giter VIP home page Giter VIP logo

pavlov's People

Contributors

dmohl avatar edelabar avatar endash avatar mmonteleone avatar phlik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pavlov's Issues

asyncIt Feature Request

I really like your library, but the one thing that hangs me up is async testing. The timeout wait you have works, but it can dramatically increase the time for the whole test suite to run.

There is another library like yours called SpecIt that has a asyncIt() method you can use instead of the it() which is just a small wrapper around QUnit's native asyncTest() method.

https://github.com/joshuaclayton/specit/blob/master/specit.js#L28

I think this addition would be very handy. Have you already considered this or are you thinking along a different lines?

Node.js Package

Palov is super awesome for testing our jQuery plugin: http://ninjaui.com

Would you mind distributing via NPM? Should be straight forward, considering qunit is already available to use as a dependency through NPM.

We seek a Node.js package so we can automate our tests through a Jakefile and depend on the correct versions without having to maintain a copy in our own repo.

given, and apply....

    given([2,2,4], [5,2,7], [6,-4,2]).
        it("can generate row data tests", function(a, b, c) {
            assert(c).equals(a + b);
        });

All good so far! but when we have a list of lists.... this doesn't seem to work...

    given([[2,2,4], [5,2,7], [6,-4,2]]).
        it("can generate row data tests", function(a, b, c) {
            assert(c).equals(a + b);
        });

Nor this:

    (given.apply(null, [[2,2,4], [5,2,7], [6,-4,2]])).
        it("can generate row data tests", function(a, b, c) {
            assert(c).equals(a + b);
        });

Am I doing something wrong here?

Make it work with current QUnit (2.9.2)

Hi there :)

I know this project is somewhat outdated, but somehow I like the spirit of it.
Was wondering how much it'd take to bring it to QUnit 2.x, or even 3, when it comes out?

After all, pavlov is still mentioned on QUnit's plugins page - as the second entry! Yet it relies on QUnit 1.9...

Main things I see:

  • cannot use QUnit globals 'assert', 'ok' etc anymore
  • actually: there shouldn't be such a thing as exposed globals in pavlov either!
  • even (not) if only "by trickery": the extendScope hack, which creates the illusion of global describe, it, assert etc. has to go. That's pretty obvious to me, but I can explain why if you want me to (Metaprogramming as such is fine, but you can't do it like that, and not here).
  • there's an easy alternative to this: simply pass all of them as arguments to pavlov.specify. The user then - we have ES6 now - just has to say once: pavlov.specify("foo", ({describe, before, after, it, assert}) => { ... }). This would help minimize necessary changes to existing specs.

I'd give it a try in a fork, if anyone's interested..?

Can't use wait() more than once?

Perhaps I don't quite understand how wait() (or the underlying start()/stop() engine), but I can't seem to get wait() to work more than once in a particular it() block. Any tests inside the function body of subsequent wait() calls are ignored (though the code does run).

Result of expression 'thisApi.assert' [undefined] is not an object

Haven't quite tracked this all the way down, but I'm working on it, from what I can tell if you specify a feature without a test function before a given and without another feature without a test function after the given, it will produce an error something like this:

Died on test #1: Result of expression 'thisApi.assert' [undefined] is not an object. - { 
"message": "Result of expression 'thisApi.assert' [undefined] is not an object.", "line": 344, 
"sourceId": 5279531008, "sourceURL": "file:///Users/ericdelabar/Documents/Code/git-
repos/pavlov/pavlov.js", "expressionBeginOffset": 11237, "expressionCaretOffset": 11251, 
"expressionEndOffset": 11256, "name": "TypeError" }

Since that sounds very confusing, see line 19:

https://github.com/edelabar/pavlov/blob/8dea6ddb3cb5025ea6c440da53b1410480eb9e27/example/example.specs.js

If you move the code on line 19 to line 44 (after the final given) it works as expected. I'm going to try and tackle this one myself, so hopefully expect a pull request in a day or so...

I'm trying to tackle this one myself but I figured I'd post it in case anybody else is seeing the problem.

tests using Pavlov + Require.JS does not work

Hi Michael,

I have a modular javascript application that uses Require.JS and so far I've being writing tests as modules using QUnit without trouble. I'd like however to use Pavlovs instead and I assumed it would work similar to qunit tests but so far I had no success. The code below illustrates a qunit test written as a module:

define(['models/User2'], function(User) {
    test( "Create valid user", function(){
        var user = new User({username: 'eric', cellphone: '11-9999-8888', password: '123456', agreement: true});
        ok(user.isValid(), 'created a valid user instance.');
    });
});

In this code we load the module "models/User2" into the function param User, which makes the User model available during the tests. If I write a similar code with Pavlov the User variable becomes undefined.

define(['models/User2'], function(User) {

    pavlov.specify("User Model spec", function(){       
        describe("User", function() {
            var user;       
            given({username: 'eric', cellphone: '11-9999-8888', password: '123456', agreement: true}).
            it('should create a valid user instance', function(data){
                user = new User(data);
                assert(user.isValid()).equals(true);
            });         
        }); 
    }); 
});

Is there a way to write Pavlovs as AMD modules?

Thanks in advance,

Eric

JSTestDriver example using RequireJS

First of all, thanks for the awesome library and great JSTestDriver example!

I'm struggling to get my tests working because my project uses RequireJS for dependency management. My pavlov tests, themselves, also are RequireJS AMD modules, which in turn have dependencies on the modules under test.

I have one common main.js file which is shared between my normal index.html file that loads the UI, and my test.html file which invokes the QUnit/Pavlov test runner.

My issue is that using the included JSTestDriver example, my RequireJS tests are not getting picked up.

Any help would be greatly appreciated!

Add support to check against error messages instead of objects

I'm able to confirm that an exception is thrown with the throwsException extension. When I provide the string value of the expected error message, it fails to work. The code appears to be comparing objects with each other rather than the string value of the e.message.

I propose to support both the string value of messages and the expected error objects to be thrown.

cli for pavlov?

I know the 'cli for qunit' issue is quite muddled already, but a 'blessed' solution would be nice, especially incorporating pavlov.

Given async doesn't propagate arguments

Good morning!

...and thanks for this wonderful API - it is incredible intuitive. I'm using it to automate the browser interface tests by attaching an invisible iframe to the document body. Certainly better than iMacros, and I dare say Selenium as well as it is fully cross platform and plugin independent. But that's irrelevant, more to the issue

given([[1],[2]]).it("async test", async(function(a) {
    assert(a===1 || a===2).isTrue(); // will fail
    resume();
}));

Now if I'm not wrong, and please let me know if I am, this one-line fix should take care of this bugger, it seems to work too:

async: function(fn) {
    var implementation = function(){
        adapter.pause();
        fn.apply(this, arguments); // changed from fn();
    };
    implementation.async = true;
    return implementation;
},

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.