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

Use eslint-config-koa #114

Merged
merged 1 commit into from
May 9, 2018
Merged

Use eslint-config-koa #114

merged 1 commit into from
May 9, 2018

Conversation

nickserv
Copy link
Member

@nickserv
Copy link
Member Author

The linting task passes for me, the build failure is some sort of stall that was also happening on master.

@kevinrambaud
Copy link
Contributor

hey @nickmccurdy the build fails because of the version of mocha. I noticed that its dependecy is set to * to it fetches the last release > 4.0.0.
Mocha 4.0.0 introduced a breaking change that impacts project that runs tests that keep active process in the event loop. (https://mochajs.org/#--exit----no-exit)

You can either fix the mocha dependency in the package.json and add the --exit arguments in the Makefile

test:
	@NODE_ENV=test ./node_modules/.bin/mocha \
		--harmony \
		--reporter spec \
		--require should \
		--exit \
		*/test.js

Or so go through all the existing tests and make sure that the app started is closed after each test file. It can be done as below :

var app = require('./app');
var server = app.listen();
var request = require('supertest').agent(server);

describe('Virtual Host', function() {
  // make sure to close the server after all tests to clear the event loop
  after(function() {
    server.close();
  });
  
  describe('www subdomain koa app', function() {
    describe('when GET /', function() {
      it('should say "Hello from www app"', function(done) {
        request
          .get('/')
          .set('Host', 'www.example.com')
          .expect(200)
          .expect('Hello from www app', done);
      });
// all the others tests below...
};

@kevinrambaud
Copy link
Contributor

I submitted a PR #117 to fix this issue.

@haoxins haoxins merged commit 461339b into koajs:master May 9, 2018
@nickserv nickserv deleted the use-eslint-config branch May 9, 2018 09:59
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.

None yet

3 participants