-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding svelte component testing support (#23553)
Co-authored-by: Jessica Sachs <[email protected]> Co-authored-by: Rocky <[email protected]>
- Loading branch information
1 parent
8d2702f
commit f6eaad4
Showing
84 changed files
with
7,636 additions
and
373 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 |
---|---|---|
|
@@ -19,4 +19,5 @@ vue | |
vue2 | ||
react* | ||
mount-utils | ||
angular | ||
angular | ||
svelte |
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
This file was deleted.
Oops, something went wrong.
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,14 @@ | ||
import { createEntries } from '@cypress/mount-utils/create-rollup-entry.mjs' | ||
|
||
const config = { | ||
external: [ | ||
'@angular/core', | ||
'@angular/core/testing', | ||
'@angular/common', | ||
'@angular/platform-browser-dynamic/testing', | ||
'zone.js', | ||
'zone.js/testing', | ||
], | ||
} | ||
|
||
export default createEntries({ formats: ['es'], input: 'src/index.ts', 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// CommonJS to easily share across packages | ||
import ts from 'rollup-plugin-typescript2' | ||
import resolve from '@rollup/plugin-node-resolve' | ||
import commonjs from '@rollup/plugin-commonjs' | ||
import _ from 'lodash' | ||
import { readFileSync } from 'fs' | ||
|
||
const pkg = JSON.parse(readFileSync('./package.json')) | ||
|
||
/** @type {(options: { formats: string[], input: string, config: {} }) => []} */ | ||
export function createEntries (options) { | ||
const { | ||
formats, | ||
input, | ||
config = {}, | ||
} = options | ||
|
||
const banner = ` | ||
/** | ||
* ${pkg.name} v${pkg.version} | ||
* (c) ${new Date().getFullYear()} Cypress.io | ||
* Released under the MIT License | ||
*/ | ||
` | ||
|
||
return formats.map((format) => { | ||
const baseConfig = { | ||
input, | ||
plugins: [ | ||
resolve({ preferBuiltins: true }), | ||
commonjs(), | ||
ts({ | ||
check: format === 'es', | ||
tsconfigOverride: { | ||
compilerOptions: { | ||
declaration: format === 'es', | ||
target: 'es6', | ||
module: format === 'cjs' ? 'es2015' : 'esnext', | ||
}, | ||
exclude: ['tests'], | ||
}, | ||
}), | ||
], | ||
output: { | ||
banner, | ||
name: 'CypressReact', | ||
file: pkg.unpkg, | ||
format, | ||
}, | ||
} | ||
|
||
const finalConfig = _.mergeWith({}, baseConfig, config, (objValue, srcValue) => { | ||
if (_.isArray(objValue)) { | ||
return objValue.concat(srcValue) | ||
} | ||
}) | ||
|
||
if (format === 'es') { | ||
finalConfig.output.file = pkg.module | ||
} | ||
|
||
if (format === 'cjs') { | ||
finalConfig.output.file = pkg.main | ||
} | ||
|
||
// eslint-disable-next-line no-console | ||
console.log(`Building ${format}: ${finalConfig.output.file}`) | ||
|
||
return finalConfig | ||
}) | ||
} |
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 was deleted.
Oops, something went wrong.
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,18 @@ | ||
import { createEntries } from '@cypress/mount-utils/create-rollup-entry.mjs' | ||
|
||
const config = { | ||
external: [ | ||
'react', | ||
'react-dom', | ||
'react-dom/client', | ||
], | ||
output: { | ||
globals: { | ||
react: 'React', | ||
'react-dom': 'ReactDOM', | ||
'react-dom/client': 'ReactDOM/client', | ||
}, | ||
}, | ||
} | ||
|
||
export default createEntries({ formats: ['es', 'cjs'], input: 'src/index.ts', 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 was deleted.
Oops, something went wrong.
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,3 @@ | ||
import rollupConfig from '@cypress/react/rollup.config.mjs' | ||
|
||
export default rollupConfig |
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,17 @@ | ||
{ | ||
"plugins": [ | ||
"cypress" | ||
], | ||
"extends": [ | ||
"plugin:@cypress/dev/tests" | ||
], | ||
"env": { | ||
"cypress/globals": true | ||
}, | ||
"rules": { | ||
"mocha/no-global-tests": "off", | ||
"no-unused-vars": "off", | ||
"no-console": "off", | ||
"@typescript-eslint/no-unused-vars": "off" | ||
} | ||
} |
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,3 @@ | ||
save-exact=true | ||
progress=false | ||
package-lock=true |
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,7 @@ | ||
module.exports = { | ||
...require('../../.releaserc.base'), | ||
branches: [ | ||
// this one releases v3 on master on the latest channel | ||
'master', | ||
], | ||
} |
Empty file.
Oops, something went wrong.