Skip to content

Commit

Permalink
Add a warning for Windows developers
Browse files Browse the repository at this point in the history
The tests won't work if you don't have "Developer Mode" enabled. See #1852

Co-authored-by: Aurelien Reeves <aurelien.reeves@smartbear.com>
  • Loading branch information
mattwynne and aurelien-reeves committed Dec 1, 2021
1 parent 26ef112 commit 526cc81
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
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)
}

0 comments on commit 526cc81

Please sign in to comment.