mirror of
https://github.com/socketio/socket.io.git
synced 2026-01-12 16:38:12 -05:00
zuul is now archived [1] and does not support the new W3C WebDriver protocol, since it relies on the wd package [2] under the hood, which uses the (now deprecated) JSON Wire Protocol. We will now use the webdriver.io test framework, which allows to run our tests in local and on Sauce Labs (cross-browser and mobile tests). This allows us to run our tests on latest versions of Android and iOS, since Sauce Labs only supports the W3C WebDriver protocol for these platforms ([3]). [1]: https://github.com/defunctzombie/zuul [2]: https://github.com/admc/wd [3]: https://docs.saucelabs.com/dev/w3c-webdriver-capabilities/
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
const path = require("path");
|
|
const { exec } = require("child_process");
|
|
|
|
describe("autoUnref option", function () {
|
|
before(function () {
|
|
if (process.env.WDIO_WORKER !== undefined) {
|
|
return this.skip();
|
|
}
|
|
});
|
|
|
|
const fixture = (filename) =>
|
|
process.execPath + " " + path.join(__dirname, "fixtures", filename);
|
|
|
|
it("should stop once the timer is triggered", (done) => {
|
|
exec(fixture("unref.ts"), done);
|
|
});
|
|
|
|
it("should stop once the timer is triggered (even when trying to reconnect)", (done) => {
|
|
exec(fixture("unref-during-reconnection.ts"), done);
|
|
});
|
|
|
|
it("should stop once the timer is triggered (polling)", (done) => {
|
|
exec(fixture("unref-polling-only.ts"), done);
|
|
});
|
|
|
|
it("should stop once the timer is triggered (websocket)", (done) => {
|
|
exec(fixture("unref-websocket-only.ts"), done);
|
|
});
|
|
|
|
it("should not stop with autoUnref set to false", (done) => {
|
|
const process = exec(fixture("no-unref.ts"), () => {
|
|
done(new Error("should not happen"));
|
|
});
|
|
setTimeout(() => {
|
|
process.kill();
|
|
done();
|
|
}, 1000);
|
|
});
|
|
});
|