Skip to content

Commit 49a51f9

Browse files
Smoother onboarding for Windows developers (#1863)
* 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]>
1 parent 26ef112 commit 49a51f9

File tree

6 files changed

+135
-4
lines changed

6 files changed

+135
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO
1010
## [Unreleased]
1111
### Fixed
1212
- Allows for parentheses in paths for developers working on cucumber's own code ([[#1735](https://github.com/cucumber/cucumber-js/issues/1735)])
13+
- Smoother onboarding for Windows developers ([#1863](https://github.com/cucumber/cucumber-js/pull/1863))
1314

1415
## [8.0.0-rc.1] - 2021-10-19
1516
### Added

CONTRIBUTING.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,20 @@ If anything in this guide or anywhere else in the codebase doesn't make sense to
99

1010
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.
1111

12-
## Setup
12+
## Local setup
1313

14+
To get a local development environment, use [Git] to [fork and clone] the repo, then:
15+
16+
* If you're running Windows, make sure to enable [Developer Mode].
1417
* install [Node.Js](https://nodejs.org/en/)
1518
* `npm install` - Install dependencies
1619
* `npm test` - Compile typescript and run the tests
1720

21+
If everything passes, you're ready to hack! ⛏
22+
1823
## Tests
1924

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

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

6873
[Community Slack]: https://cucumber.io/community#slack
6974
[raise an issue]: https://github.com/cucumber/cucumber-js/issues/new/choose
75+
[Developer Mode]: https://docs.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging
76+
[fork and clone]: https://docs.github.com/en/get-started/quickstart/fork-a-repo
77+
[Git]: https://docs.github.com/en/get-started/quickstart/set-up-git

features/support/hooks.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import tmp from 'tmp'
66
import { doesHaveValue } from '../../src/value_checker'
77
import { World } from './world'
88
import { ITestCaseHookParameter } from '../../src/support_code_library_builder/types'
9+
import { warnUserAboutEnablingDeveloperMode } from './warn_user_about_enabling_developer_mode'
910

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

@@ -39,7 +40,11 @@ Before(function (
3940
'@cucumber',
4041
'cucumber'
4142
)
42-
fsExtra.ensureSymlinkSync(projectPath, tmpDirCucumberPath)
43+
try {
44+
fsExtra.ensureSymlinkSync(projectPath, tmpDirCucumberPath)
45+
} catch (error) {
46+
warnUserAboutEnablingDeveloperMode(error)
47+
}
4348
this.localExecutablePath = path.join(projectPath, 'bin', 'cucumber-js')
4449
})
4550

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { reindent } from 'reindent-template-literals'
2+
import colors from 'colors/safe'
3+
4+
export function warnUserAboutEnablingDeveloperMode(error: any): void {
5+
if (!(error?.code === 'EPERM')) {
6+
throw error
7+
}
8+
if (!(process.platform === 'win32')) {
9+
throw error
10+
}
11+
12+
console.error(
13+
colors.red(
14+
reindent(`
15+
Error: Unable to run feature tests!
16+
17+
You need to enable Developer Mode in Windows to run Cucumber JS's feature tests.
18+
19+
See this link for more info:
20+
https://docs.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging
21+
`)
22+
)
23+
)
24+
process.exit(1)
25+
}

package-lock.json

Lines changed: 91 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@
257257
"prettier": "2.5.0",
258258
"reindent-template-literals": "1.1.0",
259259
"semver": "7.3.5",
260+
"shx": "^0.3.3",
260261
"sinon": "12.0.1",
261262
"sinon-chai": "3.7.0",
262263
"stream-buffers": "3.0.2",
@@ -266,7 +267,7 @@
266267
"typescript": "4.5.2"
267268
},
268269
"scripts": {
269-
"build-local": "tsc --build tsconfig.node.json && cp src/importer.js lib/ && cp src/wrapper.mjs lib/",
270+
"build-local": "tsc --build tsconfig.node.json && shx cp src/importer.js lib/ && shx cp src/wrapper.mjs lib/",
270271
"cck-test": "mocha 'compatibility/**/*_spec.ts'",
271272
"feature-test": "node ./bin/cucumber-js",
272273
"html-formatter": "node ./bin/cucumber-js --profile htmlFormatter",

0 commit comments

Comments
 (0)