Skip to content

Conversation

@eddyystop
Copy link
Contributor

This example is documented in feathersjs-ecosystem/docs#1193

The module is named so as to run before app.test.js because of a long standing issue in Feathers. app.test.js starts a server using src/app.js, makes some REST requests, and then closes the server. Even one such REST request prevents another server from being started, using src/app.js, on which socket.io calls are made. (There are no issues with multiple servers using socket.io.)

The added test runs fine before app.test.js. It fails when run afterwards.

Matt's article about client/server testing does not have a solution to this situation.

It would be nice to at least understand what is going on. The situation forces socketio tests to be run before REST ones, even though interleaving them is the natural thing to do.

@eddyystop
Copy link
Contributor Author

eddyystop commented Aug 24, 2018

It looks like there is something stateful somewhere. This solves all issues I've run into

delete require.cache[require.resolve('../src1/app')]
app = require('../src1/app');

@daffl
Copy link
Member

daffl commented Aug 24, 2018

What I usually do is start the other server on a different port but you're right, the current test should shut the server down. I'll have a look at it as well.

@eddyystop
Copy link
Contributor Author

eddyystop commented Aug 24, 2018

I've also run into weird issues starting a WebSocket server on 3030 and a REST one on 3031 both using the same cached require(../src/app).

@daffl daffl mentioned this pull request Aug 20, 2019
@daffl daffl closed this in #118 Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants