-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Open in IDE button for block and hook definitions in Runner UI (…
…#30859) * init vitest unit test harness for @packages/driver * unit tests with stack examples * drop lines until __cypress/tests rather than just __cypress * changelog * changelog * remove vitest globals (unnecessary) from driver tsconfig * bump the number of junit reports expected from the unit tests job * fix ts-check error in scroll.ts * fix type definition for getInvocationDetails * rm packageManager key on package.json * remove junit reporter, as script that verifies result does not recognize it as valid * change @ts-expect-error to @ts-ignore for .scroll, as this ts check is apparently flaky * set expected mocha result back to 19 * add ct style stacks for cy in cy ct tests * re-enable junit reporter, update mocha result verification to be more lenient about the order of xml fields * persist binaries for this branch * expect 20 junit reports again * fix mocha v vitest verification? * add binary system test to verify correct file paths for codepoints in protocol events * fix invocation details system test filename * add required config for binary tests * build on darwin to fix binary system tests * build linux-arm64 for this branch * simplify binary test * build windows binary * rm binary system test * Update cli/CHANGELOG.md
- Loading branch information
1 parent
249cfde
commit 0532f92
Showing
12 changed files
with
541 additions
and
44 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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
43 changes: 43 additions & 0 deletions
43
packages/driver/test/unit/cypress/__fixtures__/spec_stackframes.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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,68 @@ | ||
/** | ||
* @vitest-environment jsdom | ||
*/ | ||
import { vi, describe, it, expect, beforeEach } from 'vitest' | ||
|
||
import source_map_utils from '../../../src/cypress/source_map_utils' | ||
import stack_utils from '../../../src/cypress/stack_utils' | ||
import stackFrameFixture from './__fixtures__/spec_stackframes.json' | ||
|
||
vi.mock('../../../src/cypress/source_map_utils', () => { | ||
return { | ||
default: { | ||
getSourcePosition: vi.fn(), | ||
}, | ||
} | ||
}) | ||
|
||
describe('stack_utils', () => { | ||
beforeEach(() => { | ||
// @ts-expect-error | ||
global.Cypress = { | ||
config: vi.fn(), | ||
} | ||
|
||
vi.resetAllMocks() | ||
}) | ||
|
||
describe('getInvocationDetails', () => { | ||
const { line, column, scenarios } = stackFrameFixture | ||
|
||
const projectRoot = '/foo/bar' | ||
|
||
let stack: string | ||
|
||
class MockError { | ||
get stack () { | ||
return stack | ||
} | ||
} | ||
const config = () => projectRoot | ||
|
||
for (const scenario of scenarios) { | ||
const { browser, build, specFrame, stack: scenarioStack } = scenario | ||
|
||
describe(`${browser}:${build}`, () => { | ||
beforeEach(() => { | ||
stack = scenarioStack | ||
}) | ||
|
||
it('calls getSourcePosition with the correct file, line, and column', () => { | ||
stack_utils.getInvocationDetails( | ||
{ Error: MockError, Cypress: {} }, | ||
config, | ||
) | ||
|
||
// getSourcePosition is not called directly from getInvocationDetails, but via: | ||
// - getSourceDetailsForFirstLine | ||
// - getSourceDetailsForLine | ||
expect(source_map_utils.getSourcePosition).toHaveBeenCalledWith(specFrame, expect.objectContaining({ | ||
column, | ||
line, | ||
file: specFrame, | ||
})) | ||
}) | ||
}) | ||
} | ||
}) | ||
}) |
This file contains 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 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 @@ | ||
import { defineConfig } from 'vitest/config' | ||
|
||
export default defineConfig({ | ||
test: { | ||
include: ['test/unit/**/*.spec.ts'], | ||
environment: 'jsdom', | ||
exclude: ['**/__fixtures__/**/*'], | ||
reporters: [ | ||
'default', | ||
['junit', { suiteName: 'Driver Unit Tests', outputFile: '/tmp/cypress/junit/driver-test-results.xml' }], | ||
], | ||
}, | ||
}) |
This file contains 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 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
Oops, something went wrong.
0532f92
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
linux x64
version of the Test Runner.Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version
Run this command to install the pre-release locally:
0532f92
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
linux arm64
version of the Test Runner.Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version
Run this command to install the pre-release locally:
0532f92
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
darwin arm64
version of the Test Runner.Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version
Run this command to install the pre-release locally:
0532f92
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
win32 x64
version of the Test Runner.Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version
Run this command to install the pre-release locally:
0532f92
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
darwin x64
version of the Test Runner.Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version
Run this command to install the pre-release locally: