Skip to content

Why doesn't Npm.require work in server test code ? #181

@welelay

Description

@welelay

I'm still trying to do a simple http.get in my test.

Here I try to make the server do the work:

    it("....", function() {
        return client
            .execute(function() {
                return computedEnpoint();
            }).then(function(url) {

                return server.execute(function() {
                    try {
                        console.log("Meteor is accessible:", Meteor.isServer);
                        // either of them fail
                        // var http = Npm.require("http");
                        // require("http");
                    } catch (e) {
                        console.error("E:", e);
                    }
                });

            });
     });

It fails to find Npm or require, but has Meteor and all my application's module :

Meteor is accessible: true
E: [ReferenceError: Npm is not defined]
E: [ReferenceError: require is not defined]

Is there a way to access base modules (not even npm packages) from server code ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions