Skip to content

Commit 80f8e6d

Browse files
committed
Fix test.
Change test name. Add comment.
1 parent b599e92 commit 80f8e6d

File tree

8 files changed

+66
-22
lines changed

8 files changed

+66
-22
lines changed

packages/server/__snapshots__/1_typescript_support_spec.ts.js

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -243,15 +243,60 @@ exports['typescript with tsconfig run'] = `
243243
244244
`
245245

246-
exports['e2e typescript esModuleInterop: false => direct import fails 1'] = `
247-
The plugins file is missing or invalid.
246+
exports['e2e typescript esModuleInterop: false => only \'import * as\' works. 1'] = `
248247
249-
Your \`pluginsFile\` is set to \`/foo/bar/.projects/ts-proj-esmoduleinterop-false/cypress/plugins/index.ts\`, but either the file is missing, it contains a syntax error, or threw an error when required. The \`pluginsFile\` must be a \`.js\` or \`.coffee\` file.
248+
====================================================================================================
249+
250+
(Run Starting)
251+
252+
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
253+
│ Cypress: 1.2.3 │
254+
│ Browser: FooBrowser 88 │
255+
│ Specs: 1 found (app_spec.ts) │
256+
└────────────────────────────────────────────────────────────────────────────────────────────────┘
257+
258+
259+
────────────────────────────────────────────────────────────────────────────────────────────────────
260+
261+
Running: app_spec.ts (1 of 1)
262+
263+
264+
✓ dummy
265+
266+
1 passing
267+
268+
269+
(Results)
270+
271+
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
272+
│ Tests: 1 │
273+
│ Passing: 1 │
274+
│ Failing: 0 │
275+
│ Pending: 0 │
276+
│ Skipped: 0 │
277+
│ Screenshots: 0 │
278+
│ Video: true │
279+
│ Duration: X seconds │
280+
│ Spec Ran: app_spec.ts │
281+
└────────────────────────────────────────────────────────────────────────────────────────────────┘
282+
283+
284+
(Video)
285+
286+
- Started processing: Compressing to 32 CRF
287+
- Finished processing: /XXX/XXX/XXX/cypress/videos/app_spec.ts.mp4 (X second)
288+
289+
290+
====================================================================================================
291+
292+
(Run Finished)
250293
251-
Or you might have renamed the extension of your \`pluginsFile\` to \`.ts\`. If that's the case, restart the test runner.
252294
253-
Please fix this, or set \`pluginsFile\` to \`false\` if a plugins file is not necessary for your project.
295+
Spec Tests Passing Failing Pending Skipped
296+
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
297+
│ ✔ app_spec.ts XX:XX 1 1 - - - │
298+
└────────────────────────────────────────────────────────────────────────────────────────────────┘
299+
✔ All specs passed! XX:XX 1 1 - - -
300+
254301
255-
TypeError: Cannot read property 'add' of undefined
256-
[stack trace lines]
257302
`

packages/server/test/e2e/1_typescript_support_spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ describe('e2e typescript', function () {
4545
})
4646
})
4747

48-
it('esModuleInterop: false => direct import fails', function () {
48+
// https://github.com/cypress-io/cypress/issues/7575
49+
it(`tests if esModuleInterop can be overridden`, function () {
4950
const projPath = Fixtures.projectPath('ts-proj-esmoduleinterop-false')
5051

5152
return e2e.exec(this, {
5253
project: projPath,
5354
snapshot: true,
54-
expectedExitCode: 1,
5555
})
5656
})
5757
})
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { add } from './math'
2-
3-
it('is true', () => {
4-
expect(add(1, 2)).to.eq(3)
1+
it('dummy', () => {
2+
expect(1 + 1).to.eq(2)
53
})

packages/server/test/support/fixtures/projects/ts-proj-esmoduleinterop-false/cypress/integration/math.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = (a, b) => a + b
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
/// <reference types="cypress" />
22

3-
import math from './math'
3+
// https://github.com/cypress-io/cypress/issues/7575
4+
// It is tested here because Cypress spec files and support/plugin files use different TypeScript settings.
5+
// And we want to test if esModuleInterop can be overriden in support/plugin files.
6+
import * as add from './add'
47

5-
math.add(1, 2)
8+
add(1, 2)
69

10+
// Default Cypress plugin function
711
export default (on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions) => {
812

913
}

packages/server/test/support/fixtures/projects/ts-proj-esmoduleinterop-false/cypress/plugins/math.js

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"esModuleInterop": false
2+
"compilerOptions": {
3+
"esModuleInterop": false
4+
}
35
}

0 commit comments

Comments
 (0)