Skip to content

Commit 209a14e

Browse files
author
Lars-Erik Roald
committed
Tests for deno
1 parent 5aad43c commit 209a14e

File tree

5 files changed

+528
-16
lines changed

5 files changed

+528
-16
lines changed

.devcontainer/Dockerfile

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# FROM node:18-alpine
22
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:dev-22-bookworm
33

4-
4+
ENV DEBIAN_FRONTEND=noninteractive
55

66
# [Optional] Uncomment this section to install additional OS packages.
77
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
@@ -15,11 +15,32 @@ FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:dev-22-bookworm
1515

1616
# RUN sudo apk add --allow-untrusted mssql-tools18_18.1.1.1-1_amd64.apk
1717

18+
# ------------------------------------------------------------
19+
# Install Bun as the current (non-root) user
20+
# ------------------------------------------------------------
1821
# --- Install Bun as the current (non-root) user ---
1922
RUN curl -fsSL https://bun.sh/install | bash
2023
RUN "$HOME/.bun/bin/bun" --version
2124

2225
# --- Make Bun globally available (so any shell/user can run `bun`) ---
26+
RUN cp "$HOME/.bun/bin/bun" /usr/local/bin/bun \
27+
&& chmod 0755 /usr/local/bin/bun \
28+
&& bun --version
29+
30+
# ------------------------------------------------------------
31+
# Install Deno (optimized, fewer apt-get update calls)
32+
# ------------------------------------------------------------
33+
RUN set -eux; \
34+
apt-get update; \
35+
apt-get install -y --no-install-recommends ca-certificates curl unzip; \
36+
rm -rf /var/lib/apt/lists/*; \
37+
curl -fsSL https://deno.land/x/install/install.sh | sh -s -- -y --no-modify-path; \
38+
install -m 0755 /root/.deno/bin/deno /usr/local/bin/deno; \
39+
deno --version
40+
41+
# ------------------------------------------------------------
42+
# MS SQL ODBC (your original install kept unchanged)
43+
# ------------------------------------------------------------
2344
RUN sudo cp "$HOME/.bun/bin/bun" /usr/local/bin/bun
2445
RUN sudo chmod 0755 /usr/local/bin/bun
2546
RUN bun --version
@@ -28,35 +49,34 @@ RUN bun --version
2849
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
2950
RUN curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list
3051
RUN apt-get update
31-
RUN sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
52+
RUN ACCEPT_EULA=Y apt-get install -y msodbcsql18
3253
#RUN echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
3354
#RUN ~/.bashrc
3455
RUN apt-get install -y unixodbc-dev
3556

36-
#alpine
57+
# ------------------------------------------------------------
58+
# Alpine variant (kept commented for reference)
59+
# ------------------------------------------------------------
3760
# RUN apk update
3861
# RUN apk --no-cache add curl
3962
# RUN apk --no-cache add unixodbc
4063
# RUN apk add sudo
4164
# # - RUN apk add unzip
4265
# RUN curl -O https://download.microsoft.com/download/b/9/f/b9f3cce4-3925-46d4-9f46-da08869c6486/msodbcsql18_18.1.1.1-1_amd64.apk
4366
# RUN curl -O https://download.microsoft.com/download/b/9/f/b9f3cce4-3925-46d4-9f46-da08869c6486/mssql-tools18_18.1.1.1-1_amd64.apk
44-
# RUN sudo apk add --allow-untrusted msodbcsql18_18.1.1.1-1_amd64.apk
45-
# RUN sudo apk add --allow-untrusted mssql-tools18_18.1.1.1-1_amd64.apk
46-
# RUN sudo apk add libnsl
47-
# RUN sudo apk add gcompat
67+
# RUN apk add --allow-untrusted msodbcsql18_18.1.1.1-1_amd64.apk
68+
# RUN apk add --allow-untrusted mssql-tools18_18.1.1.1-1_amd64.apk
69+
# RUN apk add libnsl
70+
# RUN apk add gcompat
4871
# RUN ln -s /usr/lib/libnsl.so.3 /usr/lib/libnsl.so.1
4972

50-
73+
# ------------------------------------------------------------
74+
# Example for bundling configuration scripts
75+
# ------------------------------------------------------------
5176
# RUN mkdir -p /usr/config
5277
# WORKDIR /usr/config
53-
54-
# Bundle config source
5578
# COPY . /usr/config
56-
57-
# Grant permissions for to our scripts to be executable
5879
# USER root
5980
# RUN chmod +x /usr/config/configure-db.sh
6081
# RUN chmod +x /usr/config/configure-db-local.sh
61-
6282
# ENTRYPOINT ["./configure-db-local.sh"]

.github/workflows/ci.yml

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,4 +178,66 @@ jobs:
178178
bun-version: latest
179179
- run: bun --version
180180
- run: bun install --ignore-scripts # avoid building msnodesqlv8
181-
- run: bun test --timeout=30000 ./tests/*.bun.test.js
181+
- run: bun test --timeout=30000 ./tests/*.bun.test.js
182+
183+
test-deno:
184+
runs-on: ubuntu-latest
185+
186+
container:
187+
image: node:22-bookworm
188+
189+
services:
190+
postgres:
191+
image: postgres
192+
env:
193+
POSTGRES_PASSWORD: postgres
194+
POSTGRES_DB: postgres
195+
options: >-
196+
--health-cmd pg_isready
197+
--health-interval 10s
198+
--health-timeout 5s
199+
--health-retries 5
200+
ports:
201+
- 5432:5432
202+
203+
mssql:
204+
image: mcr.microsoft.com/mssql/server:2019-latest
205+
env:
206+
SA_PASSWORD: P@assword123
207+
ACCEPT_EULA: 'Y'
208+
ports:
209+
- 1433:1433
210+
211+
mysql:
212+
image: mysql:8.0.31
213+
env:
214+
MYSQL_DATABASE: test
215+
MYSQL_USER: test
216+
MYSQL_PASSWORD: test
217+
MYSQL_ROOT_PASSWORD: test
218+
ports:
219+
- 3306:3306
220+
options: >-
221+
--health-cmd="mysqladmin ping"
222+
--health-interval=10s
223+
--health-timeout=5s
224+
--health-retries=3
225+
226+
oracle:
227+
image: gvenzl/oracle-xe
228+
env:
229+
ORACLE_PASSWORD: P@assword123
230+
ports:
231+
- 1521:1521
232+
233+
steps:
234+
- uses: actions/checkout@v4
235+
236+
# Install Deno
237+
- name: Setup Deno
238+
uses: denoland/setup-deno@v2
239+
with:
240+
deno-version: v2.x
241+
242+
- run: deno install
243+
- run: npm run test:deno

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
},
5151
"scripts": {
5252
"test": "vitest run --threads=false",
53-
"test:bun": "bun test --timeout=30000 ./tests/*.bun.test.js",
54-
"test:deno": "deno test --allow-all --unstable *.deno.test.js",
53+
"test:bun": "bun test --timeout=30000 ./tests/*.bun.test.js",
54+
"test:deno": "deno test --allow-all --unstable-detect-cjs ./tests/*.deno.test.js",
5555
"test:all": "echo 'Running Node.js tests...' && npm run test:node && echo 'Running Bun tests...' && npm run test:bun && echo 'Running Deno tests...' && npm run test:deno && echo 'All tests completed!'",
5656
"test:all:parallel": "concurrently \"npm:test:node\" \"npm:test:bun\" \"npm:test:deno\"",
5757
"coverage": "vitest run --coverage.enabled --coverage.reporter='text-summary' --threads=false",

0 commit comments

Comments
 (0)