nodejs / examples

A repository of runnable Node.js examples that go beyond "hello, world!"
MIT License
649 stars 343 forks source link

test: use Jest's `changedSince` over `onlyChanged` #4

Closed bnb closed 4 years ago

bnb commented 4 years ago

This changes our CI to leverage Jest's --changedSince flag over the --onlyChanged flag since in my local testing it seemed that there were cases in which it only diffed from the previous commit rather than from the base branch (in our case, master).

I could be wrong on this, doing more investigation now, but wanted to get this up as a potential solution.

bnb commented 4 years ago

@mcollina do you have alternative suggestions that remove the burden of all examples from contributors, focusing on only the example they're contributing to?

mcollina commented 4 years ago

how about using https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestpaths to have a difference workflow definition for each example?

SimenB commented 4 years ago

onlyChanged checks since last commit, yes. https://github.com/facebook/jest/blob/317c41372e9461564a9e511c72f547f1e2fd7d7a/packages/jest-changed-files/src/git.ts#L76-L81

(if files are staged, they're not considered to be changed - I haven't decided if that's a bug or a feature...)

changedSince=master seems more like what you're after to me (or changedSince=origin/master), based on "focusing on only the example they're contributing to"

ljharb commented 4 years ago

(imo it’s a bug, since altho git diff by itself won’t show them, git diff $commitish will)

SimenB commented 4 years ago

Agreed @ljharb, landed a change to that effect now

bnb commented 4 years ago

Closing in favor of the approach in #5. Definitely open to further approaches should they arise ❤️