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
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- ubuntu-latest
- macos-latest
- windows-latest
node-version: [20.x, 22.x, 24.x]
node-version: [22.x, 24.x, 26.x]
fail-fast: false

steps:
Expand All @@ -44,7 +44,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24.x
node-version: 22.x
- run: npm ci
- run: npm run build
- run: npm run coverage:check
Expand All @@ -58,7 +58,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24.x
node-version: 22.x
- run: npm ci
- run: npm run build
- run: npm run exports:check
Expand All @@ -72,6 +72,6 @@ jobs:
persist-credentials: false
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24.x
node-version: 22.x
- run: npm ci
- run: npm run docs
2 changes: 1 addition & 1 deletion .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"require": "ts-node/register",
"node-option": ["loader=ts-node/esm"],
"extension": ["ts"],
"recursive": true
}
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Changed
- BREAKING CHANGE: Switch to ESM ([#70](https://github.com/cucumber/javascript-core/pull/70))

## [0.8.3] - 2026-01-27
### Changed
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@cucumber/core",
"version": "0.8.3",
"description": "Core test case composition library for building a Cucumber implementation",
"type": "commonjs",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
Expand All @@ -17,6 +17,7 @@
"exports:update": "api-extractor run --verbose --local",
"fix": "biome check --fix --error-on-warnings",
"lint": "biome check --error-on-warnings",
"postbuild": "node -e \"require('.')\"",
"test": "mocha \"src/**/*.spec.ts\"",
"prepublishOnly": "npm run build"
},
Expand Down
4 changes: 2 additions & 2 deletions src/AmbiguousError.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import type { PickleStep, SourceReference } from '@cucumber/messages'
import { expect } from 'chai'
import sinon from 'sinon'

import { AmbiguousError } from './AmbiguousError'
import type { AmbiguousStep, DefinedStep } from './types'
import { AmbiguousError } from './AmbiguousError.js'
import type { AmbiguousStep, DefinedStep } from './types.js'

describe('AmbiguousError', () => {
it('handles source references with and without locations', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/AmbiguousError.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { AmbiguousStep } from './types'
import type { AmbiguousStep } from './types.js'

/**
* Represents an error that occurs when multiple step definitions are found matching the text of a step
Expand Down
4 changes: 2 additions & 2 deletions src/DataTable.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import type { PickleTable } from '@cucumber/messages'
import { expect } from 'chai'
import { describe, it } from 'mocha'

import { parseGherkin } from '../test/parseGherkin'
import { DataTable } from './DataTable'
import { parseGherkin } from '../test/parseGherkin.js'
import { DataTable } from './DataTable.js'

describe('DataTable', () => {
describe('raw', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/SupportCodeBuilderImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import { HookType, StepDefinitionPatternType } from '@cucumber/messages'
import parse from '@cucumber/tag-expressions'

import { SupportCodeLibraryImpl } from './SupportCodeLibraryImpl'
import { SupportCodeLibraryImpl } from './SupportCodeLibraryImpl.js'
import type {
DefinedParameterType,
DefinedStep,
Expand All @@ -19,7 +19,7 @@ import type {
NewTestRunHook,
SupportCodeBuilder,
UndefinedParameterType,
} from './types'
} from './types.js'

type Registered<T> = { id: string; order: number } & T

Expand Down
2 changes: 1 addition & 1 deletion src/SupportCodeLibraryImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {
MatchedStep,
SupportCodeLibrary,
UndefinedParameterType,
} from './types'
} from './types.js'

type OrderedEnvelope = {
order: number
Expand Down
4 changes: 2 additions & 2 deletions src/UndefinedError.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { PickleStep, Snippet } from '@cucumber/messages'
import { expect } from 'chai'

import type { UndefinedStep } from './types'
import { UndefinedError } from './UndefinedError'
import type { UndefinedStep } from './types.js'
import { UndefinedError } from './UndefinedError.js'

describe('UndefinedError', () => {
it('should create an error message with the step text', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/UndefinedError.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Snippet } from '@cucumber/messages'

import type { UndefinedStep } from './types'
import type { UndefinedStep } from './types.js'

/**
* Represents an error that occurs when no step definitions are found matching the text of a step
Expand Down
4 changes: 2 additions & 2 deletions src/buildSupportCode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
import { expect } from 'chai'
import sinon from 'sinon'

import { buildSupportCode } from './buildSupportCode'
import type { SupportCodeLibrary } from './types'
import { buildSupportCode } from './buildSupportCode.js'
import type { SupportCodeLibrary } from './types.js'

describe('buildSupportCode', () => {
let newId: () => string
Expand Down
4 changes: 2 additions & 2 deletions src/buildSupportCode.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IdGenerator } from '@cucumber/messages'

import { SupportCodeBuilderImpl } from './SupportCodeBuilderImpl'
import type { SupportCodeBuilder, SupportCodeOptions } from './types'
import { SupportCodeBuilderImpl } from './SupportCodeBuilderImpl.js'
import type { SupportCodeBuilder, SupportCodeOptions } from './types.js'

/**
* Start building up a library user-defined support code
Expand Down
12 changes: 6 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export * from './AmbiguousError'
export * from './buildSupportCode'
export * from './DataTable'
export * from './makeTestPlan'
export * from './types'
export * from './UndefinedError'
export * from './AmbiguousError.js'
export * from './buildSupportCode.js'
export * from './DataTable.js'
export * from './makeTestPlan.js'
export * from './types.js'
export * from './UndefinedError.js'
6 changes: 3 additions & 3 deletions src/makeTestPlan.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { expect, use } from 'chai'
import sinon from 'sinon'
import sinonChai from 'sinon-chai'

import { parseGherkin } from '../test/parseGherkin'
import { buildSupportCode } from './buildSupportCode'
import { makeTestPlan } from './makeTestPlan'
import { parseGherkin } from '../test/parseGherkin.js'
import { buildSupportCode } from './buildSupportCode.js'
import { makeTestPlan } from './makeTestPlan.js'

use(sinonChai)

Expand Down
2 changes: 1 addition & 1 deletion src/makeTestPlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import type {
SupportCodeLibrary,
TestPlanIngredients,
TestPlanOptions,
} from './types'
} from './types.js'

/**
* Make an executable test plan for a Gherkin document
Expand Down
4 changes: 3 additions & 1 deletion test/parseGherkin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ export function parseGherkin(
file: string,
newId: () => string = IdGenerator.uuid()
): { gherkinDocument: GherkinDocument; pickles: ReadonlyArray<Pickle> } {
const data = fs.readFileSync(path.join(__dirname, '..', 'testdata', file), { encoding: 'utf-8' })
const data = fs.readFileSync(path.join(import.meta.dirname, '..', 'testdata', file), {
encoding: 'utf-8',
})
const builder = new AstBuilder(newId)
const matcher = new GherkinClassicTokenMatcher()
const parser = new Parser(builder, matcher)
Expand Down
Loading