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
81 changes: 81 additions & 0 deletions .github/vitest.browserstack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import { resolve } from 'node:path'
import { env } from 'node:process'
import { defineConfig } from 'vitest/config'
import { playwright } from '@vitest/browser-playwright'

const bsDefaults = {
project: env.BROWSERSTACK_PROJECT_NAME,
build: process.env.BROWSERSTACK_BUILD_NAME,
'browserstack.idleTimeout': 600,
'browserstack.local': 'true',
'browserstack.localIdentifier': env.BROWSERSTACK_LOCAL_IDENTIFIER,
'browserstack.username': env.BROWSERSTACK_USERNAME,
'browserstack.accessKey': env.BROWSERSTACK_ACCESS_KEY || env.BROWSERSTACK_KEY
}

const bsProvider = opts =>
playwright({
connectOptions: {
wsEndpoint: `wss://cdp.browserstack.com/playwright?caps=${encodeURIComponent(
JSON.stringify({ ...bsDefaults, ...opts })
)}`
}
})

export default defineConfig({
test: {
alias: [
{
find: /^yaml/,
customResolver(path) {
const name = path.split('/')[1] ?? 'index'
return resolve(import.meta.dirname, '..', 'dist', `${name}.js`)
}
}
],
api: { host: '0.0.0.0' },
browser: {
enabled: true,
provider: playwright(),
connectTimeout: 120_000,
instances: [
{
name: 'Chrome Old',
browser: 'chromium',
provider: bsProvider({ browser: 'chrome', browser_version: '93' })
},
{
name: 'Chrome New',
browser: 'chromium',
provider: bsProvider({ browser: 'chrome', browser_version: 'latest' })
},
{
name: 'Firefox Old',
browser: 'chromium',
provider: bsProvider({
browser: 'playwright-firefox',
browser_version: '94'
})
},
{
name: 'Firefox New',
browser: 'chromium',
provider: bsProvider({
browser: 'playwright-firefox',
browser_version: 'latest'
})
}
]
},
globals: true,
include: ['tests/**/*.{js,ts}'],
exclude: [
'tests/_*',
'tests/artifacts/',
'tests/json-test-suite/',
'tests/json-test-suite.ts',
'tests/yaml-test-suite.ts',
'tests/cli.ts'
]
}
})
20 changes: 5 additions & 15 deletions .github/workflows/browsers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with: { submodules: true }
- uses: actions/setup-node@v4
with: { node-version: 20 }
- uses: actions/setup-node@v6
- uses: browserstack/github-actions/setup-env@master
with:
username: ${{ secrets.BROWSERSTACK_USERNAME }}
Expand All @@ -26,18 +25,9 @@ jobs:
local-identifier: random

- run: npm ci
- run: npm run build:browser
- name: Playground setup
working-directory: ./playground
run: npm ci
- name: Playground build
working-directory: ./playground
run: npm run build
- run: npx http-server site &
working-directory: ./playground

- run: npx browserstack-node-sdk jest
working-directory: ./playground
- run: npm run build
- run: npm install --no-save @vitest/browser-playwright@4
- run: npx vitest run --config=.github/vitest.browserstack.config.js

- uses: browserstack/github-actions/setup-local@master
if: always()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deno.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ jobs:
- uses: denoland/setup-deno@v2
with:
deno-version: ${{ matrix.deno-version }}
- run: deno src/public-api.ts
- run: deno --allow-env src/public-api.ts
60 changes: 1 addition & 59 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [18, 20, latest]
node-version: [20.19.0, 22.12.0, 24.0.0, latest]
Copy link

@silverwind silverwind Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend to continue using major version specifiers like [20, 22, 24, latest] because that's more representative to what most users will be running.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 20.19.0, 22.12.0, 24.0.0 are meant to catch violations of the minimum supported versions, which are specifically these.

In my experience, latest is the best target for catching issues due to Node.js changes; I've not seen any issues caused by fixes backported to older major versions, which is what 20, 22, 24 would catch.

Copy link

@silverwind silverwind Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, yeah those stable branches are indeed generally very stable, so seems like a fine approach.

steps:
- uses: actions/checkout@v4
with: { submodules: true }
Expand All @@ -33,63 +33,5 @@ jobs:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with: { node-version: 20 }
- run: npm ci
- run: npm run lint

node-16:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['16.0.0', '16']
steps:
- uses: actions/checkout@v4
with: { submodules: true }
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm install --no-save rollup@3
- run: npm test
- run: npm run test:dist

node-14-build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['14.18.0']
steps:
- uses: actions/checkout@v4
with: { submodules: true }
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install --global npm@7
- run: npm ci
- run: npm install --no-save rollup@2
- run: npm run test:dist
- uses: actions/upload-artifact@v4
with:
name: yaml-node14
path: dist/
node-14-run:
needs: node-14-build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['14.6.0', '14', '15.0.0']
steps:
- uses: actions/checkout@v4
with: { submodules: true }
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install --global npm@7
- run: npm ci
- uses: actions/download-artifact@v4
with:
name: yaml-node14
path: dist/
- run: npx jest --config config/jest.config.js
env:
TEST: dist
13 changes: 2 additions & 11 deletions .github/workflows/typescript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,9 @@ jobs:
uses: actions/setup-node@v4
with: { node-version: 20 }
- run: npm ci
- run: npm run build:node
- run: npm run build
- run: npm run test:types
- run: npm run test:dist:types

- run: npm install --no-save @types/node@14 typescript@4.2
- run: for d in node_modules/@types/*; do [[ $d == *node ]] || rm -r $d; done
- run: npm run test:dist:types

- run: npm install --no-save @types/node@14 typescript@4.0
- run: for d in node_modules/@types/*; do [[ $d == *node ]] || rm -r $d; done
- run: npm run test:dist:types

- run: npm install --no-save @types/node@14 typescript@3.9
- run: for d in node_modules/@types/*; do [[ $d == *node ]] || rm -r $d; done
- run: npm install --no-save @types/node@20.19.0 typescript@5.9.2
- run: npm run test:dist:types
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
[submodule "docs"]
path = docs-slate
url = https://github.com/eemeli/yaml-docs.git
[submodule "playground"]
path = playground
url = https://github.com/eemeli/yaml-playground.git
[submodule "tests/json-test-suite"]
path = tests/json-test-suite
url = https://github.com/nst/JSONTestSuite.git
Expand Down
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ coverage/
dist/
node_modules/
/docs-slate/
/playground/
/tests/json-test-suite/
/tests/yaml-test-suite/
Loading
Loading