nixt icon indicating copy to clipboard operation
nixt copied to clipboard

not

Open timoxley opened this issue 10 years ago • 5 comments

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 avatar Jan 29 '15 08:01 timoxley

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

timoxley avatar Jan 29 '15 08:01 timoxley

Agreed. Are you interested in submitting a PR?

vesln avatar Jan 29 '15 09:01 vesln

What would api look like do you think?

timoxley avatar Jan 29 '15 09:01 timoxley

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();

timoxley avatar Jan 29 '15 09:01 timoxley

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

vesln avatar Feb 09 '15 11:02 vesln