Skip to content

Commit

Permalink
chore: use github actions to run CI (#3974)
Browse files Browse the repository at this point in the history
runs-on macos/ubuntu/windows
  • Loading branch information
thonatos authored and fengmk2 committed Oct 11, 2019
1 parent c618354 commit 73ad6c0
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 9 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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 }}
19 changes: 10 additions & 9 deletions test/app/middleware/body_parser.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,35 +27,36 @@ 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')
.set('Accept', 'application/json')
// 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 () => {
Expand Down

0 comments on commit 73ad6c0

Please sign in to comment.