flood icon indicating copy to clipboard operation
flood copied to clipboard

Tests run against globally installed `flood` and not current version

Open FinalDoom opened this issue 1 year ago • 6 comments
trafficstars

Type: Bug Report

  • [X] Try to follow the update procedure described in the README and try again before opening this issue.

Your Environment

Current master e20a2f0111abaf81eb405a90bccd6a659be2c950 but really any version to date.

Summary

Tests are run through root/server/.jest/*.setup.js using node flood ... command. This fails if flood isn't globally installed.

And since you're trying to validate the current development version, this is wrong anyway. It should be using node dist/index.js ... and have a prerequisite to have built the project (assumed to be the case in current workflows)

Expected Behavior

Run tests against current development version.

Current Behavior

Tests are run against globally installed (very old) version, or "bleeding edge" master version if bodged in, but not current branch/code.

Possible Solution

See summary

Steps to Reproduce

Run npm test and observe behavior, check jest config files, etc.

Context

Correct testing

FinalDoom avatar Jan 02 '24 19:01 FinalDoom

I don't think so, we didn't install flood globally in ci

https://github.com/jesec/flood/blob/e36bca468fa71493c9d4cec678eaa060fa1fa017/.github/workflows/test-backend.yml#L47

trim21 avatar Apr 25 '24 20:04 trim21

That's not what this ticket is about. This references NPM test https://github.com/jesec/flood/blob/master/package.json#L64 which runs https://github.com/jesec/flood/blob/master/server/.jest/auth.setup.js#L8 et al. This runs global flood.

FinalDoom avatar Apr 26 '24 22:04 FinalDoom

is doesn't, actually. it just override argv so our argv parser could parse config from it.

trim21 avatar Apr 26 '24 22:04 trim21

this process.argv is not to be used to start a new process.

trim21 avatar Apr 26 '24 22:04 trim21

Pretty sure I wrote this after discovering it was running against a different version than what I had written. But I don't care enough to re-validate.

IE. the ticket states

This fails if flood isn't globally installed.

That's pretty easy to validate. But I won't do it again.

FinalDoom avatar Apr 26 '24 22:04 FinalDoom

maybe another reason causing this

trim21 avatar Apr 26 '24 22:04 trim21