Skip to content

snapshot testing and coverage metric #613

@eanokian

Description

@eanokian

hi, I have found that when we have multiple snapshot testing within one unit test, like here:

test_that("test 1", {
  # some code
  expect_snapshot_file()

  # some other code
  expect_snapshot_file()
})

the lines executed in the second snapshot testing appear as not covered. If I take that chunk out and put it as a separate unit test, then magically the overall coverage increases:

test_that("test 1", {
  # some code
  expect_snapshot_file()
})

test_that("test 2", {
  # some other code
  expect_snapshot_file()
})

Is this the expected behaviour? Did anyone else see a similar pattern?

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions