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

Single quote in consumer/provider names causes test failures #118

Closed
TimothyJones opened this issue Sep 27, 2018 · 1 comment · Fixed by #202
Closed

Single quote in consumer/provider names causes test failures #118

TimothyJones opened this issue Sep 27, 2018 · 1 comment · Fixed by #202

Comments

@TimothyJones
Copy link
Contributor

(Originally reported against pact-js here)

If the consumer or provider names contain single quote characters, the pact mock server doesn't spin up correctly, and connections are refused.

I've provided a branch that illustrates the problem in the Jest example for pact-js:

 git clone git@github.com:TimothyJones/pact-js.git
 cd pact-js
 git checkout single-quote-issue
 npm i && npm run dist && cd examples/jest/ && npm i
 npm run test

This happens because we escape the arguments here.

This escaping is necessary because we concatenate arguments to a single string here.

If we instead passed arguments as an array,child_process.spawn() will correctly escape them (docs here). However, windows quoting isn't straightforward (which might be why we started doing the quoting in the first place).

It looks like the cross-spawn package would work as a replacement for child_process that is better for Windows.

I haven't provided a PR because I don't have a windows machine I can test on - but I'm happy to roll one up if someone else is able to test it.

@TimothyJones
Copy link
Contributor Author

This is being released in v10.2.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants