Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wallaby doesn't work with require.main.require #147

Closed
ludydoo opened this issue Jun 7, 2015 · 6 comments
Closed

Wallaby doesn't work with require.main.require #147

ludydoo opened this issue Jun 7, 2015 · 6 comments
Labels

Comments

@ludydoo
Copy link

ludydoo commented Jun 7, 2015

Hi,

Requiring a module with require.main.require("/module/path") does not work

@ArtemGovorov
Copy link
Member

Hello,

Does require.main.require("/module/path") work for you when you're not using wallaby.js and running mocha directly?

@ludydoo
Copy link
Author

ludydoo commented Jun 8, 2015

Hi. It works in mocha without wallaby when there is no leading ‘/' like require.main.require('module/path’);

Le 2015-06-07 à 20:21, Artem Govorov notifications@github.com a écrit :

Hello,

Does require.main.require("/module/path") work for you when you're not using wallaby.js and running mocha directly?


Reply to this email directly or view it on GitHub #147 (comment).

@ArtemGovorov
Copy link
Member

Could you please share your wallaby.js config and module/path that doesn't work in wallaby but works in mocha?

@ludydoo
Copy link
Author

ludydoo commented Jun 8, 2015

Sure.

{
  "files": [
    "**/*.js",
    { "pattern": "node_modules/**/*", "ignore": true },
    { "pattern": "public/**/*", "ignore": true },
    { "pattern": "tests/**/*", "ignore": true },
    { "pattern": "views/**/*", "ignore": true }
  ],

  "tests": [
    "tests/**/*.js"
  ],

  "env" : {
    "type" : "node"
  }
}

Wallaby output

Error: Cannot find module 'easymage/application/services/person.js'
    at tests/easymage/application/services/person.js:1

Error: Cannot find module 'easymage/domain/aggregate/person'
    at tests/easymage/ddd/repository/event-sourced.js:3

Error: Cannot find module 'easymage/domain/aggregate/person.js'
    at tests/easymage/domain/aggregate/person.js:2

Error: Cannot find module 'easymage/domain/aggregate/person.js'
    at tests/easymage/domain/repository/person.js:3

Error: Cannot find module 'easymage/infrastructure/event-store/redis.js'
    at tests/easymage/infrastructure/event-store/redis.js:2

All mocha test do pass.

Requires in person module
var EventFactory = require.main.require("easymage/ddd/factory/event.js"),
    Aggregate    = require.main.require("easymage/ddd/aggregate/core.js"),
    Locator = require.main.require("easymage/domain/model/locator.js"),
    Address = require.main.require("easymage/domain/value-objects/address.js");

@ludydoo
Copy link
Author

ludydoo commented Jun 8, 2015

This is my directory structure for now

easymage
├── application
│   ├── commands
│   │   ├── addAddress.js
│   │   ├── changeAddress.js
│   │   ├── createOrganisation.js
│   │   ├── createPerson.js
│   │   ├── deleteOrganisation.js
│   │   ├── deletePerson.js
│   │   ├── removeAddress.js
│   │   ├── renameOrganisation.js
│   │   └── renamePerson.js
│   ├── events
│   ├── models
│   │   └── errors.js
│   ├── routes
│   └── services
│       ├── event-store.js
│       ├── logger.js
│       └── person.js
├── ddd
│   ├── aggregate
│   │   └── core.js
│   ├── event
│   │   └── base.js
│   ├── factory
│   │   └── event.js
│   └── repository
│       ├── core.js
│       └── event-sourced.js
├── domain
│   ├── aggregate
│   │   ├── index.js
│   │   ├── organisation.js
│   │   └── person.js
│   ├── event
│   │   ├── index.js
│   │   ├── organisation
│   │   │   ├── created.js
│   │   │   └── renamed.js
│   │   └── person
│   │       ├── activated.js
│   │       ├── address-locator-added.js
│   │       ├── address-locator-address-changed.js
│   │       ├── address-locator-deactivated.js
│   │       ├── address-locator-function-changed.js
│   │       ├── created.js
│   │       ├── deactivated.js
│   │       └── renamed.js
│   ├── factory
│   │   └── addressFactory.js
│   ├── model
│   │   ├── address-locator.js
│   │   ├── errors.js
│   │   └── locator.js
│   ├── repository
│   │   └── person.js
│   └── value-objects
│       ├── address.js
│       ├── currency.js
│       ├── email.js
│       ├── employee_budget.js
│       ├── fax.js
│       ├── mandate_budget.js
│       ├── telephone.js
│       └── website.js
└── infrastructure
    ├── db
    │   └── client
    │       └── redis.js
    └── event-store
        └── redis.js

@ArtemGovorov
Copy link
Member

Ok, thanks, I reproduced it. The issue is fixed in wallaby.js core version 1.0.61 (will update itself automatically).
Please let me know if it works for you now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants