Hey @Johan,

I know this is totally late, but just in case you or someone else runs into 
this again I wanted to post an answer. 

I did something very similar to this recently for using Protractor to test 
a partially Angular application. What I did that worked was add a variable 
name to the 'require()' statement at the very top of my test file. So my 
test file looks like this:

var moment = require('moment');

describe('Screen A - Mobile', function() {

        ......
        it('Example Jasmine IT block test', function() { 

                var m = moment();
                console.log('moment date = ' + moment().format('dddd'));   
 // print day of week
        });

});


I think the only part you were missing was assigning a handle ("moment" in 
my example) to the require of the moment library.

Hope that helps!


On Friday, June 13, 2014 at 1:18:24 AM UTC-7, Johan Dindaine wrote:
>
> I'm trying to run an end-to-end test that is using momentJs for date 
> manipulation.
> And I have added it as a dependency in my package.json file and installed 
> it so it available.
> Then at the very top of my end-to-end test file I include it as a module 
> with the require directive (require('moment')).
> But when I run this test I get an exception: ReferenceError: moment is not 
> defined
>
> It should be loaded at that point, shouldn't it?
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to