분류 전체보기
-
e2e 테스트를 공부 하면서 save함수의 리턴값과 toEqual로 값비교Nest.js/TDD 2024. 3. 20. 21:44
mockData = await postsRepository.save({ id: 1, author: '타입스크립트', title: '타입스크립트', content: '타입스크립트', likeCount: 0, commentCount: 0, created_at: new Date(), updated_at: new Date(), }); it('(GET) get Post /posts/:postId', async () => { const res = await request(app.getHttpServer()) .get(`/posts/${mockData.id}`) .expect(HttpStatus.OK); expect(res.body).toEqual(mockData); }); 미리 생성된 post의 id로 get요청해..
-
왜 테스트 코드를 작성 해야 하는지 알게 된 경험(typeorm bigint 이슈)Nest.js/TDD 2024. 3. 19. 18:01
e2e 테스트 공부를 하고 있었는데 - posts.entity.ts import { Column, Entity, PrimaryColumn } from 'typeorm'; @Entity() export class PostsModel { @PrimaryColumn({ type: 'bigint' }) id: number; @Column() author: string; @Column() title: string; @Column() content: string; @Column() likeCount: number; @Column() commentCount: number; } - docker-compose.yaml services: postgres: image: postgres:15 restart: always vo..
-
NestJS redis 라이브러리Nest.js 2024. 3. 17. 16:33
https://www.npmjs.com/package/@liaoliaots/nestjs-redis @liaoliaots/nestjs-redis Redis(ioredis) module for Nest framework (node.js).. Latest version: 9.0.5, last published: a year ago. Start using @liaoliaots/nestjs-redis in your project by running `npm i @liaoliaots/nestjs-redis`. There are 41 other projects in the npm registry using www.npmjs.com https://www.npmjs.com/package/ioredis
-
vscode에서 eslint룰대로 order정렬을 하고 싶을때eslint 2024. 3. 12. 17:05
'import/order': [ 'error', { groups: [ 'builtin', 'external', 'internal', ['sibling', 'parent'], 'index', 'unknown', ], 'newlines-between': 'always', alphabetize: { order: 'asc', caseInsensitive: true, }, }, ], import/order룰대로 자동 정렬 되지 않고 vscode상에서 에러표시가 난다. .vscode/settings.json { ... "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit" } } 해당 설정을 하게 되면 저장 할때 자동으로 정렬해준다!
-
NestJS에서 에러 로그 생성 및 관리Nest.js 2024. 3. 12. 15:28
https://velog.io/@inmyblue0930/winton-daily-rotate-file Winston + Winston-daily-rotate-file 를 이용하여 로그 파일 관리 Sentry-Slack 연동 | 실시간 로그모니터링 https://velog.io/@inmyblue0930/Sentry-Slack-%EC%97%B0%EB%8F%99-%EC%8B%A4%EC%8B%9C%EA%B0%84-%EB%A1%9C%EA%B7%B8%EB%AA%A8%EB%8B%88%ED%84%B0%EB%A7%81 [NestJs]Sentry-Slack 연동 | 실시간 로그모니터링 목표 1) Sentry를 통해 에러 발생시 바로 트래킹 2) Slack으로 에러 전송 설치해야할 라이브러리 Sentry 연결 > Sentry..
-
Typescript로 SQL을 작성하는 라이브러리Node.js 2024. 3. 10. 13:19
https://github.com/codemix/ts-sql?tab=readme-ov-file GitHub - codemix/ts-sql: A SQL database implemented purely in TypeScript type annotations. A SQL database implemented purely in TypeScript type annotations. - codemix/ts-sql github.com 굉장히 흥미롭다. 완전한 Typescript를 이용하여 쌩 쿼리를 작성할 수 있다. 꿀잼인데?
-
nestjs-test-coverage에서 제외 파일 설정Nest.js/TDD 2024. 3. 9. 20:17
- Reference https://jestjs.io/docs/configuration#coveragepathignorepatterns-arraystring Configuring Jest · Jest The Jest philosophy is to work great by default, but sometimes you just need more configuration power. jestjs.io //package.json { ... "coverageDirectory": "../coverage", "testEnvironment": "node", "coveragePathIgnorePatterns": [ "/main.ts", "/app.module.ts" ] } }