Skip to content

fix: Deno v2 requires commonjs type explicitly #3209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 56 additions & 2 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,66 @@ jobs:
run: bun run test:bun
timeout-minutes: 1

tests-linux-deno:
tests-linux-deno-v1:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
deno-version: [v1.x, v2.x, canary]
deno-version: [v1.x]
mysql-version: ['mysql:8.0.33']
use-compression: [0, 1]
# TODO: investigate error when using SSL (1)
#
# errno: -4094
# code: "UNKNOWN"
# syscall: "read"
use-tls: [0]

name: Deno ${{ matrix.deno-version }} - DB ${{ matrix.mysql-version }} - SSL=${{matrix.use-tls}} Compression=${{matrix.use-compression}}

steps:
- uses: actions/checkout@v4
- name: Set up MySQL
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 }}

- name: Set up Deno ${{ matrix.deno-version }}
uses: denoland/setup-deno@v1
with:
deno-version: ${{ matrix.deno-version }}

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: npm-linux-${{ hashFiles('package-lock.json') }}
restore-keys: npm-linux-

- name: Install npm dependencies
run: npm ci

- name: Wait mysql server is ready
run: node tools/wait-up.js

- name: run tests
env:
MYSQL_USER: ${{ env.MYSQL_USER }}
MYSQL_DATABASE: ${{ env.MYSQL_DATABASE }}
MYSQL_PORT: ${{ env.MYSQL_PORT }}
MYSQL_USE_COMPRESSION: ${{ matrix.use-compression }}
MYSQL_USE_TLS: ${{ matrix.use-tls }}
run: deno task test:deno -- --denoCjs='.js,.cjs'
timeout-minutes: 5

tests-linux-deno-v2:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
deno-version: [v2.x, canary]
mysql-version: ['mysql:8.0.33']
use-compression: [0, 1]
# TODO: investigate error when using SSL (1)
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
"description": "fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS",
"main": "index.js",
"typings": "typings/mysql/index",
"type": "commonjs",
"scripts": {
"lint": "npm run lint:docs && npm run lint:code",
"lint:code": "eslint index.js promise.js index.d.ts promise.d.ts \"typings/**/*.ts\" \"lib/**/*.js\" \"test/**/*.{js,cjs,mjs,ts}\" \"benchmarks/**/*.js\"",
"lint:docs": "eslint Contributing.md README.md",
"lint:typings": "npx prettier --check ./typings",
"lint:tests": "npx prettier --check ./test",
"test": "poku --debug --include=\"test/esm,test/unit,test/integration\"",
"test:bun": "poku --debug --platform=\"bun\" --include=\"test/esm,test/unit,test/integration\"",
"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\"",
"test": "poku -d test/esm test/unit test/integration",
"test:bun": "poku -d --bun test/esm test/unit test/integration",
"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",
"test:tsc-build": "cd \"test/tsc-build\" && npx tsc -p \"tsconfig.json\"",
"coverage-test": "c8 npm run test",
"benchmark": "node ./benchmarks/benchmark.js",
Expand Down
Loading