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

chore: use github actions to run CI #3974

Merged
merged 2 commits into from
Oct 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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