Skip to content

Commit 58bbeec

Browse files
committed
f
1 parent 31f7ead commit 58bbeec

File tree

8 files changed

+42
-28
lines changed

8 files changed

+42
-28
lines changed

.github/workflows/nodejs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ jobs:
1212
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
1313
with:
1414
version: '18.19.0, 18, 20, 22'
15+
os: 'ubuntu-latest, macos-latest'
1516
secrets:
1617
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@
6262
"bin": "eggctl",
6363
"commands": "./dist/esm/commands",
6464
"dirname": "eggctl",
65-
"topicSeparator": " "
65+
"topicSeparator": " ",
66+
"additionalHelpFlags": [
67+
"-h"
68+
]
6669
},
6770
"bin": {
6871
"egg-scripts": "./bin/run.js",

test/egg-scripts.test.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

test/egg-scripts.test.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import coffee from 'coffee';
2+
import { getSourceFilename } from '../src/helper.js';
3+
4+
describe('test/egg-scripts.test.ts', () => {
5+
const eggBin = getSourceFilename('../bin/run.js');
6+
7+
it('show help', async () => {
8+
await coffee.fork(eggBin, [ '--help' ])
9+
.debug()
10+
.expect('stdout', /\$ eggctl \[COMMAND]/)
11+
.expect('code', 0)
12+
.end();
13+
14+
await coffee.fork(eggBin, [ 'start', '-h' ])
15+
.debug()
16+
.expect('stdout', /\$ eggctl start \[BASEDIR] /)
17+
.expect('code', 0)
18+
.end();
19+
20+
await coffee.fork(eggBin, [ 'stop', '-h' ])
21+
.debug()
22+
.expect('stdout', /\$ eggctl stop \[BASEDIR] /)
23+
.expect('code', 0)
24+
.end();
25+
});
26+
});

test/fixtures/ts-pkg/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"typescript": true
99
},
1010
"scripts": {
11-
"build": "sh ../../../node_modules/.bin/tsc",
11+
"build": "./../../../node_modules/.bin/tsc",
1212
"windows-build": "call ../../../node_modules/.bin/tsc.cmd"
1313
}
1414
}

test/fixtures/ts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"egg": "^1.0.0"
66
},
77
"scripts": {
8-
"build": "sh ../../../node_modules/.bin/tsc",
8+
"build": "./../../../node_modules/.bin/tsc",
99
"windows-build": "call ../../../node_modules/.bin/tsc.cmd"
1010
}
1111
}

test/stop.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ describe('test/stop.test.ts', () => {
204204
beforeEach(async () => {
205205
await cleanup(fixturePath);
206206
app = coffee.fork(eggBin, [ 'start', '--workers=2', '--title=example', fixturePath ]) as Coffee;
207-
// app.debug();
207+
app.debug();
208208
app.expect('code', 0);
209209

210210
app2 = coffee.fork(eggBin, [ 'start', '--workers=2', '--title=test', '--port=7002', fixturePath ]) as Coffee;
@@ -213,14 +213,14 @@ describe('test/stop.test.ts', () => {
213213
await scheduler.wait(waitTime);
214214

215215
assert.equal(replaceWeakRefMessage(app.stderr), '');
216-
assert(app.stdout.match(/custom-framework started on http:\/\/127\.0\.0\.1:7001/));
216+
assert.match(app.stdout, /custom-framework started on http:\/\/127\.0\.0\.1:7001/);
217217
const result = await request('http://127.0.0.1:7001');
218-
assert(result.data.toString() === 'hi, egg');
218+
assert.equal(result.data.toString(), 'hi, egg');
219219

220220
assert.equal(replaceWeakRefMessage(app2.stderr), '');
221-
assert(app2.stdout.match(/custom-framework started on http:\/\/127\.0\.0\.1:7002/));
221+
assert.match(app2.stdout, /custom-framework started on http:\/\/127\.0\.0\.1:7002/);
222222
const result2 = await request('http://127.0.0.1:7002');
223-
assert(result2.data.toString() === 'hi, egg');
223+
assert.equal(result2.data.toString(), 'hi, egg');
224224
});
225225

226226
afterEach(async () => {

test/ts.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ describe('test/ts.test.ts', () => {
9494
cwd: fixturePath,
9595
shell: isWindows,
9696
});
97-
assert(!result.stderr.toString());
97+
assert.equal(result.stderr.toString(), '');
9898
});
9999

100100
afterEach(async () => {
@@ -112,8 +112,9 @@ describe('test/ts.test.ts', () => {
112112
assert.equal(replaceWeakRefMessage(app.stderr), '');
113113
assert.match(app.stdout, /egg started on http:\/\/127\.0\.0\.1:7001/);
114114
const result = await request('http://127.0.0.1:7001', { dataType: 'json' });
115-
// console.log(result.data);
116-
assert(result.data.stack.includes(path.normalize('app/controller/home.ts:6:13')));
115+
console.log(result.data);
116+
assert.match(result.data.stack, /home\.ts:6:13/);
117+
// assert(result.data.stack.includes(path.normalize('app/controller/home.ts:6:13')));
117118
});
118119
});
119120
});

0 commit comments

Comments
 (0)