Just to clarify a few things:

Is an npm module equivalent to an angular module?
>

Technically, what gets published to npm are packages, so that is probably a 
helpful vocabulary distinction we can use. In this case, each npm package 
corresponds to 1 or more angular modules.

`require('angular-animate').directive("myDirective", ...);` should register 
> a new directive in the ngAnimate module. 


That code would not work as the module itself is not returned. 
`require('angular-animate')` will return the module name as a string: 
"ngAnimate". That would be the case for everything but angular itself.
 

> But, in this scenario, `require('angular')` doesn't give you what you'd 
> expect, which would be the `angular` global object.
>

It would.  `require('angular')` would return the global angular object.

One way to go would be `require('angular-mocks/e2e')` or 
> `require('angular-mocks/animate')` for the e2e and animation mock modules, 
> and `require('angular-mocks')` for the main unit test mocks.


I think the slash syntax could work, but I think I would expect the paths 
to match the module names of ngMock, ngMockE2E and ngAnimateMock since that 
would more closely match the other (non-core) modules. 

Or alternatively, exporting an object containing properties which are the 
> modules to be mocked.


That is effectively what the current approach is, except we are exposing 
the names, not the modules themselves.


-- 
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 http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to