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

Mocha 5: Sails is failing to lift inside Mocha tests due captains-log issue #4395

Open
leosuncin opened this issue May 8, 2018 · 5 comments · May be fixed by balderdashy/captains-log#22
Open

Comments

@leosuncin
Copy link

Sails version: 1.0.1
Node version: 10.0.0
NPM version: 6.0.0
DB adapter name: N/A
DB adapter version: N/A
Operating system: Linux 4.14.36-1-MANJARO x86_64


I'm using mocha for run my E2E against my API (WIP) build it with sails and I followed the steps on the documentation, but I'm getting a error when try to lift sails via mocha (if I run sails lift outside mocha works).

Stack trace
/home/leosuncin/Workspaces/github/writtr-api/node_modules/captains-log/lib/configure.js:196
        else if (colorName.match(/^dim/)) {
                           ^

TypeError: Cannot read property 'match' of undefined
at _getColorizedPrefix (/home/leosuncin/Workspaces/github/writtr-api/node_modules/captains-log/lib/configure.js:196:28)
at /home/leosuncin/Workspaces/github/writtr-api/node_modules/captains-log/lib/configure.js:208:9
at Array.forEach ()
at module.exports (/home/leosuncin/Workspaces/github/writtr-api/node_modules/captains-log/lib/configure.js:134:21)
at CaptainsLog (/home/leosuncin/Workspaces/github/writtr-api/node_modules/captains-log/index.js:39:17)
at Object. (/home/leosuncin/Workspaces/github/writtr-api/node_modules/sails/errors/fatal.js:11:11)
at Module._compile (internal/modules/cjs/loader.js:678:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3)
at Module.require (internal/modules/cjs/loader.js:626:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (/home/leosuncin/Workspaces/github/writtr-api/node_modules/sails/errors/index.js:3:10)
at Module._compile (internal/modules/cjs/loader.js:678:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3)
at Module.require (internal/modules/cjs/loader.js:626:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (/home/leosuncin/Workspaces/github/writtr-api/node_modules/sails/lib/app/private/isLocalSailsValid.js:9:11)
at Module._compile (internal/modules/cjs/loader.js:678:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3)
at Module.require (internal/modules/cjs/loader.js:626:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (/home/leosuncin/Workspaces/github/writtr-api/node_modules/sails/lib/app/Sails.js:162:37)
at Module._compile (internal/modules/cjs/loader.js:678:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3)
at Module.require (internal/modules/cjs/loader.js:626:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (/home/leosuncin/Workspaces/github/writtr-api/node_modules/sails/lib/app/index.js:6:13)
at Module._compile (internal/modules/cjs/loader.js:678:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3)
at Module.require (internal/modules/cjs/loader.js:626:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (/home/leosuncin/Workspaces/github/writtr-api/node_modules/sails/lib/index.js:5:13)
at Module._compile (internal/modules/cjs/loader.js:678:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3)
at Module.require (internal/modules/cjs/loader.js:626:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (/home/leosuncin/Workspaces/github/writtr-api/test/bootstrap.js:2:17)
at Module._compile (internal/modules/cjs/loader.js:678:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3)
at Module.require (internal/modules/cjs/loader.js:626:17)
at require (internal/modules/cjs/helpers.js:20:18)
at /home/leosuncin/Workspaces/github/writtr-api/node_modules/mocha/lib/mocha.js:253:27
at Array.forEach ()
at Mocha.loadFiles (/home/leosuncin/Workspaces/github/writtr-api/node_modules/mocha/lib/mocha.js:250:14)
at Mocha.run (/home/leosuncin/Workspaces/github/writtr-api/node_modules/mocha/lib/mocha.js:577:10)
at Object. (/home/leosuncin/Workspaces/github/writtr-api/node_modules/mocha/bin/_mocha:591:18)
at Module._compile (internal/modules/cjs/loader.js:678:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:719:10)
at startup (internal/bootstrap/node.js:228:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:575:3)

Is an issue related to captains-log and can be fixed with:

node_modules/captains-log/lib/configure.js
156c156
<       var colorName = colorMappings[logAt];
---
>       var colorName = colorMappings[logAt] || DEFAULT.OVERRIDES.colors[logAt];

You can see my repo with the issue here https://github.com/leosuncin/writtr-api-sails/tree/testing

@sailsbot
Copy link

sailsbot commented May 8, 2018

@leosuncin Thanks for posting, we'll take a look as soon as possible.


For help with questions about Sails, click here. If you’re interested in hiring @sailsbot and her minions in Austin, click here.

@mikermcneil
Copy link
Member

@leosuncin thanks! And, interesting- we use mocha 3.0.2 across the board over here and so hadn't noticed this. When time allows, I'll try to recreate this with mocha 5

@mikermcneil mikermcneil changed the title Sails is failing to lift inside Mocha tests due captains-log issue Sails is failing to lift inside Mocha tests due captains-log issue (Mocha 5) May 30, 2018
@mikermcneil mikermcneil changed the title Sails is failing to lift inside Mocha tests due captains-log issue (Mocha 5) Mocha 5: Sails is failing to lift inside Mocha tests due captains-log issue May 30, 2018
@leosuncin
Copy link
Author

@mikermcneil please review this, I can't use CI/CD due the tests won't run successfully even if are right.

mikermcneil added a commit to balderdashy/captains-log that referenced this issue Jun 25, 2018
@mikermcneil
Copy link
Member

@mikermcneil
Copy link
Member

published as [email protected]

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

Successfully merging a pull request may close this issue.

4 participants