Skip to content

Commit

Permalink
Smoother onboarding for Windows developers (#1863)
Browse files Browse the repository at this point in the history
* Add a warning for Windows developers

The tests won't work if you don't have "Developer Mode" enabled. See #1852

Co-authored-by: Aurelien Reeves <[email protected]>

* Explain about Developer Mode in contributing guide

* Use cross-platform command for copying files

* Update changelog

* No need to npx in a node script

Co-authored-by: Aurelien Reeves <[email protected]>
  • Loading branch information
mattwynne and aurelien-reeves authored Dec 2, 2021
1 parent 26ef112 commit 49a51f9
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 4 deletions.
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)
}
91 changes: 91 additions & 0 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 && shx cp src/importer.js lib/ && shx cp src/wrapper.mjs lib/",
"cck-test": "mocha 'compatibility/**/*_spec.ts'",
"feature-test": "node ./bin/cucumber-js",
"html-formatter": "node ./bin/cucumber-js --profile htmlFormatter",
Expand Down

0 comments on commit 49a51f9

Please sign in to comment.