Skip to content
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
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,42 @@ jobs:
env:
NODE_OPTIONS: no-network-family-autoselection

test-browser:
name: Test browser compatibility
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
browser: ['chromium', 'firefox', 'webkit']
exclude:
- os: ubuntu-latest
browser: webkit
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: package.json
check-latest: true

- name: Install dependencies
run: |
npm install --ignore-scripts

- if: ${{ matrix.os == 'windows-latest' }}
run: npx playwright install winldd

- name: Run browser tests
run: |
npm run test:browser:${{ matrix.browser }}

test:
needs:
- test-regression-check-node10
Expand Down
30 changes: 0 additions & 30 deletions lib/scopedChars.js

This file was deleted.

26 changes: 25 additions & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
'use strict'

const { HEX } = require('./scopedChars')
const HEX = /** @type {const} */ ({
0: 0,
1: 1,
2: 2,
3: 3,
4: 4,
5: 5,
6: 6,
7: 7,
8: 8,
9: 9,
a: 10,
A: 10,
b: 11,
B: 11,
c: 12,
C: 12,
d: 13,
D: 13,
e: 14,
E: 14,
f: 15,
F: 15
})

const IPV4_REG = /^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u

/** @type {(value: string) => boolean} */
const isIPv4 = RegExp.prototype.test.bind(IPV4_REG)

/**
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
"lint": "eslint",
"lint:fix": "eslint --fix",
"test": "npm run test:unit && npm run test:typescript",
"test:browser:chromium": "playwright-test ./test/* --runner tape --browser=chromium",
"test:browser:firefox": "playwright-test ./test/* --runner tape --browser=firefox",
"test:browser:webkit": "playwright-test ./test/* --runner tape --browser=webkit",
"test:browser": "npm run test:browser:chromium && npm run test:browser:firefox && npm run test:browser:webkit",
"test:unit": "tape test/**/*.js",
"test:unit:dev": "npm run test:unit -- --coverage-report=html",
"test:typescript": "tsd"
Expand All @@ -58,6 +62,7 @@
"ajv": "^8.16.0",
"eslint": "^9.17.0",
"neostandard": "^0.12.0",
"playwright-test": "^14.1.12",
"tape": "^5.8.1",
"tsd": "^0.32.0"
}
Expand Down
10 changes: 7 additions & 3 deletions test/ajv.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
'use strict'

const test = require('tape')
const fastURI = require('..')

const AJV = require('ajv')
const fastUri = require('../')

const ajv = new AJV({
uriResolver: fastUri // comment this line to see it works with uri-js
uriResolver: fastURI // comment this line to see it works with uri-js
})
const test = require('tape')

test('ajv', t => {
t.plan(1)
Expand Down
4 changes: 2 additions & 2 deletions test/equal.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict'

const test = require('tape')
const URI = require('../')
const fastURI = require('..')

const fn = URI.equal
const fn = fastURI.equal
const runTest = (t, suite) => {
suite.forEach(s => {
const operator = s.result ? '==' : '!='
Expand Down
Loading
Loading