Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add package.json to node module exports #1870

Merged
merged 6 commits into from
Dec 13, 2021
Merged
Show file tree
Hide file tree
Changes from 5 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO

## [Unreleased]
### Fixed
- Add `package.json` to node module `exports`
aurelien-reeves marked this conversation as resolved.
Show resolved Hide resolved
([PR#1870](https://github.com/cucumber/cucumber-js/pull/1870)
[Issue#1869](https://github.com/cucumber/cucumber-js/issues/1869))
- Allows for parentheses in paths for developers working on cucumber's own code ([[#1735](https://github.com/cucumber/cucumber-js/issues/1735)])
- Smoother onboarding for Windows developers ([#1863](https://github.com/cucumber/cucumber-js/pull/1863))

Expand Down
24 changes: 23 additions & 1 deletion features/direct_imports.feature
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,26 @@ Feature: Core feature elements execution using direct imports
Given(/^a step passes$/, function() {});
"""
When I run cucumber-js
Then it passes
Then it passes

Scenario: we can import the version number from package.json and from the library
Given a file named "features/a.feature" with:
"""
Feature: some feature
Scenario: some scenario
Given a step checks the version number
"""
And a file named "features/step_definitions/cucumber_steps.js" with:
"""
const {Given} = require('@cucumber/cucumber')
const package_version = require('@cucumber/cucumber/package.json').version
const library_version = require('@cucumber/cucumber').version

Given(/^a step checks the version number$/, function() {
if (package_version !== library_version) {
throw new Error(`package version: ${package_version} !== library version: ${library_version}`)
}
});
"""
When I run cucumber-js
Then it passes
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@
},
"./lib/*": {
"require": "./lib/*.js"
}
},
"./package.json": "./package.json"
},
"types": "./lib/index.d.ts",
"engines": {
Expand Down