Skip to content

Commit

Permalink
Add e2e test.
Browse files Browse the repository at this point in the history
  • Loading branch information
sainthkh committed Jun 29, 2020
1 parent 0b35a9e commit c6d1d8e
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/server/__snapshots__/1_typescript_support_spec.ts.js
Expand Up @@ -242,3 +242,16 @@ exports['typescript with tsconfig run'] = `
`

exports['e2e typescript esModuleInterop: false => direct import fails 1'] = `
The plugins file is missing or invalid.
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.
Or you might have renamed the extension of your \`pluginsFile\` to \`.ts\`. If that's the case, restart the test runner.
Please fix this, or set \`pluginsFile\` to \`false\` if a plugins file is not necessary for your project.
TypeError: Cannot read property 'add' of undefined
[stack trace lines]
`
10 changes: 10 additions & 0 deletions packages/server/test/e2e/1_typescript_support_spec.ts
Expand Up @@ -44,4 +44,14 @@ describe('e2e typescript', function () {
snapshot('typescript with tsconfig run', runSummary)
})
})

it('esModuleInterop: false => direct import fails', function () {
const projPath = Fixtures.projectPath('ts-proj-esmoduleinterop-false')

return e2e.exec(this, {
project: projPath,
snapshot: true,
expectedExitCode: 1,
})
})
})
@@ -0,0 +1 @@
{}
@@ -0,0 +1,5 @@
import { add } from './math'

it('is true', () => {
expect(add(1, 2)).to.eq(3)
})
@@ -0,0 +1,3 @@
export const add = (a: number, b: number) => {
return a + b
}
@@ -0,0 +1,9 @@
/// <reference types="cypress" />

import math from './math'

math.add(1, 2)

export default (on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions) => {

}
@@ -0,0 +1,3 @@
module.exports = {
add: (a, b) => a + b,
}
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
// import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
@@ -0,0 +1,3 @@
{
"esModuleInterop": false
}

0 comments on commit c6d1d8e

Please sign in to comment.