Fix Dockerfile build to actually run tests and fix a unit test
Signed-off-by: Michael Irwin <mikesir87@gmail.com>
This commit is contained in:
parent
b6ea4168d4
commit
2bca273ff4
@ -5,7 +5,7 @@ WORKDIR /app
|
|||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
FROM node:12-alpine AS app-base
|
FROM node:18-alpine AS app-base
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY app/package.json app/yarn.lock ./
|
COPY app/package.json app/yarn.lock ./
|
||||||
COPY app/spec ./spec
|
COPY app/spec ./spec
|
||||||
@ -13,13 +13,12 @@ COPY app/src ./src
|
|||||||
|
|
||||||
# Run tests to validate app
|
# Run tests to validate app
|
||||||
FROM app-base AS test
|
FROM app-base AS test
|
||||||
RUN apk add --no-cache python3 g++ make
|
|
||||||
RUN yarn install
|
RUN yarn install
|
||||||
RUN yarn test
|
RUN yarn test
|
||||||
|
|
||||||
# Clear out the node_modules and create the zip
|
# Clear out the node_modules and create the zip
|
||||||
FROM app-base AS app-zip-creator
|
FROM app-base AS app-zip-creator
|
||||||
COPY app/package.json app/yarn.lock ./
|
COPY --from=test /app/package.json /app/yarn.lock ./
|
||||||
COPY app/spec ./spec
|
COPY app/spec ./spec
|
||||||
COPY app/src ./src
|
COPY app/src ./src
|
||||||
RUN apk add zip && \
|
RUN apk add zip && \
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
const db = require('../../src/persistence');
|
const db = require('../../src/persistence');
|
||||||
const addItem = require('../../src/routes/addItem');
|
const addItem = require('../../src/routes/addItem');
|
||||||
const ITEM = { id: 12345 };
|
const ITEM = { id: 12345 };
|
||||||
const uuid = require('uuid/v4');
|
const {v4 : uuid} = require('uuid');
|
||||||
|
|
||||||
jest.mock('uuid/v4', () => jest.fn());
|
jest.mock('uuid', () => ({ v4: jest.fn() }));
|
||||||
|
|
||||||
jest.mock('../../src/persistence', () => ({
|
jest.mock('../../src/persistence', () => ({
|
||||||
removeItem: jest.fn(),
|
removeItem: jest.fn(),
|
||||||
|
Loading…
Reference in New Issue
Block a user