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

Projects
None yet
2 participants
@PavloKovalov
Copy link
Contributor

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"

This comment has been minimized.

Copy link
@ai

ai Jan 14, 2017

Member

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?

This comment has been minimized.

Copy link
@PavloKovalov

PavloKovalov Jan 17, 2017

Author Contributor

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')

This comment has been minimized.

Copy link
@ai

ai Jan 14, 2017

Member

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

This comment has been minimized.

Copy link
@PavloKovalov

PavloKovalov Jan 17, 2017

Author Contributor

It covers only newlines normalized by Jest during writing snapshots.

This comment has been minimized.

Copy link
@ai

ai Jan 17, 2017

Member

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

This comment has been minimized.

Copy link
@PavloKovalov

PavloKovalov Jan 17, 2017

Author Contributor

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

This comment has been minimized.

Copy link
@ai

ai Jan 17, 2017

Member

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

@ai

This comment has been minimized.

Copy link
Member

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 PavloKovalov:feature/reporters-snapshots branch from 5959141 to 5382b67 Jan 17, 2017

@PavloKovalov PavloKovalov force-pushed the PavloKovalov:feature/reporters-snapshots branch from 5382b67 to 72fe1dc Jan 17, 2017

@PavloKovalov

This comment has been minimized.

Copy link
Contributor Author

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

This comment has been minimized.

Copy link
Member

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

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.