I've written similar code in python that works as expected.
Using one of these moisture sensors: https://www.amazon.com/dp/B00ZR3B60I
The following code always prints "true"
const rpio = require('rpio');
rpio.open(12, rpio.INPUT);
console.log('Pin 12 is currently ' + (rpio.read(12) ? 'true' : 'false'));
Weather the sensor is submerged or not, regardless of the light on sensor (which I assumed was a visual HIGH or LOW) it will always come back true. When I remove the wire from the sensor, it will read false (as expected).
I've tried multiple node libraries all with the same result.
pi@pi-zer00:~ $ cat /etc/debian_version
9.4
pi@pi-zer00:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
pi@pi-zer00:~ $ uname -a
Linux pi-zer00 4.14.52+ #1123 Wed Jun 27 17:05:32 BST 2018 armv6l GNU/Linux
rpio.init({mapping: 'gpio'});