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

Show error info for --require param problem #176

Merged
merged 3 commits into from
Feb 23, 2019
Merged

Show error info for --require param problem #176

merged 3 commits into from
Feb 23, 2019

Conversation

smialy
Copy link
Contributor

@smialy smialy commented Dec 11, 2018

I spent some time to figure out why: gulp --require @babel/register ... not works. Was missing @babel/core :]

@phated
Copy link
Member

phated commented Dec 11, 2018

Can you update the tests and check why appveyor is failing?

@smialy
Copy link
Contributor Author

smialy commented Dec 12, 2018

I've seen and check in my local machine. All tests pass also on TravisCI. Only on Appveyor not and it's looks that something is broken there.

@sttk
Copy link
Contributor

sttk commented Dec 12, 2018

I met the same error recently. This cause seems that timestamps in log outputs were not erased because of ANSI color escape sequences.

I don't know yet why these escape sequence are outputted in testing. (Needed explicit --no-color flag?)

@phated
Copy link
Member

phated commented Dec 12, 2018

@sttk would this change I made in fancy-log cause this new failure? gulpjs/fancy-log@9a3a662

@smialy
Copy link
Contributor Author

smialy commented Dec 12, 2018

Nice color console require one extra condition: if(testing) { disableColors() } :]

@phated
Copy link
Member

phated commented Dec 12, 2018

Interesting. I'm going to have @sttk chime in as well because I'm guessing I broke something within fancy-log.

@smialy
Copy link
Contributor Author

smialy commented Dec 13, 2018

Some plan or idea how to fix it?

@sttk
Copy link
Contributor

sttk commented Dec 14, 2018

@phated The issue you fixed in above link might be similar to #163.
If so, this is not Windows' issue but terminal's (AppVeyor uses MinGW?) or color-support's issue.
But I have no good idea to solve this problem.

Sample code: (color-test.js)

#!/usr/bin/env node
var colorSupport = require('color-support');
console.log('Color support: ', colorSupport());

On MinGW:

$ node color-test.js
Color support:  { level: 1, hasBasic: true, has256: false, has16m: false }

$ node.exe color-test.js
Color support:  false

$ ./color-test.js
Color support:  false

On Command Prompt:

C:\>node.exe color-test.js
Color support:  { level: 1, hasBasic: true, has256: false, has16m: false }

C:\>node.exe color-test.js
Color support:  { level: 1, hasBasic: true, has256: false, has16m: false }

@sttk
Copy link
Contributor

sttk commented Dec 14, 2018

@smialy @phated I'll attach --no-color flag to gulp command automatically in gulp-test-tool.
At least, it will solve this problem about gulp-cli tests.

@sttk
Copy link
Contributor

sttk commented Dec 14, 2018

I've published gulp-test-tools v0.6.2.
Retry test on AppVeyor.

@smialy
Copy link
Contributor Author

smialy commented Dec 14, 2018

Who can do it or how?

@sttk
Copy link
Contributor

sttk commented Dec 14, 2018

Restart link is not displayed on my account.

@phated Can you restart appveyor test?

@smialy
Copy link
Contributor Author

smialy commented Dec 14, 2018

Merge ready?

@phated
Copy link
Member

phated commented Dec 16, 2018

@sttk how can we test that errors are being shown correctly? I didn't even realize this method had a 2nd argument.

@sttk
Copy link
Contributor

sttk commented Dec 18, 2018

@phated By this line, an error object is passed as 2nd argument.

@smialy Can you write a test for this modification in test/flag-require.js?

