Compare commits
2 Commits
ab6c56e55a
...
42c389b913
Author | SHA1 | Date | |
---|---|---|---|
|
42c389b913 | ||
|
9470aa8f8a |
3
.gitignore
vendored
3
.gitignore
vendored
@ -33,5 +33,4 @@ lerna-debug.log*
|
|||||||
!.vscode/launch.json
|
!.vscode/launch.json
|
||||||
!.vscode/extensions.json
|
!.vscode/extensions.json
|
||||||
|
|
||||||
workspaces/*
|
/config.yml
|
||||||
!workspaces/.gitkeep
|
|
@ -3,10 +3,10 @@ import { getRepositoryToken } from '@nestjs/typeorm';
|
|||||||
import { Project } from '../projects/project.entity';
|
import { Project } from '../projects/project.entity';
|
||||||
import { ReposService } from './repos.service';
|
import { ReposService } from './repos.service';
|
||||||
import { ConfigService } from '@nestjs/config';
|
import { ConfigService } from '@nestjs/config';
|
||||||
import { rm, unlink } from 'fs/promises';
|
import { rm } from 'fs/promises';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
|
||||||
const workspacesRoot = '/Users/ivanli/Projects/fennec/workspaces';
|
const workspacesRoot = 'E:\\Projects\\demos\\workspaces';
|
||||||
|
|
||||||
describe('ReposService', () => {
|
describe('ReposService', () => {
|
||||||
let service: ReposService;
|
let service: ReposService;
|
||||||
@ -21,7 +21,15 @@ describe('ReposService', () => {
|
|||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
}));
|
}));
|
||||||
|
afterEach(async () => {
|
||||||
|
await rm(join(workspacesRoot, 'test1'), {
|
||||||
|
recursive: true,
|
||||||
|
}).catch(() => undefined);
|
||||||
|
});
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
await rm(join(workspacesRoot, 'test1'), {
|
||||||
|
recursive: true,
|
||||||
|
}).catch(() => undefined);
|
||||||
const module: TestingModule = await Test.createTestingModule({
|
const module: TestingModule = await Test.createTestingModule({
|
||||||
providers: [
|
providers: [
|
||||||
ReposService,
|
ReposService,
|
||||||
@ -47,9 +55,6 @@ describe('ReposService', () => {
|
|||||||
expect(service).toBeDefined();
|
expect(service).toBeDefined();
|
||||||
});
|
});
|
||||||
describe('listLogs', () => {
|
describe('listLogs', () => {
|
||||||
beforeEach(async () => {
|
|
||||||
await rm(join(workspacesRoot, 'test1'), { recursive: true });
|
|
||||||
});
|
|
||||||
it('should be return logs', async () => {
|
it('should be return logs', async () => {
|
||||||
const result = await service.listLogs({ projectId: '1' });
|
const result = await service.listLogs({ projectId: '1' });
|
||||||
expect(result).toBeDefined();
|
expect(result).toBeDefined();
|
||||||
|
@ -34,7 +34,6 @@ export class ReposService {
|
|||||||
if (firstInit) {
|
if (firstInit) {
|
||||||
await git.init();
|
await git.init();
|
||||||
await git.addRemote('origin', project.sshUrl);
|
await git.addRemote('origin', project.sshUrl);
|
||||||
// await git.clone(project.sshUrl, workspacePath);
|
|
||||||
}
|
}
|
||||||
return git;
|
return git;
|
||||||
}
|
}
|
||||||
@ -44,13 +43,7 @@ export class ReposService {
|
|||||||
id: dto.projectId,
|
id: dto.projectId,
|
||||||
});
|
});
|
||||||
const git = await this.getGit(project);
|
const git = await this.getGit(project);
|
||||||
await git
|
await git.fetch();
|
||||||
.outputHandler((command, stdout, stderr) => {
|
|
||||||
stdout.pipe(process.stdout);
|
|
||||||
stderr.pipe(process.stderr);
|
|
||||||
})
|
|
||||||
.fetch();
|
|
||||||
// await git.checkoutBranch('master', 'origin/master');
|
|
||||||
return await git.log({
|
return await git.log({
|
||||||
'--branches': dto.branch ?? '',
|
'--branches': dto.branch ?? '',
|
||||||
'--remotes': 'origin',
|
'--remotes': 'origin',
|
||||||
|
Loading…
Reference in New Issue
Block a user