Skip to content

Commit

Permalink
test: fix ci (#5025)
Browse files Browse the repository at this point in the history
  • Loading branch information
atian25 committed Sep 22, 2022
1 parent 5de994b commit f422533
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -79,7 +79,6 @@
"eslint-config-egg": "^12.0.0",
"findlinks": "^2.1.0",
"formstream": "^1.1.1",
"glob": "^8",
"jsdoc": "^3.6.11",
"koa": "^2.13.4",
"koa-static": "^5.0.0",
Expand Down
6 changes: 6 additions & 0 deletions test/fixtures/apps/logrotator-app/config/config.default.js
Expand Up @@ -7,3 +7,9 @@ exports.logrotator = {
};

exports.keys = 'test key';

exports.customLogger = {
scheduleLogger: {
consoleLevel: 'DEBUG',
},
};
8 changes: 5 additions & 3 deletions test/lib/plugins/logrotator.test.js
Expand Up @@ -2,9 +2,9 @@

const assert = require('assert');

const path = require('path');
const glob = require('glob');
const fs = require('fs').promises;
const utils = require('../../utils');
const sleep = async ms => new Promise(resolve => setTimeout(resolve, ms));

describe('test/lib/plugins/logrotator.test.js', () => {
let app;
Expand All @@ -17,8 +17,10 @@ describe('test/lib/plugins/logrotator.test.js', () => {

it('should rotate log file default', async () => {
const file = require.resolve('egg-logrotator/app/schedule/rotate_by_file.js');
console.log('job', file);
await app.runSchedule(file);
const files = glob.sync(path.join(app.config.logger.dir, '*.log.*'));
await sleep(1000);
const files = (await fs.readdir(app.config.logger.dir)).filter(f => f.includes('.log.'));
assert(files.length > 0);
files.forEach(file => {
assert(/\.log\.\d{4}-\d{2}-\d{2}$/.test(file));
Expand Down

1 comment on commit f422533

@vercel
Copy link

@vercel vercel bot commented on f422533 Sep 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

egg – ./

egg-git-master-suyi.vercel.app
eggjs.org
egg-pi.vercel.app
egg-suyi.vercel.app
www.eggjs.org

Please sign in to comment.