question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

testing staged changes

See original GitHub issue

I’ve discovered BackstopJS recently and am trying to implement it in a project with a very high ratio of dynamic content (random feeds & co).

I would like to use BackstopJS in 2 steps:

  • When a developer changes a file, I could detect the modified files a-la lint-staged and run backstopjs against these files in a husky pre-push hook.
  • A travis CI instance connected to the github repo would run backstopJs against all pages of the application.

Can we handle the staged testing part without using the backstop.json file (which would be used on the ci) ? I’m currently thinking of adding documentation in each component file with metas for the scenarios, eg

/*
 * backstop-label: Contact page
 * backstop-url: /contact/
 * backstop-selectors: ["#contact"]
 */
import React, {Component} from "react";

export default class Contact extends Component {
  …
}

Then I’d be able to generate the label/url/referenceUrl/selectors objects for scenarios and rewrite the backstop.json file to test staged files.

I’m hoping that you have a better suggestion to handle this use-case to avoid the inline documentation overhead.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
AdrienLemairecommented, Nov 28, 2018

Got it, thanks. Closing since this looks resolved, and will reopen if I don’t manage to implement it correctly 😃

1reaction
garriscommented, Nov 28, 2018

Ah, good. actually, you probably don’t even need to use an active script. Just include the --filter=<scenarioForComponentName> argument when invoking backstop. Way easier.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Show the Changes which Have Been Staged in Git
The git diff HEAD command shows all the changes made between the working directory and HEAD , including changes in the staging area....
Read more >
git - How do I show the changes which have been staged?
This command compares your staged changes to your last commit. The command compares what is in your working directory with what is in...
Read more >
2.2 Git Basics - Recording Changes to the Repository
Staging Modified Files · Let's change a file that was already tracked. · The CONTRIBUTING.md file appears under a section named “Changes not...
Read more >
What are Unstaged and Staged changes in Git?
Unstaged changes are changes that are not tracked by the Git. For example, if you copy a file or modify the file. Git...
Read more >
Git Staging: When to stage? What to do if modification occurs ...
The process is the following: edit, run tests, stage, commit. If you stage before the testing, chances are the tests will fail and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found