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

Logging #393

Merged
merged 19 commits into from
Jan 29, 2018
Merged

Logging #393

merged 19 commits into from
Jan 29, 2018

Conversation

GeeWee
Copy link
Collaborator

@GeeWee GeeWee commented Dec 15, 2017

I've done a few things here.

I've added logging as per #388 . Feel free to comment on the logging messages, didn't spend a lot of time considering those.

I've also done a little bit to our testing, the place was littered with toString() calls on strings, and I had some problems with string matching due to ANSI color codes getting in the way.
So I've cleaned up the toString stuff and I've removed the ANSI color codes when running in tests.

I've also tweaked some of the more rigorous tslint rules that prettier fixed anyways, and ran prettier on the whole project. Seems it's shifted things a little bit around, not quite sure why. Perhaps some commits got past the precommit hook somehow.

@GeeWee
Copy link
Collaborator Author

GeeWee commented Dec 15, 2017

We should probably also change the issue template now that I think about it..

@GeeWee
Copy link
Collaborator Author

GeeWee commented Dec 15, 2017

CI fails with a greenkeeper error. Not quite sure what's going on.

@@ -67,14 +67,6 @@ createIntegrationMock();

const argv = process.argv.slice(2);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

All of the lines below didn't really seem to.. do anything. So I removed them.

Copy link
Owner

@kulshekhar kulshekhar left a comment

Choose a reason for hiding this comment

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

It largely looks good to me. I've left a few comments.

Other than that, would it be possible to base this PR off the cleanup PR?

@@ -7,7 +7,7 @@
"scripts": {
"build": "cpx index.d.ts dist/ && tsc -p .",
"build:watch": "cpx index.d.ts dist/ && tsc -p . -w",
"clean": "rimraf dist/**/* && rimraf tests/simple/coverage && rimraf tests/simple-async/coverage",
"clean": "rimraf dist/**/* && rimraf tests/simple/coverage && rimraf tests/simple-async/coverage && rimraf tests/**/*/debug.txt",
"clean-build": "npm run clean && npm run build",
Copy link
Owner

Choose a reason for hiding this comment

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

it might be better to create a separate directory for debug logs than to have them scattered all over and then delete them like this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I considered just adding the debug.txt in the project root, but we'd still need to delete them for each subproject yeah?

Copy link
Owner

Choose a reason for hiding this comment

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

Sorry about this. I didn't notice that the delete was recursive under the tests directory. This should be fine. I was somehow under the impression that this will be done throughout the project.

I now have a different question. These logs will be produced when debugging sample repos, right? If so, will the logs still be placed under ts-jest in node_modules?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep. That's what I figured made most sense.

Copy link
Owner

Choose a reason for hiding this comment

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

I'm not entirely sure about this so lets just do it this way and then, if required, revisit it

src/logger.ts Outdated
config.globals &&
config.globals['ts-jest'] &&
config.globals['ts-jest'].debug
) {
Copy link
Owner

Choose a reason for hiding this comment

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

using an environment variable might be a better option (process.env.TS_JEST_DEBUG, for example)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agree

@@ -12,21 +13,29 @@ export function process(
config: JestConfig,
transformOptions: TransformOptions = { instrument: false },
) {
enableLoggingIfNeeded(config);
Copy link
Owner

Choose a reason for hiding this comment

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

this line moves the comment below which makes the comment lose some context

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nicely spotted. I'll move it.

@GeeWee
Copy link
Collaborator Author

GeeWee commented Dec 16, 2017

Do you know what's up with the greenkeeper bug?
I could base it off the cleanup PR - do you know when the next jest release is though? I'd like to not wait too long to get this in.

@kulshekhar
Copy link
Owner

Do you know what's up with the greenkeeper bug?

I'm not sure what's happening but maybe we should just comment that part out in the travis config for now

do you know when the next jest release is though

not a clue

I'd like to not wait too long to get this in.

alright. Would you have the time to merge this into that branch? It shouldn't be a problem but there could be some merge conflicts, I'm guessing

@kulshekhar
Copy link
Owner

@GeeWee jest 22 has been published and 'cleanup' has been merged :)

@kulshekhar
Copy link
Owner

@GeeWee is this still on the cards?

@GeeWee
Copy link
Collaborator Author

GeeWee commented Jan 26, 2018

Yeah looking at it today. Been on vacation!

Conflicts:
	src/preprocessor.ts
	src/utils.ts
@GeeWee
Copy link
Collaborator Author

GeeWee commented Jan 26, 2018

I think I'm good for a new review @kulshekhar

kulshekhar
kulshekhar previously approved these changes Jan 27, 2018
Copy link
Owner

@kulshekhar kulshekhar left a comment

Choose a reason for hiding this comment

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

lgtm 😄

@kulshekhar
Copy link
Owner

do we need a version bump in this or can that come later?

@GeeWee
Copy link
Collaborator Author

GeeWee commented Jan 28, 2018

Awesome. I think we might want to, because this updates the issue template, so we'll risk people trying the new instructions without them being available.
Do I update the package.json, do you do something or how does that work?

@kulshekhar
Copy link
Owner

yeah, just bump the version patch in package.json. I'll then approve, merge and publish the package to npm

@GeeWee
Copy link
Collaborator Author

GeeWee commented Jan 29, 2018

bumped the version number!

@kulshekhar kulshekhar merged commit 17c2862 into master Jan 29, 2018
@kulshekhar
Copy link
Owner

published on npm!

This will be quite useful @GeeWee 👍

@kulshekhar kulshekhar deleted the logging branch January 30, 2018 23:01
@GeeWee GeeWee mentioned this pull request Feb 4, 2018
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.

None yet

2 participants