diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..ab8ff45 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,100 @@ +name: Full Stack CI + +on: + push: + branches: + - main + - 'ci*' + pull_request: + branches: + - main + - 'ci*' + +jobs: + test-api-linux: + name: API Test (Linux) + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [22.x] + + steps: + - uses: actions/checkout@v4 + - run: ls -l api/package-lock.json + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + cache-dependency-path: api/package-lock.json + - run: npm ci + working-directory: api + - run: npm test + working-directory: api + + test-frontend-linux: + name: Frontend Test (Linux) + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [22.x] + + steps: + - uses: actions/checkout@v4 + - run: ls -l front-end/package-lock.json + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + cache-dependency-path: front-end/package-lock.json + - run: npm ci + working-directory: front-end + - run: npm test + working-directory: front-end + + test-api-windows: + name: API Test (Windows) + runs-on: windows-latest + + strategy: + matrix: + node-version: [22.x] + + steps: + - uses: actions/checkout@v4 + - run: dir api\package-lock.json + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + cache-dependency-path: api/package-lock.json + - run: npm ci + working-directory: api + - run: npm test + working-directory: api + + test-frontend-windows: + name: Frontend Test (Windows) + runs-on: windows-latest + + strategy: + matrix: + node-version: [22.x] + + steps: + - uses: actions/checkout@v4 + - run: dir front-end\package-lock.json + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + cache-dependency-path: front-end/package-lock.json + - run: npm ci + working-directory: front-end + - run: npm test + working-directory: front-end diff --git a/api/package.json b/api/package.json index 3bab434..b5f72f9 100644 --- a/api/package.json +++ b/api/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", + "test": "echo \"No tests yet\"", "backend": "nodemon server.js " }, "nodemonConfig": { diff --git a/front-end/src/App.js b/front-end/src/App.js index 84ad135..d5026c6 100644 --- a/front-end/src/App.js +++ b/front-end/src/App.js @@ -10,7 +10,7 @@ function App() { return ( -
+
{/*
diff --git a/front-end/src/App.test.js b/front-end/src/App.test.js index 1f03afe..2bcb369 100644 --- a/front-end/src/App.test.js +++ b/front-end/src/App.test.js @@ -3,6 +3,6 @@ import App from './App'; test('renders learn react link', () => { render(); - const linkElement = screen.getByText(/learn react/i); + const linkElement = screen.getByTestId('testApp'); expect(linkElement).toBeInTheDocument(); });