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

Smoother onboarding for Windows developers #1863

Merged
merged 5 commits into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO
## [Unreleased]
### Fixed
- 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))

## [8.0.0-rc.1] - 2021-10-19
### Added
Expand Down
12 changes: 10 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@ If anything in this guide or anywhere else in the codebase doesn't make sense to

You can chat with us in the [#committers-js](https://cucumberbdd.slack.com/archives/C612KCP1P) channel in our [Community Slack], or feel free to [raise an issue] if you're experiencing any friction trying make your contribution.

## Setup
## Local setup

To get a local development environment, use [Git] to [fork and clone] the repo, then:

* If you're running Windows, make sure to enable [Developer Mode].
* install [Node.Js](https://nodejs.org/en/)
* `npm install` - Install dependencies
* `npm test` - Compile typescript and run the tests

If everything passes, you're ready to hack! ⛏

## Tests

Now type `npm run` or see the `package.json` scripts section for how to run each category of tests.
Type `npm run` or see the `package.json` scripts section for how to run each category of tests.

* lint - `npm run lint`
* [prettier](https://github.com/prettier/prettier)
Expand Down Expand Up @@ -67,3 +72,6 @@ The runtime emits events with an [EventEmitter](https://nodejs.org/api/events.ht

[Community Slack]: https://cucumber.io/community#slack
[raise an issue]: https://github.com/cucumber/cucumber-js/issues/new/choose
[Developer Mode]: https://docs.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging
[fork and clone]: https://docs.github.com/en/get-started/quickstart/fork-a-repo
[Git]: https://docs.github.com/en/get-started/quickstart/set-up-git
7 changes: 6 additions & 1 deletion features/support/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import tmp from 'tmp'
import { doesHaveValue } from '../../src/value_checker'
import { World } from './world'
import { ITestCaseHookParameter } from '../../src/support_code_library_builder/types'
import { warnUserAboutEnablingDeveloperMode } from './warn_user_about_enabling_developer_mode'

const projectPath = path.join(__dirname, '..', '..')

Expand Down Expand Up @@ -39,7 +40,11 @@ Before(function (
'@cucumber',
'cucumber'
)
fsExtra.ensureSymlinkSync(projectPath, tmpDirCucumberPath)
try {
fsExtra.ensureSymlinkSync(projectPath, tmpDirCucumberPath)
} catch (error) {
warnUserAboutEnablingDeveloperMode(error)
}
this.localExecutablePath = path.join(projectPath, 'bin', 'cucumber-js')
})

Expand Down
25 changes: 25 additions & 0 deletions features/support/warn_user_about_enabling_developer_mode.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { reindent } from 'reindent-template-literals'
import colors from 'colors/safe'

export function warnUserAboutEnablingDeveloperMode(error: any): void {
if (!(error?.code === 'EPERM')) {
throw error
}
if (!(process.platform === 'win32')) {
throw error
}

console.error(
colors.red(
reindent(`
Error: Unable to run feature tests!

You need to enable Developer Mode in Windows to run Cucumber JS's feature tests.

See this link for more info:
https://docs.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging
`)
)
)
process.exit(1)
}
89 changes: 85 additions & 4 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@
"prettier": "2.5.0",
"reindent-template-literals": "1.1.0",
"semver": "7.3.5",
"shx": "^0.3.3",
"sinon": "12.0.1",
"sinon-chai": "3.7.0",
"stream-buffers": "3.0.2",
Expand All @@ -266,7 +267,7 @@
"typescript": "4.5.2"
},
"scripts": {
"build-local": "tsc --build tsconfig.node.json && cp src/importer.js lib/ && cp src/wrapper.mjs lib/",
"build-local": "tsc --build tsconfig.node.json && npx shx cp src/importer.js lib/ && npx shx cp src/wrapper.mjs lib/",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the npx prefix is not required as part of npm scripts

"cck-test": "mocha 'compatibility/**/*_spec.ts'",
"feature-test": "node ./bin/cucumber-js",
"html-formatter": "node ./bin/cucumber-js --profile htmlFormatter",
Expand Down