index.js Outdated
cli.on('requireFail', function(name) {
log.warn(ansi.yellow('Failed to load external module'), ansi.magenta(name));
cli.on('requireFail', function(name, error) {
var message = name + (error ? ' [' + error + ']' : '');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since error is an error object, this code outputs too many lines including stack trace. Isn't it enough error message? And I think it's better that the error message is outputted to next line.

Copy link
Contributor Author

@smialy smialy Dec 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fo me this message:

Failed to load external module @babel/register [Error: Cannot find module '@babel/core']

is more helpful than:

Failed to load external module @babel/register

I have no idea why @babel/register doesn't install as dependency @babel/core but ending was that I add console.log(...) in this place to find this problem :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smialy Sorry, I mistake console.log(new Error() + '') for console.log(new Error()).
The former does not output stack trace.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smialy Now I think this modification is good, but add/modify a test case to test/flag-require.js, please.

Add small unittest checking extra error message for --require option in
case that app has some problem to include it.
Copy link
Contributor

@sttk sttk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this modification is good and has no problem.

@sttk
Copy link
Contributor

sttk commented Dec 21, 2018

@phated Are you ok with this?

@phated
Copy link
Member

phated commented Dec 21, 2018

Should we do some better formatting on this? I'm thinking something like:

Failed to load external module @babel/register
    Encountered error: [Error: Missing @babel/core]

Thoughts?

@sttk
Copy link
Contributor

sttk commented Dec 25, 2018

@smialy What about the format @phated suggeted?
Could you modify like this?

@smialy
Copy link
Contributor Author

smialy commented Jan 14, 2019

In this way?

[09:16:57] Failed to load external module @babel/register
    Error: Cannot find module '@babel/core'
.../gulpfile.js:1
SyntaxError: Unexpected token export

@sttk
Copy link
Contributor

sttk commented Jan 14, 2019

I think it's enough only the first two lines and it's good except that.

@smialy
Copy link
Contributor Author

smialy commented Jan 16, 2019

Some problem with integration travis-ci and github?

Copy link
Contributor

@sttk sttk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've finished review and please change.

index.js Outdated Show resolved Hide resolved
index.js Outdated
cli.on('requireFail', function(name, error) {
log.warn(
ansi.yellow('Failed to load external module'),
ansi.yellow(name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, my explanation might be bad. Please modify only a module name to magenta as is.

@sttk
Copy link
Contributor

sttk commented Jan 29, 2019

@smialy Your code is no problem. I couldn't restart AppVeyor tests, but I merged your code in my repository, runned it on appveyor, and it passed.

@phated How is this change?

@phated
Copy link
Member

phated commented Jan 30, 2019

@sttk sorry that I haven't been around to review, I started a new job a couple weeks ago. Are you satisfied with the PR? I'll restart the appveyor build but I'm confused by what dependency won't install.

@sttk
Copy link
Contributor

sttk commented Jan 30, 2019

The cause of Appveyor's error is bump deps of normalize-package-data : is-builtin-module "^1.0.0"=>"^3.0.0". (That was made on Jan. 29).

These modules are used in yargs, and is-builtin-module v3.0.0 targets Node >=v6.0. Since this bumping of normalize-package-data is made as a patch (v2.4.0=>v2.4.1), this error cannot be avoided on the older versions of Node.

@sttk
Copy link
Contributor

sttk commented Feb 2, 2019

@phated Please restart Appveyor's test because normalize-package-data' was changed back to
use is-builtin-module^1.0.0. The test will succeed.

@smialy smialy closed this Feb 13, 2019
@phated
Copy link
Member

phated commented Feb 15, 2019

Why was this closed?

@phated phated reopened this Feb 15, 2019
@phated phated merged commit 7d9d1a0 into gulpjs:master Feb 23, 2019
@phated
Copy link
Member

phated commented Feb 23, 2019

@sttk should I publish this version or do you want to land some more stuff first?

@phated
Copy link
Member

phated commented Feb 23, 2019

@smialy thanks for all the hard work on this!!!

@sttk
Copy link
Contributor

sttk commented Feb 23, 2019

@phated I think it's better to publish liftoff with merging the pr js-liftoff#94 before gulp-cli because requireFail messages will increase by this pr.

@phated
Copy link
Member

phated commented Apr 6, 2019

I meant to follow up on this when 2.1.0 was published. It's been published for 11 days so this fix is available now. Thanks again!

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

Successfully merging this pull request may close these issues.

3 participants