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

Update reporters test to use Jest snapshots #14

Merged
merged 1 commit into from Jan 17, 2017

Conversation

PavloKovalov
Copy link
Contributor

@PavloKovalov PavloKovalov commented Jan 14, 2017

Summary:

  • Switched reporters test to Jest snapshots
  • Added snapshot update command yarn update-snapshots

@@ -42,7 +42,8 @@
"clean": "rimraf docs/ coverage/",
"lint": "eslint *.js test/*.js",
"docs": "jsdoc --configure .jsdocrc *.js",
"test": "jest --coverage && yarn run lint && yarn run spellcheck"
"test": "jest --coverage && yarn run lint && yarn run spellcheck",
"update-snapshots": "jest -u"
Copy link
Member

@ai ai Jan 14, 2017

Choose a reason for hiding this comment

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

I can run jest -u in console by my n function https://github.com/ai/environment/blob/master/zshrc#L52-L61

Could you remove it?

Copy link
Contributor Author

@PavloKovalov PavloKovalov Jan 17, 2017

Choose a reason for hiding this comment

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

removed

function normalizeNewlines (string) {
// use local copy of Jest newline normalization function
// until Jest doens't apply normalization on comprasion
return string.replace(/\r\n|\r/g, '\n')
Copy link
Member

@ai ai Jan 14, 2017

Choose a reason for hiding this comment

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

BTW, reporter uses \v\r on UNIX, do we need to cover it here?

Copy link
Contributor Author

@PavloKovalov PavloKovalov Jan 17, 2017

Choose a reason for hiding this comment

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

It covers only newlines normalized by Jest during writing snapshots.

Copy link
Member

@ai ai Jan 17, 2017

Choose a reason for hiding this comment

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

So what lines do we have in the end? :) \n or \v\n?

Copy link
Contributor Author

@PavloKovalov PavloKovalov Jan 17, 2017

Choose a reason for hiding this comment

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

hmm… didn't find \v\n in produced jest output, but i'm on macos.
need to dig on it.

Copy link
Member

@ai ai Jan 17, 2017

Choose a reason for hiding this comment

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

OK, let’s make print tool and we will see what symbols are in snapshots anyway

@ai
Copy link
Member

@ai ai commented Jan 14, 2017

I added few comments. But in this PR I dodn’t found a way to check reporter output in console.

In previous test system I could call ./test/snapshots/update and it print all snapshots. Without printing a snapshots I couldn’t check reporter output.

@PavloKovalov PavloKovalov force-pushed the feature/reporters-snapshots branch from 5959141 to 5382b67 Compare Jan 17, 2017
@PavloKovalov PavloKovalov force-pushed the feature/reporters-snapshots branch from 5382b67 to 72fe1dc Compare Jan 17, 2017
@PavloKovalov
Copy link
Contributor Author

@PavloKovalov PavloKovalov commented Jan 17, 2017

@ai can you clarify, what the exact purpose of separate tool for checking reporter output?
If output changes it will be shown as a diff on jest report with colors. All color charactes are saved in snapshot.
Also, it can be separate PR.

@ai
Copy link
Member

@ai ai commented Jan 17, 2017

@PavloKovalov right now I use current snapshots for 2 purposes:

  1. Regression tests.
  2. Debug tool to see current reporters output.

For example, I want to change how Logux report about error. I need to see somewhere this output, right?

Try to run test/snapshots/update. It will not only update the snapshots, but also print latest snapshots to terminal (so I can check output with my eyes).

So we need this behavior for new testings system too. How I will check how output is look like?

@ai ai merged commit 313f6e5 into logux:master Jan 17, 2017
1 check passed
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