vesln / nixt

Simple and elegant end-to-end testing for command-line apps
MIT License
309 stars 19 forks source link

not #10

Open timoxley opened 9 years ago

timoxley commented 9 years ago

Would be good if there were a nice way to indicate that you want some set of expectations to not match, e.g. test that adding a flag adds some value, test that without the flag, the value is no longer there.

timoxley commented 9 years ago

e.g. https://github.com/zeke/package-json-to-readme/blob/27b2129a5aeb0c04ae497fd635910220bd66b351/test/index.js#L38-L47

vesln commented 9 years ago

Agreed. Are you interested in submitting a PR?

timoxley commented 9 years ago

What would api look like do you think?

timoxley commented 9 years ago

Having a a .not() in the chain makes it a little unclear whether it should be before or after the expectation:

nixt()
.cwd(path.join(__dirname, 'node_modules', '.bin'))
.run('mocha --version')
.stdout('1.13.0')
.not()
.end();
nixt()
.cwd(path.join(__dirname, 'node_modules', '.bin'))
.run('mocha --version')
.not()
.stdout('1.13.0')
.end();

Maybe create a not* version of each expectation, e.g.

nixt()
.cwd(path.join(__dirname, 'node_modules', '.bin'))
.run('mocha --version')
.notStdout('1.13.0')
.end();
vesln commented 9 years ago

Sorry for the late response. I agree with you, the not* version of each expectation feels much better.