Skip to content

Commit

Permalink
fix: Remove esModuleInterop default from ts-node (#7808)
Browse files Browse the repository at this point in the history
* Remove esModuleInterop from ts-node.

* Add e2e test.

* Fix test.
Change test name.
Add comment.

* Fix test snapshot name.

* update snapshotting

Co-authored-by: Chris Breiding <chrisbreiding@gmail.com>
  • Loading branch information
sainthkh and chrisbreiding committed Aug 3, 2020
1 parent 8d95773 commit 55e97a1
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 261 deletions.
259 changes: 0 additions & 259 deletions packages/server/__snapshots__/1_typescript_support_spec.ts.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/server/lib/util/ts-node.js
Expand Up @@ -7,7 +7,6 @@ const getTsNodeOptions = (tsPath) => {
compiler: tsPath, // use the user's installed typescript
compilerOptions: {
module: 'CommonJS',
esModuleInterop: true,
},
transpileOnly: true, // transpile only (no type-check) for speed
}
Expand Down
7 changes: 7 additions & 0 deletions packages/server/test/e2e/1_typescript_plugins_spec.ts
Expand Up @@ -9,4 +9,11 @@ describe('e2e typescript in plugins file', function () {
project: Fixtures.projectPath('ts-proj-with-module-esnext'),
})
})

// https://github.com/cypress-io/cypress/issues/7575
it('allows esModuleInterop to be overridden', function () {
return e2e.exec(this, {
project: Fixtures.projectPath('ts-proj-esmoduleinterop-false'),
})
})
})
@@ -0,0 +1 @@
{}
@@ -0,0 +1,3 @@
it('dummy', () => {
expect(1 + 1).to.eq(2)
})
@@ -0,0 +1 @@
module.exports = (a, b) => a + b
@@ -0,0 +1,13 @@
/// <reference types="cypress" />

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

add(1, 2)

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

}
@@ -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,5 @@
{
"compilerOptions": {
"esModuleInterop": false
}
}
1 change: 0 additions & 1 deletion packages/server/test/unit/project_spec.js
Expand Up @@ -354,7 +354,6 @@ This option will not have an effect in Some-other-name. Tests that rely on web s
compiler: projTsPath,
compilerOptions: {
module: 'CommonJS',
esModuleInterop: true,
},
})
})
Expand Down

0 comments on commit 55e97a1

Please sign in to comment.