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

10.0.0 Release Notes #150

Closed
geek opened this issue Sep 8, 2016 · 0 comments
Assignees
Milestone

Comments

@geek
Copy link
Member

@geek geek commented Sep 8, 2016

Summary

There are no new major features in the release of v10.0.0, instead, it's a release that includes a breaking change related to event propagation.

Breaking Changes

Previously, the following test would succeed:

    it('wreck instances share the same emitter', (done) => {

        const server = Http.createServer((req, res) => {

            res.writeHead(200);
            res.end('ok');
        });

        const wreck1 = Wreck.defaults({});
        const wreck2 = Wreck.defaults({});

        let handled = 0;
        wreck1.once('request', () => {

            handled++;
        });

        wreck2.once('request', () => {

            handled++;
        });

        server.listen(0, () => {

            wreck1.get('http://localhost:' + server.address().port, (err, res, payload) => {

                expect(err).to.not.exist();
                expect(res.statusCode).to.equal(200);
                expect(payload.toString()).to.equal('ok');
                expect(handled).to.equal(2);
                server.close();
                done();
            });
        });
    });

The above test now fails, as wreck instances no longer share the same EventEmitter instance. However, all wreck instances will propagate events to the global process[Symbol.for('wreck')] emitter instance in addition to their individual emitter.

There are no upgrade steps required unless you depended on the shared behavior demonstrated above. If that is the case and you do want to have a handler for all wreck events then please use process[Symbol.for('wreck')] instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.