Skip to content

Commit

Permalink
test: make plugins/development test stable (eggjs#5211)
Browse files Browse the repository at this point in the history
For Nodejs 20, we should use "await" to wait each of these threads finishing their task and then for a coming result.
  • Loading branch information
fengmk2 authored Jun 15, 2023
1 parent 083314b commit c91ffe0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 25 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ on:
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '25 5 * * 6'

jobs:
analyze:
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ on:
pull_request:
branches: [ master, 2.x, 1.x ]

workflow_dispatch: {}

jobs:
Job:
name: Node.js
uses: artusjs/github-actions/.github/workflows/node-test.yml@master
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
with:
os: 'ubuntu-latest, macos-latest, windows-latest'
version: '14, 16, 18, 20'
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ on:
push:
branches: [ master, 2.x, 1.x ]

workflow_dispatch: {}

jobs:
release:
name: Node.js
uses: artusjs/github-actions/.github/workflows/node-release.yml@master
uses: node-modules/github-actions/.github/workflows/node-release.yml@master
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
Expand Down
26 changes: 9 additions & 17 deletions test/lib/plugins/development.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
'use strict';

const fs = require('fs');
const path = require('path');
const pedding = require('pedding');
const mm = require('egg-mock');
const utils = require('../../utils');

Expand All @@ -19,30 +16,25 @@ describe('test/lib/plugins/development.test.js', () => {
});
after(() => app.close());

it('should ignore assets', done => {
done = pedding(4, done);
it('should ignore assets', async () => {
mm(app.logger, 'info', msg => {
if (msg.match(/status /)) {
throw new Error('should not log status');
}
});

app.httpRequest()
await app.httpRequest()
.get('/foo.js')
.expect(200)
.end(done);
.expect(200);

app.httpRequest()
.get('/public/hello')
.expect(404, done);
await app.httpRequest()
.get('/public/hello');

app.httpRequest()
.get('/assets/hello')
.expect(404, done);
await app.httpRequest()
.get('/assets/hello');

app.httpRequest()
.get('/__koa_mock_scene_toolbox/hello')
.expect(404, done);
await app.httpRequest()
.get('/__koa_mock_scene_toolbox/hello');
});
});

Expand Down

0 comments on commit c91ffe0

Please sign in to comment.