-
-
Notifications
You must be signed in to change notification settings - Fork 343
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
when i run the test examples of mocha,it throw an error #256
Comments
Your issue states that your using Mac osx, but i can see that it's worrie Windows, right? I also note a comment on encoding, so my guess is that's something to look into. Might be worth doing a search through our issues to see if there anything there |
i am so sorry for my carelessness, i forgot to rewrite the os of the issue template |
@mefellows i saw the issues but i can not find the solution of this, a similar issues is base on react,but there is not a clear solution to resolve this, if you can provide a help, i will thanks for your kind |
Have you seen any of these?
My guess is there is an explicit encoding set in your environment that is overriding ours, which is causing an issue. |
Thanks for your reply,but I have checked my code,There is no obvious code to set encoding , and all files default to utf-8! |
It's not the code I'm thinking is setting it, but the OS environment itself. Could you please print out the values of your current shell environment? |
Is this what you said? ALLUSERSPROFILE=C:\ProgramData |
@malongqi is that issue related to this? In any case, it's a warning and obviously the text diff is working so the tests are passing. Set the appropriate |
Yes, thanks @itlixiaolong. I'm not sure what's going on specifically, but I'm guessing it has to do with Chinese character encodings. All I can find is https://bugs.ruby-lang.org/issues/1048. Are there any other settings you can think of that might affect encoding? |
I can't think of any other Settings that affect the character set right now,but i will keep trying,By the way, what is the correct settings of my current shell environment that you think |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Sorry, mefellows already answered it |
Software versions
v8.11.2
Expected behaviour
2passing
TBC
Actual behaviour
[2018-12-12T10:55:56.596Z] ERROR: pact-node@6.20.0/25780 on SYS-20180608SQD:
Pact Binary Error: C:/Users/Administrator/Desktop/pact-js-master/pact-js-master/examples/mocha/node_modules/@pact-foundation/pact-node/standalone/win32-1.61.1/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/settings.rb:40: warning: failed to load encoding (CP936); use ASCII-8BIT instead
2018-12-12T10:55:57.711Z] WARN: pact-node@6.20.0/25780 on SYS-20180608SQD: Pact exited with code 1.
[2018-12-12T10:55:57.712Z] INFO: pact-node@6.20.0/25780 on SYS-20180608SQD: Removing Pact with
PID: 32736
����: û���ҵ����� "32736"��
1) "before all" hook
0 passing (10s)
1 failing
"before all" hook:
Error: Timeout of 10000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (C:\Users\Administrator\Desktop\pact-js-master\pact-js-master\examples\mocha\test\get-dogs.spec.js)
TBC
Steps to reproduce
"use strict";
const expect = require("chai").expect;
const path = require("path");
const { Pact } = require('@pact-foundation/pact')
const { getMeDogs, getMeDog } = require("../index");
describe("The Dog API", () => {
let url = "http://localhost";
const port = 8992;
const provider = new Pact({
port: port,
log: path.resolve(process.cwd(), "logs", "mockserver-integration.log"),
dir: path.resolve(process.cwd(), "pacts"),
spec: 2,
consumer: "MyConsumer",
provider: "MyProvider",
pactfileWriteMode: "merge"
});
const EXPECTED_BODY = [
{
dog: 1
},
{
dog: 2
}
];
// Setup the provider
before(() => provider.setup());
// Write Pact when all tests done
after(() => provider.finalize());
// verify with Pact, and reset expectations
afterEach(() => provider.verify());
describe("get /dogs", () => {
before(done => {
const interaction = {
state: "i have a list of dogs",
uponReceiving: "a request for all dogs",
withRequest: {
method: "GET",
path: "/dogs",
headers: {
Accept: "application/json"
}
},
willRespondWith: {
status: 200,
headers: {
"Content-Type": "application/json"
},
body: EXPECTED_BODY
}
};
provider.addInteraction(interaction).then(() => {
done();
});
});
});
describe('get /dog/1', () => {
before(done => {
const interaction = {
state: 'i have a list of dogs',
uponReceiving: 'a request for a single dog',
withRequest: {
method: 'GET',
path: '/dogs/1',
headers: {
'Accept': 'application/json'
}
},
willRespondWith: {
status: 200,
headers: {
'Content-Type': 'application/json'
},
body: EXPECTED_BODY
}
}
provider.addInteraction(interaction).then(() => {
done()
})
})
})
});
Relevant log files
Please ensure you set logging to
DEBUG
and attach any relevant log files here (or link from a gist).The text was updated successfully, but these errors were encountered: