-
-
Notifications
You must be signed in to change notification settings - Fork 758
fix(typescript): map included .ts files in step output #5685
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
luantaraschi
wants to merge
5
commits into
codeceptjs:4.x
Choose a base branch
from
luantaraschi:fix/ts-include-step-paths
base: 4.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
44cb8b7
fix(typescript): map included .ts files in step output
luantaraschi 5927927
fix(typescript): normalize included step source paths
luantaraschi bca1d6b
test(typescript): cover explicit tsx esm step paths
luantaraschi 8c5112d
Merge branch '4.x' into fix/ts-include-step-paths
kobenguyent 34e961c
Merge branch '4.x' into fix/ts-include-step-paths
kobenguyent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| export const config = { | ||
| tests: './tests/*Test.ts', | ||
| helpers: { | ||
| FakeHelper: { | ||
| require: './fakeHelper.js', | ||
| }, | ||
| }, | ||
| include: { | ||
| fooPage: './pages/fooPage.ts', | ||
| }, | ||
| require: ['tsx/cjs'], | ||
| name: 'typescript-step-paths', | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import { config as baseConfig } from './codecept.conf.js' | ||
|
|
||
| export const config = { | ||
| ...baseConfig, | ||
| require: ['tsx/esm'], | ||
| name: 'typescript-step-paths-esm', | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import Helper from 'codeceptjs/lib/helper' | ||
|
|
||
| export default class FakeHelper extends Helper { | ||
| doThing(label) { | ||
| return label | ||
| } | ||
|
|
||
| failNow(message) { | ||
| throw new Error(message) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| export {} | ||
|
|
||
| const { I } = inject() | ||
|
|
||
| export default { | ||
| open() { | ||
| I.doThing('from page') | ||
| }, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| Feature('TypeScript step paths') | ||
|
|
||
| Scenario('shows original paths', ({ I, fooPage }) => { | ||
| fooPage.open() | ||
| I.failNow('boom') | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import { execFile } from 'child_process' | ||
| import { expect } from 'expect' | ||
| import path from 'path' | ||
| import { fileURLToPath } from 'url' | ||
|
|
||
| const __filename = fileURLToPath(import.meta.url) | ||
| const __dirname = path.dirname(__filename) | ||
| const runner = path.join(__dirname, '../../bin/codecept.js') | ||
| const codeceptDir = path.join(__dirname, '../data/sandbox/typescript-step-paths') | ||
|
|
||
| describe('TypeScript step paths', () => { | ||
| for (const configFile of ['codecept.conf.js', 'codecept.esm.conf.js']) { | ||
| it(`maps included page object steps back to their source file with ${configFile}`, done => { | ||
| execFile( | ||
| process.execPath, | ||
| [runner, 'run', '--config', path.join(codeceptDir, configFile)], | ||
| { cwd: codeceptDir, env: { ...process.env, FORCE_COLOR: '0' } }, | ||
| (err, stdout) => { | ||
| try { | ||
| expect(err).toBeTruthy() | ||
| expect(stdout).toContain('Scenario Steps:') | ||
| expect(stdout).toMatch(/at Object\.open \(\.\/pages\/fooPage\.ts:\d+:\d+\)/) | ||
| expect(stdout).not.toContain('.temp.mjs') | ||
| expect(stdout).not.toContain('file://./pages/fooPage.ts') | ||
| done() | ||
| } catch (error) { | ||
| done(error) | ||
| } | ||
| }, | ||
| ) | ||
| }) | ||
| } | ||
| }) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.