Skip to content

Commit

Permalink
Fix Continous Integration (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
trottomv authored Jan 16, 2024
1 parent a340cc6 commit afc55ef
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ const solidSetup = () => renderWithWrappers(<Button />)
test('Solid button renders correctly', () => {
solidSetup()
const button = window.getComputedStyle(screen.getByRole('button'))
expect(button.backgroundColor).toBe('rgb(49, 108, 244)')
expect(button.backgroundColor).toBe('rgb(0, 122, 255)')
expect(button.color).toBe('rgb(241, 249, 255)')
})
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,16 @@ pactWith(pactConfig, interaction => {
})
.willRespondWith({
contentType: 'application/json; charset=utf-8',
status: 200,
body: {
status: 'ok'
}
status: 204,
body: ''
})
})
execute(interactionName, async mockServer => {
const { data, status } = await healthCheck({
baseUrl: mockServer.url
})
expect(status).toBe(200)
expect(data).toEqual({ status: 'ok' })
expect(status).toBe(204)
expect(data).toEqual('')
})
})
})
2 changes: 1 addition & 1 deletion {{cookiecutter.project_dirname}}/__tests__/setupTests.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import '@testing-library/jest-dom/extend-expect'
import '@testing-library/jest-dom/jest-globals'
2 changes: 1 addition & 1 deletion {{cookiecutter.project_dirname}}/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
- NEXT_PUBLIC_PROJECT_URL=${NEXT_PUBLIC_PROJECT_URL:-https://localhost:8443}
- REACT_ENVIRONMENT=${REACT_ENVIRONMENT:-development}
healthcheck:
test: wget -O- -q http://localhost:3000/api/health/ || exit 1
test: wget -O- -q http://consumer:3000/api/health/ || exit 1

provider:
command: -p 8000 -d pacts -o --insecure-tls
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
proxy:
command:
- "--configFile=/traefik/conf/static.yaml"
image: traefik:v2.6
image: traefik:v2.10
networks:
default:
aliases:
Expand Down
6 changes: 2 additions & 4 deletions {{cookiecutter.project_dirname}}/docker/cypress.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# syntax=docker/dockerfile:1

FROM cypress/base:18.16.1
FROM cypress/base:18.6.0
ARG USER=appuser
ENV APPUSER=$USER \
CYPRESS_CACHE_FOLDER="/home/$USER/.cache/Cypress" \
PATH="$PATH:./node_modules/.bin"
ENV APPUSER=$USER PATH="$PATH:./node_modules/.bin"
WORKDIR /app
RUN useradd --skel /dev/null --create-home $APPUSER
RUN chown $APPUSER:$APPUSER /app
Expand Down
34 changes: 26 additions & 8 deletions {{cookiecutter.project_dirname}}/docker/test.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,38 @@
# syntax=docker/dockerfile:1

FROM node:18-bookworm-slim
ARG DEBIAN_FRONTEND=noninteractive USER=appuser
ENV APPUSER=$USER LANG=C.UTF-8 LC_ALL=C.UTF-8 NEXT_TELEMETRY_DISABLED=1 NODE_ENV="development" PATH="$PATH:./node_modules/.bin" TZ='Europe/Rome' WORKDIR=/app
FROM node:18-bullseye-slim
ARG DEBIAN_FRONTEND=noninteractive GROUP_ID=1001 USER=appuser
ENV APPUSER=$USER \
CYPRESS_CACHE_FOLDER="/tmp/.cache/Cypress" \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
NEXT_TELEMETRY_DISABLED=1 \
NODE_ENV="development" \
PATH="$PATH:./node_modules/.bin" \
TZ='Europe/Rome' \
WORKDIR=/app
RUN apt-get update \
&& apt-get install --assume-yes --no-install-recommends \
g++ \
make \
python3 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR $WORKDIR
RUN addgroup --system --gid 1001 $APPUSER
RUN adduser --system --uid 1001 $APPUSER
RUN chown $APPUSER:$APPUSER $WORKDIR
USER $APPUSER
COPY --chown=$APPUSER ./scripts/test.sh jest.config.js middleware.ts next.config.js package.json tsconfig.json yarn.lock ./
RUN addgroup --system --gid $GROUP_ID $APPUSER
RUN adduser --system --uid $GROUP_ID $APPUSER
RUN chown $GROUP_ID:$APPUSER $WORKDIR
USER $GROUP_ID:$USER_ID
COPY --chown=$APPUSER \
./scripts/test.sh \
.eslintrc.json \
.prettierrc.json \
jest.config.js \
middleware.ts \
next.config.js \
package.json \
tsconfig.json \
yarn.lock \
./
ENTRYPOINT ["./test.sh"]
CMD yarn ci:contract-test && yarn ci:unit-test
LABEL company="20tab" project="{{ cookiecutter.project_slug }}" service="frontend" stage="test"

0 comments on commit afc55ef

Please sign in to comment.