Skip to content

Commit

Permalink
Test on ubuntu, windows and mac (#58)
Browse files Browse the repository at this point in the history
* test on ubuntu, windows and mac

* test on ubuntu, windows and mac

* trying something

* trying something

* trying something
  • Loading branch information
cjmarkham authored Sep 24, 2024
1 parent 3a14595 commit 74869e5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/gherklin.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Gherklin Linting
name: Gherklin

on:
push:
Expand All @@ -8,13 +8,11 @@ on:

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [22.x]

os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
4 changes: 3 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import path from 'node:path'
import * as fs from 'node:fs'
import { pathToFileURL } from 'node:url'

import { GherklinConfiguration } from './types'

export default class Config {
Expand All @@ -13,7 +15,7 @@ export default class Config {
if (!fs.existsSync(importPath)) {
throw new Error(`could not find gherklin.config.ts`)
}
const module = await import(importPath)
const module = await import(pathToFileURL(importPath).href)
if (!('default' in module)) {
throw new Error(`config file did not export a default function`)
}
Expand Down
3 changes: 2 additions & 1 deletion src/rule_loader.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs from 'node:fs'
import path from 'node:path'
import { pathToFileURL } from 'node:url'

import Schema from './schema'
import Rule from './rule'
Expand Down Expand Up @@ -36,7 +37,7 @@ export default class RuleLoader {
}
}

const klass = await import(location.replace('.ts', ''))
const klass = await import(pathToFileURL(location.replace('.ts', '')).href)
this.rules.push(new klass.default(rawSchema))
}

Expand Down

0 comments on commit 74869e5

Please sign in to comment.