Skip to content

Commit

Permalink
test: useIsomorphicLayoutEffect 테스트 파일 변경 (#73)
Browse files Browse the repository at this point in the history
* test: useIsomorphicLayoutEffect 테스트 파일 변경

* chore: codecod build 추가

* chore: workflow 수정

* test: coverage 추가
  • Loading branch information
ssi02014 authored Apr 28, 2024
1 parent 2c44cfa commit 0b58516
Show file tree
Hide file tree
Showing 23 changed files with 326 additions and 41 deletions.
7 changes: 7 additions & 0 deletions .changeset/itchy-apricots-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@modern-kit/react': patch
'@modern-kit/types': patch
'@modern-kit/utils': patch
---

chore: codecov
22 changes: 14 additions & 8 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,20 @@ jobs:
codecov:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout 🔔
uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
- name: Node Setup 🔔
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
- run: yarn install --immutable
- run: yarn test
- uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
registry-url: 'https://registry.npmjs.org'
- name: install 🔨
run: yarn install --immutable
- name: build 🔨
run: lerna run build
- name: testing 🚀
run: yarn test
- uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
148 changes: 148 additions & 0 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
15 changes: 13 additions & 2 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
changesetIgnorePatterns:
- .github/**
- .yarn/cache/**
- "**/*.spec.{js,ts}"
- packages/docs/**

compressionLevel: 0

enableGlobalCache: false

yarnPath: .yarn/releases/yarn-4.0.1.cjs

supportedArchitectures:
os: ["current", "darwin", "linux", "win32"]
cpu: ["current", "x64" , "ia32", "arm64"]
cpu:
- x64
- arm64
os:
- darwin
- linux
- win32
5 changes: 3 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"dist"
],
"scripts": {
"test": "vitest",
"test:run": "vitest run",
"test": "vitest --coverage --typecheck",
"test:run": "vitest run --coverage --typecheck",
"build": "rm -rf dist && rollup -c",
"typecheck": "tsc --noEmit"
},
Expand All @@ -39,6 +39,7 @@
"@types/lodash-es": "^4",
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"@vitest/coverage-istanbul": "^1.5.2",
"esbuild": "^0.20.2",
"jsdom": "^24.0.0",
"lodash-es": "^4.17.21",
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { useEffect, useLayoutEffect } from 'react';

describe('useIsomorphicLayoutEffect', () => {
const originWindow = global.window;

afterEach(() => {
vi.resetModules();
});

it('should be useEffect in server environment', async () => {
Object.defineProperty(global, 'window', {
value: undefined,
});

const { useIsomorphicLayoutEffect } = await import('.');
expect(useIsomorphicLayoutEffect).toEqual(useEffect);
});

it('should be useLayoutEffect in client environment', async () => {
Object.defineProperty(global, 'window', {
value: originWindow,
});

const { useIsomorphicLayoutEffect } = await import('.');
expect(useIsomorphicLayoutEffect).toEqual(useLayoutEffect);
});
});
5 changes: 3 additions & 2 deletions packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"dist"
],
"scripts": {
"test": "vitest",
"test:run": "vitest run",
"test": "vitest --coverage --typecheck",
"test:run": "vitest run --coverage --typecheck",
"typecheck": "tsc",
"build": "rm -rf dist && yarn typecheck"
},
Expand All @@ -25,6 +25,7 @@
"access": "public"
},
"devDependencies": {
"@vitest/coverage-istanbul": "^1.5.2",
"tslib": "^2.6.2",
"typescript": "^5.1.6",
"vitest": "^1.5.0"
Expand Down
5 changes: 3 additions & 2 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"dist"
],
"scripts": {
"test": "vitest",
"test:run": "vitest run",
"test": "vitest --coverage --typecheck",
"test:run": "vitest run --coverage --typecheck",
"build": "rm -rf dist && rollup -c",
"typecheck": "tsc --noEmit"
},
Expand All @@ -34,6 +34,7 @@
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-terser": "^0.4.3",
"@rollup/plugin-typescript": "^11.1.2",
"@vitest/coverage-istanbul": "^1.5.2",
"esbuild": "^0.20.2",
"jsdom": "^24.0.0",
"rollup": "^4.14.3",
Expand Down
Loading

0 comments on commit 0b58516

Please sign in to comment.