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

Snapshot got 'Formatter buffer never received a formatted value' in v0.20 #1433

Closed
zaaack opened this issue Jun 30, 2017 · 3 comments
Closed
Labels
bug current functionality does not work as desired

Comments

@zaaack
Copy link

zaaack commented Jun 30, 2017

It would fail in second time(compare). First time it success and output a snap file and a md file.

But this is totally OK in v0.18

  1 passed
  1 failed

  Root render
  /Users/z/Projects/Douban/share/helpcenter/helpcenter/static-source/feedback-popup/node_modules/concordance/lib/formatUtils.js:113

  Rejected promise returned by test. Reason:

  Error {
    message: 'Formatter buffer never received a formatted value.',
  }

  SingleValueFormatter.finalize (node_modules/concordance/lib/formatUtils.js:113:31)
  Object.diffDescriptors (node_modules/concordance/lib/diff.js:379:27)
  _callee$ (test/root.test.js:41:11)
  tryCatch (node_modules/regenerator-runtime/runtime.js:65:40)
  Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:303:22)
  Generator.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:117:21)
  Test.fn (test/root.test.js:39:1)

root.test.js.md

# Snapshot report for `test/root.test.js`

The actual snapshot is saved in `root.test.js.snap`.

Generated by [AVA](https://ava.li).

## Root render

> Snapshot 1

    <div
      className="feedback-ulwj3d7qthha"
      onClick={Function bound hideDialogOnOverlay {}}
    >
      <div
        className="dialog-container"
      >
        <form
          className="dialog"
          onSubmit={Function bound submit {}}
        >
          <div
            className="close"
            onClick={Function bound hideDialog {}}
          >
            ×
          </div>
          <div
            className="title"
          >
            请填写反馈内容
          </div>
          <div
            className="editor"
          >
            <textarea
              maxLength={1000}
              name="feedback"
              onChange={Function bound handleChange {}}
              placeholder="请填写"
              value=""
            />
        
          </div>
          <div
            className="title"
          >
            上传图片
          </div>
          <div
            className="captures"
          >
            <span
              className="rc-upload pic add"
              onClick={Function {}}
              onDragOver={Function {}}
              onDrop={Function {}}
              onKeyDown={Function {}}
              role="button"
              style={undefined}
              tabIndex="0"
            >
              <input
                accept="image/*,.txt,.doc,.docx"
                multiple={true}
                onChange={Function {}}
                style={
                  {
                    display: 'none',
                  }
                }
                type="file"
              />
              <div
                className="h-line"
              />
              <div
                className="v-line"
              />
            </span>
          </div>
          <div
            className="tips"
          >
            可以上传不超过3个文件,每个限制最大为1MB,类型限制为 jpg / jpeg / gif / png / txt / docx / doc
          </div>
          <div
            className="btn-submit"
            onClick={Function bound submit {}}
          >
            好了,发送反馈
          </div>
        </form>
      </div>
    </div>

root.test.js.snap
root.test.js.snap.zip

@sindresorhus sindresorhus changed the title snapshot got 'Formatter buffer never received a formatted value' in v0.20 Snapshot got 'Formatter buffer never received a formatted value' in v0.20 Jun 30, 2017
@sindresorhus sindresorhus added the bug current functionality does not work as desired label Jun 30, 2017
@novemberborn
Copy link
Member

@zaaack would you able to share the test itself? Or perhaps find a reproducible test case?

Snapshot assertions shouldn't fail without changes, so that's definitely odd. However the crash occurs when rendering the diff, so we don't know what the change was!

I know what's going wrong, but I can't think of a situation where that would occur. So if you could share failing code that would be much appreciated.

@zaaack
Copy link
Author

zaaack commented Jul 3, 2017

@novemberborn I think I find out why, it's caused by an undefined property changed to not undefined, or the opposite.

Here is a minimal reproduce project: https://github.com/zaaack/ava-issue-1433/blob/master/src/Feedback.js#L38

novemberborn added a commit to concordancejs/concordance that referenced this issue Jul 12, 2017
Fix for avajs/ava#1433. The react plugin
increases value indentation for properties. Combined with `maxDepth`
this can lead to property values exceeding the max depth. The
`maxDepth()` function is required on `SingleValueFormatter` so the
property name is still included in the formatted output.
@novemberborn
Copy link
Member

@zaaack thanks for the reproduction. I've got a fix in concordancejs/concordance#35. If you could install that version next to AVA it should get picked up. I'll try and get a release out soon.

novemberborn added a commit to concordancejs/concordance that referenced this issue Jul 13, 2017
Fix for avajs/ava#1433. The react plugin
increases value indentation for properties. Combined with `maxDepth`
this can lead to property values exceeding the max depth. The
`maxDepth()` function is required on `SingleValueFormatter` so the
property name is still included in the formatted output.
novemberborn added a commit that referenced this issue Jul 13, 2017
novemberborn added a commit that referenced this issue Jul 13, 2017
kevva pushed a commit that referenced this issue Sep 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug current functionality does not work as desired
Projects
None yet
Development

No branches or pull requests

3 participants