Skip to content

Commit

Permalink
fix: ci
Browse files Browse the repository at this point in the history
  • Loading branch information
elrrrrrrr committed Oct 19, 2023
1 parent 7e3c184 commit e91d752
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 105 deletions.
35 changes: 25 additions & 10 deletions integration/index.2.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ describe('test/index.v2.test.js', () => {
afterEach(async () => {
await clean(cwd);
if (process.platform === 'darwin') {
await forceExitDaemon();
try {
await forceExitDaemon();
} catch (err) {
console.warn('force exit daemon error: %s', err.message);
}
} else {
await exitDaemon();
}
Expand All @@ -43,7 +47,7 @@ describe('test/index.v2.test.js', () => {
if (process.platform === 'linux') {
it('should run postinstall successfully', async () => {
cwd = path.join(__dirname, './fixtures/node-crc');
await coffee.fork(rapid, [ '--by=npm', `--deps-tree-path=${path.join(cwd, 'package-lock.json')}` ], { cwd })
await coffee.fork(rapid, [ 'install', '--by=npm', `--deps-tree-path=${path.join(cwd, 'package-lock.json')}` ], { cwd })
.debug()
.expect('stdout', /execute 1 lifecycle script\(s\)/)
.expect('code', 0)
Expand All @@ -56,7 +60,7 @@ describe('test/index.v2.test.js', () => {
describe('INIT_CWD', async () => {
it('should set INIT_CWD', async () => {
cwd = path.join(__dirname, './fixtures/init-cwd');
await coffee.fork(rapid, [ '--by=npminstall', `--deps-tree-path=${path.join(cwd, 'package-lock.json')}` ], { cwd })
await coffee.fork(rapid, [ 'install', '--by=npminstall', `--deps-tree-path=${path.join(cwd, 'package-lock.json')}` ], { cwd })
.debug()
.expect('stdout', new RegExp(`INIT_CWD=${process.cwd()}`))
.expect('code', 0)
Expand All @@ -67,8 +71,17 @@ describe('test/index.v2.test.js', () => {
describe('production mode', async () => {
it('should install production deps', async () => {
cwd = path.join(__dirname, './fixtures/prod-deps');
await coffee.fork(rapid, [
'--by=npminstall', '--production', `--deps-tree-path=${path.join(cwd, 'package-lock.json')}` ], { cwd })
await coffee
.fork(
rapid,
[
'install',
'--by=npminstall',
'--production',
`--deps-tree-path=${path.join(cwd, 'package-lock.json')}`,
],
{ cwd }
)
.debug()
.expect('code', 0)
.end();
Expand All @@ -81,7 +94,7 @@ describe('test/index.v2.test.js', () => {
it('should install node-canvas successfully', async () => {
cwd = path.join(__dirname, './fixtures/canvas');
await coffee
.fork(rapid, [ `--deps-tree-path=${path.join(cwd, 'package-lock.json')}` ], { cwd })
.fork(rapid, [ 'install' ], { cwd })
.debug()
.expect('code', 0)
.end();
Expand All @@ -100,8 +113,9 @@ describe('test/index.v2.test.js', () => {
delete process.env[k];
}
}

await coffee
.fork(rapid, [ `--deps-tree-path=${path.join(cwd, 'package-lock.json')}` ], {
.fork(rapid, [ 'install', '--ignore-scripts' ], {
cwd,
})
.debug()
Expand All @@ -118,8 +132,8 @@ describe('test/index.v2.test.js', () => {
cwd = path.join(__dirname, './fixtures/esbuild');
await coffee
.fork(rapid, [
'--by=npm',
`--deps-tree-path=${path.join(cwd, 'package-lock.json')}`,
'install',
'--ignore-scripts',
], {
cwd,
})
Expand All @@ -137,8 +151,9 @@ describe('test/index.v2.test.js', () => {
cwd = path.join(__dirname, './fixtures/esbuild');
await coffee
.fork(rapid, [
'install',
'--by=npminstall',
`--deps-tree-path=${path.join(cwd, 'package-lock.json')}`,
'--ignore-scripts',
], {
cwd,
})
Expand Down
6 changes: 4 additions & 2 deletions packages/cli/bin/rapid.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ yargs
describe: 'Skip running scripts during install',
type: 'boolean',
})
.option('mode', {
.option('by', {
describe: 'Set the installation mode, support npm or npminstall',
type: 'string',
});
},
handler: async argv => {
const ignoreScripts = argv['ignore-scripts'];
const mode = argv.mode || NpmFsMode.NPM;
const mode = argv.by || NpmFsMode.NPM;

const cwd = process.cwd();
const pkgRes = await util.readPkgJSON();
Expand All @@ -38,6 +38,8 @@ yargs
});

console.log('[rapid] install finished');
// 首次执行 nydusd 后台服务可能会 hang 住输入
process.exit(0);
},
})
.command({
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/lib/nydusd/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ exports.startNydusFs = async function(mode, cwd, pkg) {
};

exports.endNydusFs = async function(mode, cwd, pkg) {
if (mode === NYDUS_TYPE.NATIVE) {
if (!mode || mode === NYDUS_TYPE.NATIVE) {
console.log('[rapid] nydusd is not running, skip clean');
return;
}
Expand Down
47 changes: 0 additions & 47 deletions packages/cli/test/dep.test.js

This file was deleted.

45 changes: 0 additions & 45 deletions packages/cli/test/install.test.js

This file was deleted.

0 comments on commit e91d752

Please sign in to comment.