Skip to content

Conversation

@CHristopherkeith
Copy link

兼容高版本环境下的测试用例

高版本环境下:
Node.js: 10.15.2
mocha: 6.1.4
should: 13.2.3
supertest: 4.0.2
express: 4.17.0

运行测试用例会占用3000端口,可能导致:
1.app已运行的情况下,会报端口已被占用的错误
2.app没有运行,测试用例运行后没有退出,继续监听端口

解决方法:
根据module.parent判断是否为运行测试用例,是的话则不监听端口

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.

1 participant