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

Blinking test #245

Closed
okonet opened this issue Aug 31, 2017 · 2 comments · Fixed by #255
Closed

Blinking test #245

okonet opened this issue Aug 31, 2017 · 2 comments · Fixed by #255

Comments

@okonet
Copy link
Collaborator

okonet commented Aug 31, 2017

During my work on #141 I've encountered the "blinking" test:

FAIL  test\runScript-mock-findBin.spec.js
  ● runScript with absolute paths › can pass `gitDir` as `cwd` to `execa()` when git is called via absolute path
    TypeError: Cannot read property 'bin' of undefined
      
      at Object.task (src/runScript.js:30:106)
      at _callee$ (test/runScript-mock-findBin.spec.js:50:34)
      at tryCatch (node_modules/regenerator-runtime/runtime.js:65:40)
      at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:299:22)
      at Generator.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:117:21)
      at step (test/runScript-mock-findBin.spec.js:23:641)
      at test/runScript-mock-findBin.spec.js:23:871
          at Promise (<anonymous>)
      at Object.<anonymous> (test/runScript-mock-findBin.spec.js:23:552)

It would be great to make it run deterministic or we should disable it.

@luftywiranda13
Copy link
Collaborator

I'm digging now, currently have no idea about how we should deal with this 😆

@sudo-suhas
Copy link
Collaborator

This has something to do with the order in which the tests are run:

$ jest --coverage
 PASS  test\runAll.spec.js
 FAIL  test\runScript-mock-findBin.spec.js
  ● runScript with absolute paths › can pass `gitDir` as `cwd` to `execa()` when git is called via absolute path

    TypeError: Cannot read property 'bin' of undefined
      at Object.task (src/runScript.js:26:105)
      at _callee$ (test/runScript-mock-findBin.spec.js:40:34)
      at tryCatch (node_modules/regenerator-runtime/runtime.js:65:40)
      at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:299:22)
      at Generator.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:117:21)
      at step (test/runScript-mock-findBin.spec.js:21:470)
      at test/runScript-mock-findBin.spec.js:21:700
          at Promise (<anonymous>)
      at Object.<anonymous> (test/runScript-mock-findBin.spec.js:21:381)

$ jest --coverage
 PASS  test\runScript-mock-findBin.spec.js
 PASS  test\runAll.spec.js

$ jest --coverage
 PASS  test\runAll.spec.js
 FAIL  test\runScript-mock-findBin.spec.js
  ● runScript with absolute paths › can pass `gitDir` as `cwd` to `execa()` when git is called via absolute path
...

If runScript-mock-findBin.spec.js runs after test\runAll.spec.js, the test fails.

sudo-suhas added a commit to sudo-suhas/lint-staged that referenced this issue Sep 5, 2017
sudo-suhas added a commit to sudo-suhas/lint-staged that referenced this issue Sep 6, 2017
okonet pushed a commit that referenced this issue Sep 6, 2017
* test: Fix failing tests on windows(path compare)
* fix(runAll): Return from function on reject
* ci(appveyor): Disable shallow clone, enable cache
* fix: refactor jest mocks to fix blinking test

Closes #245
Closes #257
Closes #264
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants