Skip to content

Commit

Permalink
fix: add agent.js to package.files (#9)
Browse files Browse the repository at this point in the history
And move context.js to app/extend/
  • Loading branch information
fengmk2 committed Jan 12, 2017
1 parent 0f0eb46 commit f162bc1
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .autod.conf.js
Expand Up @@ -15,9 +15,9 @@ module.exports = {
'eslint',
'eslint-config-egg',
'supertest',
'should',
],
exclude: [
'./test/fixtures',
],
registry: 'https://r.cnpmjs.org',
}
21 changes: 0 additions & 21 deletions .github/ISSUE_TEMPLATE.md

This file was deleted.

2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,8 +1,8 @@
sudo: false
language: node_js
node_js:
- '4'
- '6'
- '7'
install:
- npm i npminstall && npminstall
script:
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
@@ -1,7 +1,7 @@
environment:
matrix:
- nodejs_version: '4'
- nodejs_version: '6'
- nodejs_version: '7'

install:
- ps: Install-Product node $env:nodejs_version
Expand Down
23 changes: 12 additions & 11 deletions package.json
Expand Up @@ -8,6 +8,7 @@
"files": [
"config",
"app.js",
"agent.js",
"onerror_page.html"
],
"repository": {
Expand All @@ -16,27 +17,27 @@
},
"keywords": [
"egg",
"plugin",
"egg-plugin",
"onerror"
],
"dependencies": {
"escape-html": "^1.0.3",
"koa-onerror": "^3.0.0"
"koa-onerror": "^3.0.1"
},
"devDependencies": {
"autod": "^2.7.1",
"egg": "^0.2.1",
"egg-bin": "^1.5.1",
"egg-ci": "^1.0.3",
"egg-mock": "^0.0.5",
"eslint": "^3.8.1",
"eslint-config-egg": "^3.1.0",
"pedding": "^1.0.0",
"egg": "^0.7.0",
"egg-bin": "^1.10.0",
"egg-ci": "^1.1.0",
"egg-mock": "^2.0.0",
"eslint": "^3.13.1",
"eslint-config-egg": "^3.2.0",
"pedding": "^1.1.0",
"rimraf": "^2.5.4",
"supertest": "^2.0.1"
},
"engines": {
"node": ">=4.0.0"
"node": ">=6.0.0"
},
"scripts": {
"test": "npm run lint && npm run test-local",
Expand All @@ -47,7 +48,7 @@
"autod": "autod"
},
"ci": {
"version": "4, 6"
"version": "6, 7"
},
"author": "dead_horse"
}
2 changes: 1 addition & 1 deletion test/fixtures/onerror-ctx-error/app/middleware/trigger.js
@@ -1,6 +1,6 @@
'use strict';

module.exports = function() {
module.exports = () => {
return function* (next) {
yield next;
this.logger.info('log something, then error happend.');
Expand Down
17 changes: 11 additions & 6 deletions test/onerror.test.js
Expand Up @@ -8,11 +8,11 @@ const rimraf = require('rimraf');
const path = require('path');
const assert = require('assert');


describe('test/lib/plugins/onerror.test.js', () => {
describe('test/onerror.test.js', () => {
let app;
before(() => {
mm.env('local');
mm.consoleLevel('NONE');
app = mm.app({ baseDir: 'onerror' });
return app.ready();
});
Expand All @@ -22,6 +22,7 @@ describe('test/lib/plugins/onerror.test.js', () => {
afterEach(mm.restore);

it('should handle error not in the req/res cycle with no ctx', function* () {
mm.consoleLevel('NONE');
const app = mm.app({
baseDir: 'mock-test-error',
});
Expand Down Expand Up @@ -142,7 +143,7 @@ describe('test/lib/plugins/onerror.test.js', () => {
if (process.platform !== 'win32') {
it('should log warn 4xx', function* () {
rimraf.sync(path.join(__dirname, 'fixtrues/onerror/logs'));

mm.consoleLevel('NONE');
const app = mm.app({
baseDir: 'onerror',
});
Expand All @@ -163,6 +164,7 @@ describe('test/lib/plugins/onerror.test.js', () => {
describe('no errorpage', () => {
let app;
before(() => {
mm.consoleLevel('NONE');
app = app = mm.app({
baseDir: 'onerror-no-errorpage',
});
Expand All @@ -182,6 +184,7 @@ describe('test/lib/plugins/onerror.test.js', () => {
describe('app.errorpage.url=/500', () => {
let app;
before(() => {
mm.consoleLevel('NONE');
app = app = mm.app({
baseDir: 'onerror-custom-500',
});
Expand Down Expand Up @@ -212,6 +215,7 @@ describe('test/lib/plugins/onerror.test.js', () => {
describe('onerror.ctx.error', () => {
let app;
before(() => {
mm.consoleLevel('NONE');
app = mm.app({
baseDir: 'onerror-ctx-error',
});
Expand All @@ -221,15 +225,16 @@ describe('test/lib/plugins/onerror.test.js', () => {

it('should 500', () => {
return request(app.callback())
.get('/error')
.expect(500)
.expect(/you can`t get userId\./);
.get('/error')
.expect(500)
.expect(/you can`t get userId\./);
});
});

describe('appErrorFilter', () => {
let app;
before(() => {
mm.consoleLevel('NONE');
app = mm.app({
baseDir: 'custom-listener-onerror',
});
Expand Down

0 comments on commit f162bc1

Please sign in to comment.