Skip to content

Commit cdc9415

Browse files
authored
fix: Deno v2 requires commonjs type explicitly (#3209)
* fix: Deno requires explict `commonjs` type * debug: remove polyfill * ci: use short flags * ci: detach Deno v1 from Deno workflow
1 parent bded498 commit cdc9415

File tree

2 files changed

+60
-5
lines changed

2 files changed

+60
-5
lines changed

.github/workflows/ci-linux.yml

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,66 @@ jobs:
110110
run: bun run test:bun
111111
timeout-minutes: 1
112112

113-
tests-linux-deno:
113+
tests-linux-deno-v1:
114114
runs-on: ubuntu-latest
115115
strategy:
116116
fail-fast: false
117117
matrix:
118-
deno-version: [v1.x, v2.x, canary]
118+
deno-version: [v1.x]
119+
mysql-version: ['mysql:8.0.33']
120+
use-compression: [0, 1]
121+
# TODO: investigate error when using SSL (1)
122+
#
123+
# errno: -4094
124+
# code: "UNKNOWN"
125+
# syscall: "read"
126+
use-tls: [0]
127+
128+
name: Deno ${{ matrix.deno-version }} - DB ${{ matrix.mysql-version }} - SSL=${{matrix.use-tls}} Compression=${{matrix.use-compression}}
129+
130+
steps:
131+
- uses: actions/checkout@v4
132+
- name: Set up MySQL
133+
run: docker run -d -e MYSQL_ALLOW_EMPTY_PASSWORD=1 -e MYSQL_DATABASE=${{ env.MYSQL_DATABASE }} -v $PWD/mysqldata:/var/lib/mysql/ -v $PWD/test/fixtures/custom-conf:/etc/mysql/conf.d -v $PWD/test/fixtures/ssl/certs:/certs -p ${{ env.MYSQL_PORT }}:3306 ${{ matrix.mysql-version }}
134+
135+
- name: Set up Deno ${{ matrix.deno-version }}
136+
uses: denoland/setup-deno@v1
137+
with:
138+
deno-version: ${{ matrix.deno-version }}
139+
140+
- name: Set up Node.js
141+
uses: actions/setup-node@v4
142+
with:
143+
node-version: 20
144+
- name: Cache dependencies
145+
uses: actions/cache@v4
146+
with:
147+
path: ~/.npm
148+
key: npm-linux-${{ hashFiles('package-lock.json') }}
149+
restore-keys: npm-linux-
150+
151+
- name: Install npm dependencies
152+
run: npm ci
153+
154+
- name: Wait mysql server is ready
155+
run: node tools/wait-up.js
156+
157+
- name: run tests
158+
env:
159+
MYSQL_USER: ${{ env.MYSQL_USER }}
160+
MYSQL_DATABASE: ${{ env.MYSQL_DATABASE }}
161+
MYSQL_PORT: ${{ env.MYSQL_PORT }}
162+
MYSQL_USE_COMPRESSION: ${{ matrix.use-compression }}
163+
MYSQL_USE_TLS: ${{ matrix.use-tls }}
164+
run: deno task test:deno -- --denoCjs='.js,.cjs'
165+
timeout-minutes: 5
166+
167+
tests-linux-deno-v2:
168+
runs-on: ubuntu-latest
169+
strategy:
170+
fail-fast: false
171+
matrix:
172+
deno-version: [v2.x, canary]
119173
mysql-version: ['mysql:8.0.33']
120174
use-compression: [0, 1]
121175
# TODO: investigate error when using SSL (1)

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
"description": "fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS",
55
"main": "index.js",
66
"typings": "typings/mysql/index",
7+
"type": "commonjs",
78
"scripts": {
89
"lint": "npm run lint:docs && npm run lint:code",
910
"lint:code": "eslint index.js promise.js index.d.ts promise.d.ts \"typings/**/*.ts\" \"lib/**/*.js\" \"test/**/*.{js,cjs,mjs,ts}\" \"benchmarks/**/*.js\"",
1011
"lint:docs": "eslint Contributing.md README.md",
1112
"lint:typings": "npx prettier --check ./typings",
1213
"lint:tests": "npx prettier --check ./test",
13-
"test": "poku --debug --include=\"test/esm,test/unit,test/integration\"",
14-
"test:bun": "poku --debug --platform=\"bun\" --include=\"test/esm,test/unit,test/integration\"",
15-
"test:deno": "deno run --allow-read --allow-env --allow-run npm:poku --debug --platform=\"deno\" --deno-allow=\"read,env,net,sys\" --deno-cjs=\".js,.cjs\" --include=\"test/esm,test/unit,test/integration\"",
14+
"test": "poku -d test/esm test/unit test/integration",
15+
"test:bun": "poku -d --bun test/esm test/unit test/integration",
16+
"test:deno": "deno run --allow-read --allow-env --allow-run npm:poku -d --deno --denoAllow=\"read,env,net,sys\" test/esm test/unit test/integration",
1617
"test:tsc-build": "cd \"test/tsc-build\" && npx tsc -p \"tsconfig.json\"",
1718
"coverage-test": "c8 npm run test",
1819
"benchmark": "node ./benchmarks/benchmark.js",

0 commit comments

Comments
 (0)