Skip to content

Commit

Permalink
Merge pull request #15 from LeleDallas/feat/ci-cd
Browse files Browse the repository at this point in the history
refactor: removed unused line
  • Loading branch information
LeleDallas authored Jul 29, 2023
2 parents 4c3506f + 5c442be commit 78d28e5
Show file tree
Hide file tree
Showing 17 changed files with 103 additions and 60 deletions.
22 changes: 10 additions & 12 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
node-version: "18"
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
Expand All @@ -26,23 +25,23 @@ jobs:
run: |
cd client
npm ci
npm run test-coverage
env:
CI: true
API_URL: ${{ secrets.API_URL }}
npm run coverage
- name: Vitest Coverage Report
uses: davelosert/[email protected]
with:
working-directory: "./client/"
vite-config-path: "./vite.config.ts"
- name: Run server tests & coverage
run: |
cd server
npm ci
npm run test-coverage
env:
CI: true
API_URL: ${{ secrets.API_URL }}
npm run coverage
- name: Vitest Coverage Report
uses: davelosert/vitest-coverage-report-action@v1.4.0
uses: davelosert/vitest-coverage-report-action@v2.1.0
with:
working-directory: "./server/"
vite-config-path: "./vite.config.ts"

release-please:
name: Release Please
needs: sonarcloud
Expand All @@ -52,6 +51,5 @@ jobs:
- name: Release Please Action
uses: google-github-actions/release-please-action@v3
with:
node-version: "18"
release-type: node
package-name: release-please-action
69 changes: 56 additions & 13 deletions client/package-lock.json

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

3 changes: 2 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"react-router-dom": "^6.9.0",
"socket.io": "^4.6.1",
"socket.io-client": "^4.6.1",
"styled-components": "^5.3.9"
"styled-components": "^5.3.9",
"vite-tsconfig-paths": "^4.2.0"
},
"devDependencies": {
"@faker-js/faker": "^7.6.0",
Expand Down
12 changes: 6 additions & 6 deletions client/src/route/AppRoute.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Route, Routes } from "react-router-dom";
import SocketContextComponent from "../context/SocketContextComponent";
import { ConfigProvider } from "antd";
import Home from "../pages/Home/Home";
import Lobby from "../pages/Lobby/Lobby";
import Rules from "../pages/Rules/Rules";
import CreateLobby from "../pages/Lobby/CreateLobby";
import WaitingLobby from "../pages/Lobby/WaitingLobby";
import Game from "../pages/Game/Game";
import Home from "../Pages/Home/Home";
import Lobby from "../Pages/Lobby/Lobby";
import Rules from "../Pages/Rules/Rules";
import CreateLobby from "../Pages/Lobby/CreateLobby";
import WaitingLobby from "../Pages/Lobby/WaitingLobby";
import Game from "../Pages/Game/Game";
import { Provider } from "react-redux";
import { store } from "../store/store";
import ErrorRoute from "./ErrorRoute";
Expand Down
2 changes: 1 addition & 1 deletion client/test/CreateLobby.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import '@testing-library/jest-dom';
import React from 'react';
import { expect, it, describe, vi } from 'vitest'
import { fireEvent, render } from '@testing-library/react';
import CreateLobby from "../src/pages/Lobby/CreateLobby"
import CreateLobby from "../src/Pages/Lobby/CreateLobby"
import { BrowserRouter } from 'react-router-dom';

const mockedUseNavigate = vi.fn();
Expand Down
2 changes: 1 addition & 1 deletion client/test/CzarView.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import { expect, it, describe, vi } from 'vitest'
import { fireEvent, render, screen } from '@testing-library/react';
import { BrowserRouter } from 'react-router-dom';
import CzarView from '../src/pages/Game/CzarView';
import CzarView from '../src/Pages/Game/CzarView';
import { Provider } from 'react-redux';
import { store } from '../src/store/store';
import { SocketContextProvider } from '../src/context/SocketContext';
Expand Down
2 changes: 1 addition & 1 deletion client/test/Game.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import { expect, it, describe, vi } from 'vitest'
import { fireEvent, render, screen } from '@testing-library/react'
import { BrowserRouter, MemoryRouter } from 'react-router-dom';
import Game from '../src/pages/Game/Game';
import Game from '../src/Pages/Game/Game';
import { act } from 'react-dom/test-utils';
import { Provider } from 'react-redux';
import { store } from '../src/store/store';
Expand Down
2 changes: 1 addition & 1 deletion client/test/GameScorer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import { expect, it, describe } from 'vitest'
import { render } from '@testing-library/react'
import { BrowserRouter } from 'react-router-dom';
import GameScorer from '../src/pages/Game/GameScorer';
import GameScorer from '../src/Pages/Game/GameScorer';

