-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: deliver webpack-dev-server new architecture * fix: make vite-dev-server work * fix: deliver react and vite-dev-server * fix: deliver the vue2 package too * fix: rollback react changes published to next
- Loading branch information
Barthélémy Ledoux
authored
Mar 10, 2021
1 parent
261b0b9
commit 5fd91bd
Showing
28 changed files
with
330 additions
and
113 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import React from 'react' | ||
|
||
export const Foo: React.FC = () => { | ||
return <div>Hello world!!!!</div> | ||
} |
13 changes: 13 additions & 0 deletions
13
npm/vite-dev-server/cypress/components/react-no-jsx.spec.jsx
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 React from 'react' | ||
import { mount } from '@cypress/react' | ||
|
||
const Comp = () => { | ||
return <div>Hello world!</div> | ||
} | ||
|
||
describe('React', () => { | ||
it('renders a react component', () => { | ||
mount(<Comp />) | ||
cy.get('div').contains('Hello world') | ||
}) | ||
}) |
13 changes: 13 additions & 0 deletions
13
npm/vite-dev-server/cypress/components/react-no-jsx.spec.ts
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 React from 'react' | ||
import { mount } from '@cypress/react' | ||
|
||
const Comp = () => { | ||
return React.createElement('div', {}, 'Hello world') | ||
} | ||
|
||
describe('React', () => { | ||
it('renders a react component', () => { | ||
mount(React.createElement(Comp)) | ||
cy.get('div').contains('Hello world') | ||
}) | ||
}) |
25 changes: 25 additions & 0 deletions
25
npm/vite-dev-server/cypress/components/react-no-jsx.spec.tsx
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,25 @@ | ||
import React from 'react' | ||
import { mount } from '@cypress/react' | ||
import { Foo } from './Foo' | ||
|
||
describe('React', () => { | ||
it('renders a react component #1', () => { | ||
mount(<Foo />) | ||
cy.get('div').contains('Hello world') | ||
}) | ||
|
||
it('renders a react component #2', () => { | ||
mount(<Foo />) | ||
cy.get('div').contains('Hello world') | ||
}) | ||
|
||
it('renders a react component #3', () => { | ||
mount(<Foo />) | ||
cy.get('div').contains('Hello world') | ||
}) | ||
|
||
it('renders a react component #4', () => { | ||
mount(<Foo />) | ||
cy.get('div').contains('Hello world') | ||
}) | ||
}) |
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,5 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "[email protected]", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
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 |
---|---|---|
@@ -1,9 +1,7 @@ | ||
import { startDevServer } from '@cypress/vite-dev-server' | ||
|
||
module.exports = (on, config) => { | ||
on('dev-server:start', async (options) => { | ||
return startDevServer({ options }) | ||
}) | ||
on('dev-server:start', async (options) => startDevServer({ options })) | ||
|
||
return config | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cypress/videos |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import ts from 'rollup-plugin-typescript2' | ||
import resolve from '@rollup/plugin-node-resolve' | ||
import commonjs from '@rollup/plugin-commonjs' | ||
|
||
import pkg from './package.json' | ||
|
||
const banner = ` | ||
/** | ||
* ${pkg.name} v${pkg.version} | ||
* (c) ${new Date().getFullYear()} Cypress.io | ||
* Released under the MIT License | ||
*/ | ||
` | ||
|
||
function createEntry (options) { | ||
const { | ||
format, | ||
input, | ||
isBrowser, | ||
} = options | ||
|
||
const config = { | ||
input, | ||
external: [ | ||
'vue', | ||
'@vue/test-utils', | ||
'@cypress/webpack-dev-server', | ||
], | ||
plugins: [ | ||
resolve({ preferBuiltins: true }), commonjs(), | ||
], | ||
output: { | ||
banner, | ||
name: 'CypressVue', | ||
file: pkg.unpkg, | ||
format, | ||
globals: { | ||
vue: 'Vue', | ||
'@vue/test-utils': 'VueTestUtils', | ||
}, | ||
exports: 'auto', | ||
}, | ||
} | ||
|
||
if (input === 'src/index.ts') { | ||
if (format === 'es') { | ||
config.output.file = pkg.module | ||
if (isBrowser) { | ||
config.output.file = pkg.unpkg | ||
} | ||
} | ||
|
||
if (format === 'cjs') { | ||
config.output.file = pkg.main | ||
} | ||
} else { | ||
config.output.file = input.replace(/^src\//, 'dist/') | ||
} | ||
|
||
console.log(`Building ${format}: ${config.output.file}`) | ||
|
||
config.plugins.push( | ||
ts({ | ||
check: format === 'es' && isBrowser, | ||
tsconfigOverride: { | ||
compilerOptions: { | ||
declaration: format === 'es', | ||
target: 'es5', // not sure what this should be? | ||
module: format === 'cjs' ? 'es2015' : 'esnext', | ||
}, | ||
exclude: ['tests'], | ||
}, | ||
}), | ||
) | ||
|
||
return config | ||
} | ||
|
||
export default [ | ||
createEntry({ format: 'es', input: 'src/index.ts', isBrowser: false }), | ||
createEntry({ format: 'es', input: 'src/index.ts', isBrowser: true }), | ||
createEntry({ format: 'iife', input: 'src/index.ts', isBrowser: true }), | ||
createEntry({ format: 'cjs', input: 'src/index.ts', isBrowser: false }), | ||
createEntry({ format: 'cjs', input: 'src/support.js', isBrowser: false }), | ||
createEntry({ format: 'cjs', input: 'src/plugins/webpack/index.js', isBrowser: false }), | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export const ROOT_ID = '__cy_root' | ||
|
||
/** Initialize an empty document with root element | ||
* This only needs for experimentalComponentTesting | ||
*/ | ||
export function renderTestingPlatform (headInnerHTML: string) { | ||
// @ts-expect-error no idea | ||
const document = cy.state('document') | ||
|
||
if (document.body) document.body.innerHTML = '' | ||
|
||
if (document.head) document.head.innerHTML = headInnerHTML | ||
|
||
const rootNode = document.createElement('div') | ||
|
||
rootNode.setAttribute('id', ROOT_ID) | ||
document.getElementsByTagName('body')[0].prepend(rootNode) | ||
|
||
return rootNode | ||
} |
Oops, something went wrong.