Skip to content

Commit 5893a02

Browse files
committed
Merge branch 'fix/use-cjs-extension-for-diagnose-output'
2 parents d2c2d5c + d163f6d commit 5893a02

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

features/diagnostics.feature

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,32 @@ Feature: diagnostics
186186
- 'a step' (cypress/support/step_definitions/steps.js:2)
187187
- /a step/ (cypress/support/step_definitions/steps.js:3)
188188
"""
189+
190+
Scenario: module package
191+
Given a file named "package.json" with:
192+
"""
193+
{
194+
"type": "module"
195+
}
196+
"""
197+
And a file named "cypress/e2e/a.feature" with:
198+
"""
199+
Feature: a feature name
200+
Scenario: a scenario name
201+
Given a step
202+
"""
203+
And a file named "cypress/support/step_definitions/steps.js" with:
204+
"""
205+
import { Given } from "@badeball/cypress-cucumber-preprocessor";
206+
Given("a step", function() {});
207+
"""
208+
When I run diagnostics
209+
Then the output should contain
210+
"""
211+
┌────────────────┬─────────────────────────────────────────────┐
212+
│ Pattern / Text │ Location │
213+
├────────────────┼─────────────────────────────────────────────┤
214+
│ 'a step' │ cypress/support/step_definitions/steps.js:2 │
215+
│ a step │ cypress/e2e/a.feature:3 │
216+
└────────────────┴─────────────────────────────────────────────┘
217+
"""

lib/diagnostics/diagnose.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export async function diagnose(configuration: {
122122

123123
const outputFileName = path.join(
124124
configuration.cypress.projectRoot,
125-
".output-" + randomPart + ".js"
125+
".output-" + randomPart + ".cjs"
126126
);
127127

128128
let registry: Registry;
@@ -150,7 +150,7 @@ export async function diagnose(configuration: {
150150
}
151151

152152
throw new Error(
153-
`Failed to compile steø definitions of ${testFile}, with errors shown above...`
153+
`Failed to compile step definitions of ${testFile}, with errors shown above...`
154154
);
155155
}
156156

0 commit comments

Comments
 (0)