describe('Game Scorer', () => {

Expand Down
2 changes: 1 addition & 1 deletion client/test/Home.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import '@testing-library/jest-dom';
import React from 'react';
import { expect, it, describe, vi, test } from 'vitest'
import { fireEvent, render } from '@testing-library/react';
import Home from '../src/pages/Home/Home';
import Home from '../src/Pages/Home/Home';
import { BrowserRouter } from 'react-router-dom';
import { Provider } from 'react-redux';
import { store } from '../src/store/store';
Expand Down
2 changes: 1 addition & 1 deletion client/test/Lobby.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import '@testing-library/jest-dom';
import React from 'react';
import { expect, it, describe, beforeEach, vi } from 'vitest'
import { fireEvent, render, waitFor } from '@testing-library/react'
import Lobby from '../src/pages/Lobby/Lobby';
import Lobby from '../src/Pages/Lobby/Lobby';
import { BrowserRouter } from 'react-router-dom';

const mockedUseNavigate = vi.fn();
Expand Down
9 changes: 2 additions & 7 deletions client/test/PlayerView.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import { expect, it, describe, vi } from 'vitest'
import { fireEvent, render, screen } from '@testing-library/react';
import { BrowserRouter, MemoryRouter } from 'react-router-dom';
import PlayerView from '../src/pages/Game/PlayerView';
import PlayerView from '../src/Pages/Game/PlayerView';
import { testStore } from '../src/store/store';
import { Provider } from 'react-redux';
import { SocketContextProvider } from '../src/context/SocketContext';
Expand Down Expand Up @@ -135,10 +135,6 @@ describe('Player View', () => {
score: new Map(),
new_turn: false
};
const drawNew = vi.fn();
const setSelected = vi.fn();
const setPlayerHand = vi.fn();
const setHasPlayed = vi.fn();
const state = { roomName: 'room1', isCzar: false };

const socketProvider = ({ children }) => (
Expand All @@ -151,8 +147,7 @@ describe('Player View', () => {
</Provider>
)
render(<PlayerView />, { wrapper: socketProvider });
const card = screen.getByText(7);
fireEvent.click(card);
fireEvent.click(screen.getByText(1));
fireEvent.click(screen.getByText('Submit Response'));
expect(screen.queryByText('1')).not.toBeInTheDocument()
});
Expand Down
2 changes: 1 addition & 1 deletion client/test/Rules.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import '@testing-library/jest-dom';
import React from 'react';
import { expect, it, describe, beforeEach, vi } from 'vitest'
import { fireEvent, render, waitFor } from '@testing-library/react'
import Rules from '../src/pages/Rules/Rules';
import Rules from '../src/Pages/Rules/Rules';
import { BrowserRouter } from 'react-router-dom';
import * as reactDeviceDetect from 'react-device-detect'

Expand Down
2 changes: 1 addition & 1 deletion client/test/WaitingLobby.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import { expect, it, describe, vi, test } from 'vitest'
import { fireEvent, render, screen } from '@testing-library/react'
import { BrowserRouter, MemoryRouter } from 'react-router-dom';
import WaitingLobby from '../src/pages/Lobby/WaitingLobby';
import WaitingLobby from '../src/Pages/Lobby/WaitingLobby';
import { Provider } from 'react-redux';
import { store } from '../src/store/store';
import { SocketContextProvider } from '../src/context/SocketContext';
Expand Down
7 changes: 4 additions & 3 deletions client/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { resolve } from "path";

import tsconfigPaths from 'vite-tsconfig-paths'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
plugins: [tsconfigPaths(), react()],
test: {
globals: true,
environment: "jsdom",
setupFiles: [resolve(__dirname, './setup.js')],
coverage: {
provider: "c8",
all: true,
// all: true,
reporter: ['text', 'json-summary', 'json'],
include: ["src/**/*.tsx", "src/**/*.ts"],
exclude: ["src/main.tsx", "src/types", "src/vite-env.d.ts", "src/reducers.ts", "src/testReducer.ts"],
},
Expand Down
Loading

0 comments on commit 78d28e5

Please sign in to comment.