Skip to content

Commit 1e7cfc2

Browse files
authored
Adopt core library (#83)
1 parent 8bbb682 commit 1e7cfc2

28 files changed

+119
-766
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99
### Added
1010
- Support Node.js 24 ([#67](https://github.com/cucumber/cucumber-node/pull/67))
11+
- Add `rows` and `rowsHash` methods to `DataTable` ([#83](https://github.com/cucumber/cucumber-node/pull/83))
12+
- Add support for regular expression steps ([#83](https://github.com/cucumber/cucumber-node/pull/83))
13+
14+
### Changed
15+
- BREAKING CHANGE: Rename `tagFilter` to `tags` in `HookOptions` for continuity with cucumber-js ([#83](https://github.com/cucumber/cucumber-node/pull/83))
1116

1217
### Fixed
1318
- Fully isolate Cucumber tests from other tests for accurate reporting ([#80](https://github.com/cucumber/cucumber-node/pull/80))

cucumber-node.api.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
55
```ts
66

7+
import { DataTable } from '@cucumber/core';
78
import { Promisable } from 'type-fest';
89
import { Readable } from 'node:stream';
910
import { TestContext } from 'node:test';
@@ -26,25 +27,18 @@ export function Before(fn: HookFunction): void;
2627
// @public
2728
export function Before(options: HookOptions, fn: HookFunction): void;
2829

29-
// @public
30-
export class DataTable {
31-
constructor(cells: ReadonlyArray<ReadonlyArray<string>>);
32-
hashes(): ReadonlyArray<Record<string, string>>;
33-
list(): ReadonlyArray<string>;
34-
raw(): ReadonlyArray<ReadonlyArray<string>>;
35-
transpose(): DataTable;
36-
}
30+
export { DataTable }
3731

3832
// @public
39-
export function Given(text: string, fn: StepFunction): void;
33+
export function Given(pattern: string | RegExp, fn: StepFunction): void;
4034

4135
// @public
4236
export type HookFunction = (this: World, context: TestCaseContext) => Promisable<void>;
4337

4438
// @public
4539
export type HookOptions = {
4640
name?: string;
47-
tagFilter?: string;
41+
tags?: string;
4842
};
4943

5044
// @public
@@ -75,10 +69,10 @@ export type TestCaseContext = {
7569
};
7670

7771
// @public
78-
export function Then(text: string, fn: StepFunction): void;
72+
export function Then(pattern: string | RegExp, fn: StepFunction): void;
7973

8074
// @public
81-
export function When(text: string, fn: StepFunction): void;
75+
export function When(pattern: string | RegExp, fn: StepFunction): void;
8276

8377
// @public
8478
export type World = any;

package-lock.json

Lines changed: 14 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"lib/"
1515
],
1616
"scripts": {
17-
"build": "tsc",
17+
"build": "tsc --project tsconfig.build.json",
1818
"coverage:check": "c8 --100 npm test",
1919
"coverage:report": "c8 --reporter html npm test",
2020
"docs": "typedoc",
@@ -29,19 +29,20 @@
2929
},
3030
"dependencies": {
3131
"@cucumber/ci-environment": "10.0.1",
32+
"@cucumber/core": "0.1.0",
3233
"@cucumber/cucumber-expressions": "18.0.1",
3334
"@cucumber/gherkin": "33.0.0",
3435
"@cucumber/html-formatter": "21.13.0",
3536
"@cucumber/junit-xml-formatter": "0.8.0",
3637
"@cucumber/messages": "28.0.0",
38+
"@cucumber/query": "^13.5.0",
3739
"@cucumber/tag-expressions": "6.2.0",
3840
"globby": "^14.1.0",
3941
"stack-utils": "2.0.6",
4042
"type-fest": "^4.33.0"
4143
},
4244
"devDependencies": {
4345
"@cucumber/compatibility-kit": "^18.0.3",
44-
"@cucumber/query": "^13.5.0",
4546
"@eslint/compat": "^1.2.5",
4647
"@eslint/eslintrc": "^3.2.0",
4748
"@eslint/js": "^9.18.0",

src/bootstrap/loader.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from '@cucumber/gherkin'
1313
import { Source, SourceMediaType } from '@cucumber/messages'
1414

15-
import { makeId } from '../makeId.js'
15+
import { newId } from '../newId.js'
1616

1717
export const load: LoadHook = async (url, context, nextLoad) => {
1818
if (url.endsWith('.feature.md') || url.endsWith('.feature')) {
@@ -22,7 +22,7 @@ export const load: LoadHook = async (url, context, nextLoad) => {
2222
path.extname(uri) === '.md'
2323
? SourceMediaType.TEXT_X_CUCUMBER_GHERKIN_MARKDOWN
2424
: SourceMediaType.TEXT_X_CUCUMBER_GHERKIN_PLAIN
25-
const builder = new AstBuilder(makeId)
25+
const builder = new AstBuilder(newId)
2626
const matcher =
2727
mediaType === SourceMediaType.TEXT_X_CUCUMBER_GHERKIN_MARKDOWN
2828
? new GherkinInMarkdownTokenMatcher()
@@ -37,7 +37,7 @@ export const load: LoadHook = async (url, context, nextLoad) => {
3737
uri,
3838
...parser.parse(data),
3939
}
40-
const pickles = compile(gherkinDocument, uri, makeId)
40+
const pickles = compile(gherkinDocument, uri, newId)
4141
return {
4242
format: 'module',
4343
shortCircuit: true,

src/core/AmbiguousError.spec.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/core/AmbiguousError.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/core/DataTable.spec.ts

Lines changed: 0 additions & 49 deletions
This file was deleted.

src/core/DataTable.ts

Lines changed: 0 additions & 49 deletions
This file was deleted.

src/core/SupportCodeBuilder.spec.ts

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)