diff --git a/cypress/integration/empty-spec.js b/cypress/integration/empty-spec.js
new file mode 100644
index 00000000..45a796fd
--- /dev/null
+++ b/cypress/integration/empty-spec.js
@@ -0,0 +1,16 @@
+///
+///
+import React from 'react'
+
+/* eslint-env mocha */
+describe('Empty div jsx', () => {
+ it('works with El', () => {
+ const El = () =>
foo
+ cy.mount()
+ })
+
+ it('works with div', () => {
+ cy.mount(I am a div
)
+ cy.contains('I am a div').should('be.visible')
+ })
+})
diff --git a/lib/getDisplayName.ts b/lib/getDisplayName.ts
index 4aa3c086..e8b6f124 100644
--- a/lib/getDisplayName.ts
+++ b/lib/getDisplayName.ts
@@ -49,4 +49,4 @@ export default function getDisplayName(type: JSX, fallbackName: string = 'Unknow
cachedDisplayNames.set(type, displayName)
return displayName
-}
\ No newline at end of file
+}
diff --git a/lib/index.ts b/lib/index.ts
index 0e8fd25e..e8d61918 100644
--- a/lib/index.ts
+++ b/lib/index.ts
@@ -108,7 +108,8 @@ Cypress.Commands.add('copyComponentStyles', component => {
**/
export const mount = (jsx: JSXElement, alias?: string) => {
// Get the display name property via the component constructor
- const displayname = getDisplayName(jsx.type, alias)
+ const jsxType = typeof jsx.type === 'string' ? jsx as unknown as JSX : jsx.type
+ const displayname = getDisplayName(jsxType, alias)
let cmd: Cypress.Log;