Skip to content

Commit

Permalink
add a test and github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjgoss committed Apr 21, 2024
1 parent 6480eb3 commit 7eb457c
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/release-github.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Release GitHub

on:
push:
branches: [release/*]

jobs:
create-github-release:
name: Create GitHub Release and Git tag
runs-on: ubuntu-latest
environment: Release
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: cucumber/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
22 changes: 22 additions & 0 deletions .github/workflows/release-npm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Release NPM

on:
push:
branches: [release/*]

jobs:
publish-npm:
name: Publish NPM module
runs-on: ubuntu-latest
environment: Release
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: package-lock.json
- run: npm install-test
- uses: cucumber/[email protected]
with:
npm-token: ${{ secrets.NPM_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: test

on:
push:
branches:
- main
- renovate/**
pull_request:
branches:
- main
workflow_call:

jobs:
test-javascript:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: package-lock.json
- run: npm install-test
30 changes: 29 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,12 @@
"license": "MIT",
"files": [
"schemas"
]
],
"devDependencies": {
"@types/node": "^20.12.7",
"jsonschema": "^1.4.1"
},
"scripts": {
"test": "node ./validation.test.mjs"
}
}
25 changes: 25 additions & 0 deletions validation.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import {equal} from 'node:assert/strict'
import {readFileSync} from 'node:fs'
import {describe, it} from 'node:test'
import {Validator} from 'jsonschema'

const FILENAMES = [
'behave.json',
'canonical.json',
'cucumber-js.json',
'cucumber-jvm.json',
'cucumber-ruby.json',
]

describe('schema validation', () => {
const validator = new Validator()

FILENAMES.forEach(filename => {
it(filename, async () => {
const schema = JSON.parse(readFileSync('./schemas/' + filename, {encoding: 'utf-8'}))
const metaSchema = await fetch(schema['$schema']).then(response => response.json())
const result = validator.validate(schema, metaSchema)
equal(result.valid, true)
})
})
})

0 comments on commit 7eb457c

Please sign in to comment.