Skip to content

Commit

Permalink
feat: use detect-port v2 (#275)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Release Notes

- **New Features**
- Added new badges in the README for Node.js version and contributors,
enhancing documentation visibility.

- **Bug Fixes**
- Updated Node.js version specifications in the CI workflow to include
specific patch and additional major versions.

- **Chores**
- Upgraded dependencies in the project for improved compatibility and
features. Removed outdated dependency.
- Removed a GitHub Actions workflow for CodeQL analysis to streamline
processes.
- Enabled debug output in several test cases for better troubleshooting.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
fengmk2 authored Dec 8, 2024
1 parent 05f7d9a commit 4816db4
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 90 deletions.
68 changes: 0 additions & 68 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ jobs:
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
with:
os: 'ubuntu-latest, macos-latest, windows-latest'
version: '16, 18, 20'
version: '16.19.0, 16, 18, 20, 22'
16 changes: 5 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[![Test coverage][codecov-image]][codecov-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]
[![Node.js Version][node-version-image]][node-version-url]

[npm-image]: https://img.shields.io/npm/v/egg-bin.svg?style=flat-square
[npm-url]: https://npmjs.org/package/egg-bin
Expand All @@ -16,6 +17,8 @@
[snyk-url]: https://snyk.io/test/npm/egg-bin
[download-image]: https://img.shields.io/npm/dm/egg-bin.svg?style=flat-square
[download-url]: https://npmjs.org/package/egg-bin
[node-version-image]: https://img.shields.io/node/v/egg-bin.svg?style=flat-square
[node-version-url]: https://nodejs.org/en/download/

egg developer tool, extends [@artus-cli/artus-cli].

Expand Down Expand Up @@ -212,20 +215,11 @@ See <https://artus-cli.github.io>

[MIT](LICENSE)

<!-- GITCONTRIBUTOR_START -->

## Contributors

|[<img src="https://avatars.githubusercontent.com/u/156269?v=4" width="100px;"/><br/><sub><b>fengmk2</b></sub>](https://github.com/fengmk2)<br/>|[<img src="https://avatars.githubusercontent.com/u/227713?v=4" width="100px;"/><br/><sub><b>atian25</b></sub>](https://github.com/atian25)<br/>|[<img src="https://avatars.githubusercontent.com/u/360661?v=4" width="100px;"/><br/><sub><b>popomore</b></sub>](https://github.com/popomore)<br/>|[<img src="https://avatars.githubusercontent.com/u/5856440?v=4" width="100px;"/><br/><sub><b>whxaxes</b></sub>](https://github.com/whxaxes)<br/>|[<img src="https://avatars.githubusercontent.com/u/32174276?v=4" width="100px;"/><br/><sub><b>semantic-release-bot</b></sub>](https://github.com/semantic-release-bot)<br/>|[<img src="https://avatars.githubusercontent.com/u/985607?v=4" width="100px;"/><br/><sub><b>dead-horse</b></sub>](https://github.com/dead-horse)<br/>|
| :---: | :---: | :---: | :---: | :---: | :---: |
|[<img src="https://avatars.githubusercontent.com/u/6897780?v=4" width="100px;"/><br/><sub><b>killagu</b></sub>](https://github.com/killagu)<br/>|[<img src="https://avatars.githubusercontent.com/u/19908330?v=4" width="100px;"/><br/><sub><b>hyj1991</b></sub>](https://github.com/hyj1991)<br/>|[<img src="https://avatars.githubusercontent.com/u/2160731?v=4" width="100px;"/><br/><sub><b>mansonchor</b></sub>](https://github.com/mansonchor)<br/>|[<img src="https://avatars.githubusercontent.com/u/5243774?v=4" width="100px;"/><br/><sub><b>ngot</b></sub>](https://github.com/ngot)<br/>|[<img src="https://avatars.githubusercontent.com/u/1763067?v=4" width="100px;"/><br/><sub><b>waitingsong</b></sub>](https://github.com/waitingsong)<br/>|[<img src="https://avatars.githubusercontent.com/u/16103358?v=4" width="100px;"/><br/><sub><b>onlylovermb</b></sub>](https://github.com/onlylovermb)<br/>|
|[<img src="https://avatars.githubusercontent.com/u/19733683?v=4" width="100px;"/><br/><sub><b>snyk-bot</b></sub>](https://github.com/snyk-bot)<br/>|[<img src="https://avatars.githubusercontent.com/u/2755933?v=4" width="100px;"/><br/><sub><b>BiosSun</b></sub>](https://github.com/BiosSun)<br/>|[<img src="https://avatars.githubusercontent.com/u/1474688?v=4" width="100px;"/><br/><sub><b>luckydrq</b></sub>](https://github.com/luckydrq)<br/>|[<img src="https://avatars.githubusercontent.com/u/9213756?v=4" width="100px;"/><br/><sub><b>gxkl</b></sub>](https://github.com/gxkl)<br/>|[<img src="https://avatars.githubusercontent.com/u/415655?v=4" width="100px;"/><br/><sub><b>stormslowly</b></sub>](https://github.com/stormslowly)<br/>|[<img src="https://avatars.githubusercontent.com/u/11251401?v=4" width="100px;"/><br/><sub><b>Solais</b></sub>](https://github.com/Solais)<br/>|
|[<img src="https://avatars.githubusercontent.com/u/52845048?v=4" width="100px;"/><br/><sub><b>snapre</b></sub>](https://github.com/snapre)<br/>|[<img src="https://avatars.githubusercontent.com/u/23313266?v=4" width="100px;"/><br/><sub><b>ZYSzys</b></sub>](https://github.com/ZYSzys)<br/>|[<img src="https://avatars.githubusercontent.com/u/25807379?v=4" width="100px;"/><br/><sub><b>angleshe</b></sub>](https://github.com/angleshe)<br/>|[<img src="https://avatars.githubusercontent.com/u/26563778?v=4" width="100px;"/><br/><sub><b>ahungrynoob</b></sub>](https://github.com/ahungrynoob)<br/>|[<img src="https://avatars.githubusercontent.com/u/863430?v=4" width="100px;"/><br/><sub><b>yinseny</b></sub>](https://github.com/yinseny)<br/>|[<img src="https://avatars.githubusercontent.com/u/13450124?v=4" width="100px;"/><br/><sub><b>liuhanqu</b></sub>](https://github.com/liuhanqu)<br/>|
[<img src="https://avatars.githubusercontent.com/u/2127199?v=4" width="100px;"/><br/><sub><b>okoala</b></sub>](https://github.com/okoala)<br/>

This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Sat Jun 03 2023 16:58:54 GMT+0800`.
[![Contributors](https://contrib.rocks/image?repo=eggjs/egg-bin)](https://github.com/eggjs/egg-bin/graphs/contributors)

<!-- GITCONTRIBUTOR_END -->
Made with [contributors-img](https://contrib.rocks).

[mocha]: https://mochajs.org
[glob]: https://github.com/isaacs/node-glob
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@artus-cli/plugin-version": "^1.0.1",
"@eggjs/utils": "^3.0.1",
"c8": "^10.0.0",
"detect-port": "^1.3.0",
"detect-port": "^2.0.0",
"egg-ts-helper": "^2.1.0",
"globby": "^11.1.0",
"jest-changed-files": "^29.4.2",
Expand All @@ -42,7 +42,7 @@
"@swc-node/register": "^1.6.1",
"@swc/core": "^1.3.35",
"@types/mocha": "^10.0.1",
"@types/node": "^20.6.1",
"@types/node": "^22.10.1",
"assert-file": "^1.0.0",
"coffee": "^5.4.0",
"cpy": "^8.1.2",
Expand All @@ -52,7 +52,6 @@
"esbuild-register": "^3.4.2",
"eslint": "^8.16.0",
"eslint-config-egg": "^13.1.0",
"git-contributor": "2",
"npminstall": "^7.5.0",
"typescript": "^5.2.2"
},
Expand Down
2 changes: 1 addition & 1 deletion test/cmd/cov.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ describe('test/cmd/cov.test.ts', () => {
});

it('should support egg.revert', () => {
if (version < 18) return;
if (version < 18 || version > 20) return;
mm(process.env, 'NODE_ENV', 'development');
return coffee.fork(eggBin, [ 'cov' ], {
cwd: path.join(__dirname, '../fixtures/egg-revert'),
Expand Down
2 changes: 1 addition & 1 deletion test/cmd/dev.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ describe('test/cmd/dev.test.ts', () => {
});

it('should support egg.revert', () => {
if (version < 18) return;
if (version < 18 || version > 20) return;
mm(process.env, 'NODE_ENV', 'development');
return coffee.fork(eggBin, [ 'dev' ], {
cwd: path.join(__dirname, '../fixtures/egg-revert'),
Expand Down
9 changes: 5 additions & 4 deletions test/cmd/test.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('test/cmd/test.test.ts', () => {
describe('egg-bin test', () => {
it('should success js', () => {
return coffee.fork(eggBin, [ 'test' ], { cwd })
// .debug()
.debug()
.expect('stdout', /should success/)
.expect('stdout', /a\.test\.js/)
.expect('stdout', /b\/b\.test\.js/)
Expand Down Expand Up @@ -183,9 +183,10 @@ describe('test/cmd/test.test.ts', () => {
.end();
});

it('should success js', () => {
it('should success js on unhandled-rejection', () => {
if (version >= 20 && process.platform === 'win32') return;
return coffee.fork(eggBin, [ 'test' ], { cwd: path.join(fixtures, 'test-unhandled-rejection') })
// .debug()
.debug()
.expect('stdout', / Uncaught Error: mock error/)
.expect('code', 1)
.end();
Expand Down Expand Up @@ -308,7 +309,7 @@ describe('test/cmd/test.test.ts', () => {
});

it('should support egg.revert', () => {
if (version < 18) return;
if (version < 18 || version > 20) return;
return coffee.fork(eggBin, [ 'test' ], {
cwd: path.join(__dirname, '../fixtures/egg-revert'),
})
Expand Down
5 changes: 4 additions & 1 deletion test/ts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import _cpy from 'cpy';
import runscript from 'runscript';
import coffee from './coffee';

const version = Number(process.version.substring(1, 3));

async function cpy(src: string, target: string) {
if (fs.cp) {
await fs.cp(src, target, { force: true, recursive: true });
Expand Down Expand Up @@ -74,13 +76,14 @@ describe('test/ts.test.ts', () => {
});

it('should cov app in cluster mod', () => {
if (version > 20) return;
// skip on darwin
// https://github.com/eggjs/egg-bin/runs/6735190362?check_suite_focus=true
// [agent_worker] receive disconnect event on child_process fork mode, exiting with code:110
if (process.platform === 'darwin') return;
cwd = path.join(fixtures, 'example-ts-cluster');
return coffee.fork(eggBin, [ 'cov' ], { cwd })
// .debug()
.debug()
.expect('stdout', /Statements/)
.expect('code', 0)
.end();
Expand Down

0 comments on commit 4816db4

Please sign in to comment.