diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..95942bde24 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,27 @@ +name: Continuous integration +on: [push, pull_request] +jobs: + Runner: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-2016, macOS-latest] + node-version: [8, 10, 12] + steps: + - name: Checkout Git Source + uses: actions/checkout@master + - name: Setup Node.js + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: Install Dependencies + run: | + npm install + - name: Continuous integration + run: npm run ci + - name: Code Coverage + run: | + npm install codecov -g + codecov + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/test/app/middleware/body_parser.test.js b/test/app/middleware/body_parser.test.js index 567a6b5035..95e289b0f7 100644 --- a/test/app/middleware/body_parser.test.js +++ b/test/app/middleware/body_parser.test.js @@ -27,8 +27,8 @@ describe('test/app/middleware/body_parser.test.js', () => { after(() => app.close()); afterEach(() => app1 && app1.close()); - it('should 200 when post form body below the limit', done => { - app.httpRequest() + it('should 200 when post form body below the limit', () => { + return app.httpRequest() .post('/test/body_parser/user') .set('Cookie', cookies) .set('Content-Type', 'application/x-www-form-urlencoded') @@ -36,26 +36,27 @@ describe('test/app/middleware/body_parser.test.js', () => { // https://snyk.io/vuln/npm:qs:20170213 test case .send(querystring.stringify({ foo: 'bar', _csrf: csrf, ']': 'toString' })) .expect({ foo: 'bar', _csrf: csrf, ']': 'toString' }) - .expect(200, done); + .expect(200); }); - it('should 200 when post json body below the limit', done => { - app.httpRequest() + it('should 200 when post json body below the limit', () => { + return app.httpRequest() .post('/test/body_parser/user') .set('Cookie', cookies) .set('Content-Type', 'application/json') .send({ foo: 'bar', _csrf: csrf, ']': 'toString' }) .expect({ foo: 'bar', _csrf: csrf, ']': 'toString' }) - .expect(200, done); + .expect(200); }); - it('should 413 when post json body over the limit', done => { + it('should 413 when post json body over the limit', () => { app.mockCsrf(); - app.httpRequest() + return app.httpRequest() .post('/test/body_parser/user') + .set('Connection', 'keep-alive') .send({ foo: 'a'.repeat(1024 * 200) }) .expect(/request entity too large, check bodyParser config/) - .expect(413, done); + .expect(413); }); it('should disable body parser', async () => {