mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-25 01:49:06 -05:00
fix(webpack-preprocessor): update webpack preprocessor for monorepo (#8666)
* update webpack preprocessor for monorepo
This commit is contained in:
@@ -28,6 +28,9 @@ packages/server/lib/scaffold/support/commands.js
|
||||
packages/server/test/support/fixtures/projects/e2e/cypress/integration/stdout_exit_early_failing_spec.js
|
||||
packages/server/test/support/fixtures/projects/e2e/cypress/integration/typescript_syntax_error_spec.ts
|
||||
|
||||
npm/webpack-preprocessor/cypress/tests/e2e/compile-error.js
|
||||
npm/webpack-preprocessor/examples/use-babelrc/cypress/integration/spec.js
|
||||
|
||||
**/.projects
|
||||
**/*.d.ts
|
||||
**/package-lock.json
|
||||
|
||||
+62
-1
@@ -207,7 +207,6 @@ commands:
|
||||
description: Post GitHub comment with a blurb on how to install pre-release version
|
||||
steps:
|
||||
- run: ls -la
|
||||
# make sure JSON files with uploaded urls are present
|
||||
- run: ls -la binary-url.json npm-package-url.json
|
||||
- run: cat binary-url.json
|
||||
- run: cat npm-package-url.json
|
||||
@@ -996,6 +995,56 @@ jobs:
|
||||
command: node index.js
|
||||
working_directory: packages/launcher
|
||||
|
||||
npm-webpack-preprocessor:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: ~/
|
||||
- run:
|
||||
name: Build
|
||||
command: yarn workspace @cypress/webpack-preprocessor build
|
||||
- run:
|
||||
name: Run tests
|
||||
command: yarn workspace @cypress/webpack-preprocessor test
|
||||
- run:
|
||||
name: Test babelrc
|
||||
command: yarn test
|
||||
working_directory: npm/webpack-preprocessor/examples/use-babelrc
|
||||
- run:
|
||||
name: Build ts-loader
|
||||
command: yarn install
|
||||
working_directory: npm/webpack-preprocessor/examples/use-ts-loader
|
||||
- run:
|
||||
name: Types ts-loader
|
||||
command: yarn types
|
||||
working_directory: npm/webpack-preprocessor/examples/use-ts-loader
|
||||
- run:
|
||||
name: Test ts-loader
|
||||
command: yarn test
|
||||
working_directory: npm/webpack-preprocessor/examples/use-ts-loader
|
||||
- run:
|
||||
name: Start React app
|
||||
command: yarn start
|
||||
background: true
|
||||
working_directory: npm/webpack-preprocessor/examples/react-app
|
||||
- run:
|
||||
name: Test React app
|
||||
command: yarn test
|
||||
working_directory: npm/webpack-preprocessor/examples/react-app
|
||||
- store-npm-logs
|
||||
|
||||
npm-webpack-preprocessor-release:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: ~/
|
||||
- run:
|
||||
name: Build
|
||||
command: yarn workspace @cypress/webpack-preprocessor build
|
||||
- run:
|
||||
name: Release
|
||||
command: yarn semantic-release @cypress/webpack-preprocessor
|
||||
|
||||
build-binary:
|
||||
<<: *defaults
|
||||
shell: /bin/bash --login
|
||||
@@ -1772,6 +1821,18 @@ linux-workflow: &linux-workflow
|
||||
requires:
|
||||
- build
|
||||
|
||||
- npm-webpack-preprocessor:
|
||||
requires:
|
||||
- build
|
||||
- npm-webpack-preprocessor-release:
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
requires:
|
||||
- build
|
||||
- npm-webpack-preprocessor
|
||||
|
||||
# various testing scenarios, like building full binary
|
||||
# and testing it on a real project
|
||||
- test-against-staging:
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
!.*
|
||||
**/node_modules
|
||||
test/_test-output
|
||||
cypress/tests/e2e/compile-error.js
|
||||
test/fixtures
|
||||
examples/react-app/src
|
||||
examples/react-app/node_modules
|
||||
examples/react-app/build
|
||||
examples/react-app/package.json
|
||||
examples/react-app/cypress/integration/dynamic-import-spec.js
|
||||
# contains nullish operator
|
||||
examples/use-babelrc/cypress/integration/spec.js
|
||||
dist
|
||||
tsconfig.json
|
||||
.vscode/
|
||||
.history
|
||||
@@ -1 +0,0 @@
|
||||
12.8.1
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"standard.enable": false,
|
||||
"eslint.enable": true,
|
||||
"eslint.validate": ["json"],
|
||||
"git.ignoreLimitWarning": true
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
# Cypress Webpack Preprocessor [](https://circleci.com/gh/cypress-io/cypress-webpack-preprocessor) [![semantic-release][semantic-image] ][semantic-url]
|
||||
# Cypress Webpack Preprocessor
|
||||
|
||||
Cypress preprocessor for bundling JavaScript via webpack
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ exports['webpack preprocessor - e2e correctly preprocesses the file 1'] = `
|
||||
exports['webpack preprocessor - e2e has less verbose syntax error 1'] = `
|
||||
Webpack Compilation Error
|
||||
.<path>/_test-output/syntax_error_spec.js
|
||||
Module build failed (from ./node_modules/babel-loader/lib/index.js):
|
||||
Module build failed (from /[root]/node_modules/babel-loader/lib/index.js):
|
||||
SyntaxError: <path>/_test-output/syntax_error_spec.js: Unexpected token (1:18)
|
||||
|
||||
[0m[31m[1m>[22m[39m[90m 1 | [39mdescribe([32m'fail'[39m[33m,[39m [33m-[39m[33m>[39m)[0m
|
||||
|
||||
@@ -24,7 +24,7 @@ The error was:
|
||||
|
||||
Error: Webpack Compilation Error
|
||||
./cypress/tests/e2e/compile-error.js
|
||||
Module build failed (from ./node_modules/babel-loader/lib/index.js):
|
||||
Module build failed (from /[root]/node_modules/babel-loader/lib/index.js):
|
||||
SyntaxError: /[cwd]/cypress/tests/e2e/compile-error.js: Unexpected token, expected "," (14:27)
|
||||
|
||||
12 |
|
||||
@@ -34,6 +34,7 @@ SyntaxError: /[cwd]/cypress/tests/e2e/compile-error.js: Unexpected token, expect
|
||||
15 | })
|
||||
16 |
|
||||
|
||||
|
||||
This occurred while Cypress was compiling and bundling your test code. This is usually caused by:
|
||||
|
||||
- A missing file or dependency
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
# based on https://github.com/cypress-io/circleci-orb/blob/master/docs/recipes.md
|
||||
version: 2.1
|
||||
orbs:
|
||||
cypress: cypress-io/cypress@1
|
||||
workflows:
|
||||
build:
|
||||
jobs:
|
||||
# first, run a single job to install dependencies and Cypress
|
||||
# and perform a few more small steps like linting
|
||||
- cypress/install:
|
||||
name: Install
|
||||
executor: cypress/base-12-14-0
|
||||
yarn: true
|
||||
build: npm run build
|
||||
post-steps:
|
||||
- run:
|
||||
name: Show info 📺
|
||||
command: npx cypress info
|
||||
|
||||
- cypress/run:
|
||||
name: Tests
|
||||
requires:
|
||||
- Install
|
||||
executor: cypress/base-12-14-0
|
||||
install-command: echo 'Nothing else to install in this job'
|
||||
command: npm test
|
||||
no-workspace: true
|
||||
post-steps:
|
||||
- run:
|
||||
name: Lint code 🧹
|
||||
command: npm run lint
|
||||
- run:
|
||||
name: Install latest webpack 📦
|
||||
command: yarn add -D webpack@latest webpack-cli@latest
|
||||
- run:
|
||||
name: Run tests w/ webpack@latest 🧪
|
||||
command: npm test
|
||||
|
||||
- cypress/run:
|
||||
name: Test React App
|
||||
requires:
|
||||
- Install
|
||||
executor: cypress/base-12-14-0
|
||||
install-command: echo 'Nothing else to install in this job'
|
||||
timeout: '1m'
|
||||
start: npm start
|
||||
no-workspace: true
|
||||
working_directory: examples/react-app
|
||||
|
||||
- cypress/run:
|
||||
name: Test babelrc
|
||||
requires:
|
||||
- Install
|
||||
executor: cypress/base-12-14-0
|
||||
install-command: echo 'Nothing else to install in this job'
|
||||
timeout: '1m'
|
||||
no-workspace: true
|
||||
working_directory: examples/use-babelrc
|
||||
|
||||
- cypress/run:
|
||||
name: Test ts-loader
|
||||
requires:
|
||||
- Install
|
||||
executor: cypress/base-12-14-0
|
||||
# we still need to install local TypeScript and Cypress
|
||||
install-command: npm install
|
||||
# not really a build command, just TS check
|
||||
build: npm run types
|
||||
timeout: '1m'
|
||||
no-workspace: true
|
||||
working_directory: examples/use-ts-loader
|
||||
|
||||
# wait for all jobs to finish and possible run NPM release
|
||||
- cypress/run:
|
||||
name: NPM release
|
||||
# only run NPM release from specific branch(es)
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
requires:
|
||||
- Install
|
||||
- Tests
|
||||
- Test React App
|
||||
- Test babelrc
|
||||
- Test ts-loader
|
||||
executor: cypress/base-12-14-0
|
||||
# nothing to install - cypress/install job does it
|
||||
# and nothing to pass to the next job
|
||||
install-command: echo 'Nothing else to install in this job'
|
||||
no-workspace: true
|
||||
# instead of "cypress run" do NPM release 😁
|
||||
command: npm run semantic-release
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"env": {
|
||||
"cypress/globals": true
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:cypress/recommended",
|
||||
"plugin:@cypress/dev/react"
|
||||
],
|
||||
"plugins": [
|
||||
"cypress"
|
||||
],
|
||||
"rules": {
|
||||
"react/jsx-filename-extension": [
|
||||
"warn",
|
||||
{
|
||||
"extensions": [
|
||||
".js",
|
||||
".jsx",
|
||||
".tsx"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -4,6 +4,6 @@ describe('Dynamic import', () => {
|
||||
// dynamically import module
|
||||
// and then invoke an exported method "reverse"
|
||||
cy.wrap(import('../utils'))
|
||||
.invoke('reverse', 'Hello').should('equal', 'olleH')
|
||||
.invoke('reverse', 'Hello').should('equal', 'olleH')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
"private": true,
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "../../node_modules/.bin/react-scripts start",
|
||||
"test": "../../node_modules/.bin/cypress run",
|
||||
"cy:open": "../../node_modules/.bin/cypress open --dev",
|
||||
"dev": "../../node_modules/.bin/start-test 3000 cy:open",
|
||||
"cy:open": "../../node_modules/.bin/cypress open"
|
||||
"start": "../../node_modules/.bin/react-scripts start",
|
||||
"test": "../../node_modules/.bin/cypress run --dev"
|
||||
},
|
||||
"license": "ISC",
|
||||
"author": "",
|
||||
|
||||
+62
-53
@@ -1,12 +1,13 @@
|
||||
import React, { useState } from "react";
|
||||
import "./App.css";
|
||||
import React, { useState } from 'react'
|
||||
import './App.css'
|
||||
|
||||
export function Todo({ todo, index, toggleTodo, removeTodo }) {
|
||||
export function Todo ({ todo, index, toggleTodo, removeTodo }) {
|
||||
const toggleText = todo.isCompleted ? 'Redo' : 'Complete'
|
||||
|
||||
return (
|
||||
<div
|
||||
className="todo"
|
||||
style={{ textDecoration: todo.isCompleted ? "line-through" : "" }}
|
||||
style={{ textDecoration: todo.isCompleted ? 'line-through' : '' }}
|
||||
>
|
||||
{todo.text}
|
||||
|
||||
@@ -15,18 +16,19 @@ export function Todo({ todo, index, toggleTodo, removeTodo }) {
|
||||
<button data-cy="remove" onClick={() => removeTodo(index)}>x</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
function TodoForm({ addTodo }) {
|
||||
const [value, setValue] = useState("");
|
||||
function TodoForm ({ addTodo }) {
|
||||
const [value, setValue] = useState('')
|
||||
|
||||
const handleSubmit = e => {
|
||||
e.preventDefault();
|
||||
if (!value) return;
|
||||
addTodo(value);
|
||||
setValue("");
|
||||
};
|
||||
const handleSubmit = (e) => {
|
||||
e.preventDefault()
|
||||
if (!value) return
|
||||
|
||||
addTodo(value)
|
||||
setValue('')
|
||||
}
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit}>
|
||||
@@ -34,73 +36,80 @@ function TodoForm({ addTodo }) {
|
||||
type="text"
|
||||
className="input"
|
||||
value={value}
|
||||
onChange={e => setValue(e.target.value)}
|
||||
onChange={(e) => setValue(e.target.value)}
|
||||
/>
|
||||
</form>
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
export const toggleOneTodo = (todos, index) => {
|
||||
const newTodos = [...todos];
|
||||
const newTodos = [...todos]
|
||||
const todoToFlip = newTodos[index]
|
||||
if (todoToFlip) {
|
||||
todoToFlip.isCompleted = !todoToFlip.isCompleted;
|
||||
}
|
||||
return newTodos
|
||||
};
|
||||
|
||||
function App() {
|
||||
if (todoToFlip) {
|
||||
todoToFlip.isCompleted = !todoToFlip.isCompleted
|
||||
}
|
||||
|
||||
return newTodos
|
||||
}
|
||||
|
||||
function App () {
|
||||
const [todos, setTodos] = useState([
|
||||
{
|
||||
text: "Learn about React",
|
||||
isCompleted: false
|
||||
text: 'Learn about React',
|
||||
isCompleted: false,
|
||||
},
|
||||
{
|
||||
text: "Meet friend for lunch",
|
||||
isCompleted: false
|
||||
text: 'Meet friend for lunch',
|
||||
isCompleted: false,
|
||||
},
|
||||
{
|
||||
text: "Build really cool todo app",
|
||||
isCompleted: false
|
||||
}
|
||||
]);
|
||||
text: 'Build really cool todo app',
|
||||
isCompleted: false,
|
||||
},
|
||||
])
|
||||
|
||||
if (window.Cypress) {
|
||||
window.todos = todos
|
||||
}
|
||||
|
||||
const addTodo = text => {
|
||||
const newTodos = [...todos, { text }];
|
||||
setTodos(newTodos);
|
||||
};
|
||||
const addTodo = (text) => {
|
||||
const newTodos = [...todos, { text }]
|
||||
|
||||
const toggleTodo = index => {
|
||||
setTodos(newTodos)
|
||||
}
|
||||
|
||||
const toggleTodo = (index) => {
|
||||
const newTodos = toggleOneTodo(todos, index)
|
||||
setTodos(newTodos);
|
||||
};
|
||||
|
||||
const removeTodo = index => {
|
||||
const newTodos = [...todos];
|
||||
newTodos.splice(index, 1);
|
||||
setTodos(newTodos);
|
||||
};
|
||||
setTodos(newTodos)
|
||||
}
|
||||
|
||||
const removeTodo = (index) => {
|
||||
const newTodos = [...todos]
|
||||
|
||||
newTodos.splice(index, 1)
|
||||
setTodos(newTodos)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="app">
|
||||
<div className="todo-list">
|
||||
{todos.map((todo, index) => (
|
||||
<Todo
|
||||
key={index}
|
||||
index={index}
|
||||
todo={todo}
|
||||
toggleTodo={toggleTodo}
|
||||
removeTodo={removeTodo}
|
||||
/>
|
||||
))}
|
||||
{todos.map((todo, index) => {
|
||||
return (
|
||||
<Todo
|
||||
key={index}
|
||||
index={index}
|
||||
todo={todo}
|
||||
toggleTodo={toggleTodo}
|
||||
removeTodo={removeTodo}
|
||||
/>
|
||||
)
|
||||
})}
|
||||
<TodoForm addTodo={addTodo} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
export default App;
|
||||
export default App
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
import App, {toggleOneTodo} from "./App";
|
||||
import {mount} from 'cypress-react-unit-test'
|
||||
import React from 'react'
|
||||
import App, { toggleOneTodo } from './App'
|
||||
import { mount } from 'cypress-react-unit-test'
|
||||
|
||||
describe('App', () => {
|
||||
beforeEach(() => {
|
||||
@@ -8,9 +8,9 @@ describe('App', () => {
|
||||
<App />,
|
||||
{
|
||||
stylesheets: [
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.css'
|
||||
]
|
||||
}
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.css',
|
||||
],
|
||||
},
|
||||
)
|
||||
})
|
||||
|
||||
@@ -18,64 +18,66 @@ describe('App', () => {
|
||||
cy.get('.todo').should('have.length', 3)
|
||||
cy.get('input.input').type('Test with Cypress{enter}')
|
||||
cy.get('.todo').should('have.length', 4)
|
||||
.contains('Meet friend for lunch')
|
||||
.find('[data-cy=remove]').click()
|
||||
|
||||
.contains('Meet friend for lunch')
|
||||
.find('[data-cy=remove]').click()
|
||||
|
||||
cy.get('.todo').should('have.length', 3)
|
||||
})
|
||||
|
||||
it('toggles correctly', () => {
|
||||
const todos = [{
|
||||
isCompleted: false
|
||||
isCompleted: false,
|
||||
}, {
|
||||
isCompleted: false
|
||||
isCompleted: false,
|
||||
}, {
|
||||
isCompleted: false
|
||||
isCompleted: false,
|
||||
}]
|
||||
const newTodos = toggleOneTodo(todos, 2)
|
||||
|
||||
expect(newTodos).to.deep.equal([{
|
||||
isCompleted: false
|
||||
}, {
|
||||
isCompleted: false
|
||||
}, {
|
||||
isCompleted: true
|
||||
}])
|
||||
isCompleted: false,
|
||||
}, {
|
||||
isCompleted: false,
|
||||
}, {
|
||||
isCompleted: true,
|
||||
}])
|
||||
})
|
||||
|
||||
it('ignores invalid index', () => {
|
||||
const todos = [{
|
||||
isCompleted: false
|
||||
isCompleted: false,
|
||||
}, {
|
||||
isCompleted: false
|
||||
isCompleted: false,
|
||||
}, {
|
||||
isCompleted: false
|
||||
isCompleted: false,
|
||||
}]
|
||||
const newTodos = toggleOneTodo(todos, 20)
|
||||
|
||||
expect(newTodos).to.deep.equal(todos)
|
||||
})
|
||||
|
||||
it('toggles an item', () => {
|
||||
cy.get('.todo').should('have.length', 3)
|
||||
.contains('Learn about React')
|
||||
.contains('button', 'Complete').click()
|
||||
cy.contains('Learn about React')
|
||||
.should('have.css', 'text-decoration',
|
||||
'line-through solid rgb(74, 74, 74)')
|
||||
.then(() => {
|
||||
cy.wrap(window.todos[0]).should('deep.equal', {
|
||||
text: 'Learn about React',
|
||||
isCompleted: true
|
||||
})
|
||||
})
|
||||
.contains('Learn about React')
|
||||
.contains('button', 'Complete').click()
|
||||
|
||||
cy.contains('Learn about React')
|
||||
.contains('button', 'Redo').click()
|
||||
.then(() => {
|
||||
cy.wrap(window.todos[0]).should('deep.equal', {
|
||||
text: 'Learn about React',
|
||||
isCompleted: false
|
||||
})
|
||||
.should('have.css', 'text-decoration',
|
||||
'line-through solid rgb(74, 74, 74)')
|
||||
.then(() => {
|
||||
cy.wrap(window.todos[0]).should('deep.equal', {
|
||||
text: 'Learn about React',
|
||||
isCompleted: true,
|
||||
})
|
||||
})
|
||||
|
||||
cy.contains('Learn about React')
|
||||
.contains('button', 'Redo').click()
|
||||
.then(() => {
|
||||
cy.wrap(window.todos[0]).should('deep.equal', {
|
||||
text: 'Learn about React',
|
||||
isCompleted: false,
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,55 +1,61 @@
|
||||
import React from "react";
|
||||
import {Todo} from "./App";
|
||||
import {mount} from 'cypress-react-unit-test'
|
||||
import React from 'react'
|
||||
import { Todo } from './App'
|
||||
import { mount } from 'cypress-react-unit-test'
|
||||
|
||||
describe('Todo', () => {
|
||||
it('renders new item', () => {
|
||||
const todo = {
|
||||
text: 'test item',
|
||||
isCompleted: false
|
||||
isCompleted: false,
|
||||
}
|
||||
|
||||
mount(
|
||||
<Todo todo={todo} />,
|
||||
{
|
||||
stylesheets: [
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.css'
|
||||
]
|
||||
}
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.css',
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
cy.contains('.todo button', 'Complete')
|
||||
})
|
||||
|
||||
it('renders with styles', () => {
|
||||
const todo = {
|
||||
text: 'test item',
|
||||
isCompleted: false
|
||||
isCompleted: false,
|
||||
}
|
||||
const TestTodo = () => <div className="app"><Todo todo={todo} /></div>
|
||||
|
||||
mount(
|
||||
<TestTodo />,
|
||||
{
|
||||
stylesheets: [
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.css'
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.css',
|
||||
],
|
||||
cssFile: 'src/App.css'
|
||||
}
|
||||
cssFile: 'src/App.css',
|
||||
},
|
||||
)
|
||||
|
||||
cy.contains('.todo button', 'Complete')
|
||||
})
|
||||
|
||||
it('renders completed item', () => {
|
||||
const todo = {
|
||||
text: 'test item',
|
||||
isCompleted: true
|
||||
isCompleted: true,
|
||||
}
|
||||
|
||||
mount(
|
||||
<Todo todo={todo} />,
|
||||
{
|
||||
stylesheets: [
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.css'
|
||||
]
|
||||
}
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.css',
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
cy.contains('.todo button', 'Redo')
|
||||
})
|
||||
|
||||
@@ -64,12 +70,14 @@ describe('Todo', () => {
|
||||
<Todo todo={todo} index={123} removeTodo={removeTodo} />,
|
||||
{
|
||||
stylesheets: [
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.css'
|
||||
]
|
||||
}
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.css',
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
cy.contains('.todo', 'test item')
|
||||
.find('[data-cy="remove"]').click()
|
||||
.find('[data-cy="remove"]').click()
|
||||
|
||||
cy.get('@remove').should('have.been.calledWith', 123)
|
||||
})
|
||||
|
||||
@@ -79,16 +87,19 @@ describe('Todo', () => {
|
||||
isCompleted: false,
|
||||
}
|
||||
const toggleTodo = cy.stub().as('toggle')
|
||||
|
||||
mount(
|
||||
<Todo todo={todo} index={123} toggleTodo={toggleTodo} />,
|
||||
{
|
||||
stylesheets: [
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.css'
|
||||
]
|
||||
}
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.css',
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
cy.contains('.todo', 'test item')
|
||||
.contains('Complete').click()
|
||||
.contains('Complete').click()
|
||||
|
||||
cy.get('@toggle').should('have.been.calledWith', 123)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import App from "./App";
|
||||
import React from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import App from './App'
|
||||
|
||||
ReactDOM.render(<App />, document.getElementById("root"));
|
||||
ReactDOM.render(<App />, document.getElementById('root'))
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
"description": "Transpiling specs using local .babelrc file",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"cy:open": "../../node_modules/.bin/cypress open",
|
||||
"test": "../../node_modules/.bin/cypress run"
|
||||
"cy:open": "../../node_modules/.bin/cypress open --dev",
|
||||
"test": "../../node_modules/.bin/cypress run --dev"
|
||||
},
|
||||
"license": "ISC",
|
||||
"author": "",
|
||||
|
||||
@@ -4,12 +4,11 @@
|
||||
"description": "Transpiling specs using local .babelrc file",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"cy:open": "cypress open",
|
||||
"test": "cypress run",
|
||||
"cy:open": "../../node_modules/.bin/cypress open --dev",
|
||||
"test": "../../node_modules/.bin/cypress run --dev",
|
||||
"types": "tsc --noEmit --lib es2015,dom --types cypress cypress/integration/*.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"cypress": "4.5.0",
|
||||
"ts-loader": "7.0.4",
|
||||
"typescript": "3.9.2"
|
||||
},
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
<!-- Want a bug fixed quickly? Please provide a repository to reproduce the issue. -->
|
||||
|
||||
- Operating System:
|
||||
- Cypress Version:
|
||||
- Browser Version:
|
||||
|
||||
### Is this a Feature or Bug?
|
||||
|
||||
|
||||
### Current behavior:
|
||||
|
||||
|
||||
### Desired behavior:
|
||||
|
||||
|
||||
### How to reproduce:
|
||||
|
||||
|
||||
### Additional Info (images, stack traces, etc)
|
||||
@@ -9,8 +9,6 @@
|
||||
"build": "rm -rf dist && tsc",
|
||||
"deps": "deps-ok && dependency-check --no-dev .",
|
||||
"license": "license-checker --production --onlyunknown --csv",
|
||||
"lint": "eslint --ext .js,.jsx,.json,.ts,.tsx .",
|
||||
"lint-fix": "yarn lint --fix",
|
||||
"secure": "nsp check",
|
||||
"semantic-release": "semantic-release",
|
||||
"size": "npm pack --dry",
|
||||
@@ -22,11 +20,6 @@
|
||||
"types": "tsc --noEmit",
|
||||
"watch": "yarn build --watch"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"bluebird": "^3.7.1",
|
||||
"debug": "^4.1.1",
|
||||
@@ -46,7 +39,7 @@
|
||||
"chai": "4.1.2",
|
||||
"chalk": "3.0.0",
|
||||
"chokidar-cli": "1.2.0",
|
||||
"cypress": "4.5.0",
|
||||
"cypress": "*",
|
||||
"dependency-check": "2.9.1",
|
||||
"deps-ok": "1.2.1",
|
||||
"eslint": "6.8.0",
|
||||
@@ -56,9 +49,7 @@
|
||||
"fast-glob": "3.1.1",
|
||||
"find-webpack": "1.5.0",
|
||||
"fs-extra": "8.1.0",
|
||||
"husky": "4.2.5",
|
||||
"license-checker": "13.0.3",
|
||||
"lint-staged": "10.2.2",
|
||||
"mocha": "^7.1.0",
|
||||
"mockery": "2.1.0",
|
||||
"prettier-eslint-cli": "4.4.0",
|
||||
@@ -98,10 +89,5 @@
|
||||
"cypress-plugin",
|
||||
"cypress-preprocessor",
|
||||
"webpack"
|
||||
],
|
||||
"lint-staged": {
|
||||
"*.{js,jsx,ts,tsx,json}": [
|
||||
"eslint --fix"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"extends": [
|
||||
"config:base"
|
||||
],
|
||||
"automerge": true,
|
||||
"major": {
|
||||
"automerge": false
|
||||
},
|
||||
"timezone": "America/New_York",
|
||||
"schedule": "before 3am on Monday",
|
||||
"lockFileMaintenance": {
|
||||
"enabled": true
|
||||
},
|
||||
"masterIssue": true,
|
||||
"masterIssueApproval": true,
|
||||
"labels": [
|
||||
"type: dependencies",
|
||||
"renovate"
|
||||
],
|
||||
"rangeStrategy": "bump"
|
||||
}
|
||||
@@ -13,7 +13,9 @@ const { expect } = chai
|
||||
const preprocessor = require('../../dist/index')
|
||||
|
||||
const normalizeErrMessage = (message) => {
|
||||
return message.replace(/\/\S+\/_test/g, '<path>/_test')
|
||||
return message
|
||||
.replace(/\/\S+\/_test/g, '<path>/_test')
|
||||
.split(path.resolve(process.cwd(), '../..')).join('/[root]')
|
||||
}
|
||||
|
||||
const fixturesDir = path.join(__dirname, '..', 'fixtures')
|
||||
|
||||
@@ -104,6 +104,7 @@ exports.runTest = async (options = {}) => {
|
||||
config: {
|
||||
video: false,
|
||||
},
|
||||
dev: true,
|
||||
})
|
||||
.finally(() => {
|
||||
stdout = stdio.toString()
|
||||
@@ -295,6 +296,8 @@ function normalizeStdout (str, options = {}) {
|
||||
// /Users/jane/........../ -> //foo/bar/.projects/
|
||||
// (Required when paths are printed outside of our own formatting)
|
||||
.split(process.cwd()).join('/[cwd]')
|
||||
// also normalize paths to the workspace root
|
||||
.split(path.resolve(process.cwd(), '../..')).join('/[root]')
|
||||
|
||||
// unless normalization is explicitly turned off then
|
||||
// always normalize the stdout replacing the browser text
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -82,7 +82,6 @@
|
||||
"@cypress/questions-remain": "1.0.1",
|
||||
"@cypress/request": "2.88.5",
|
||||
"@cypress/request-promise": "4.2.6",
|
||||
"@cypress/webpack-preprocessor": "5.4.4",
|
||||
"@fellow/eslint-plugin-coffee": "0.4.13",
|
||||
"@percy/cypress": "2.3.1",
|
||||
"@types/bluebird": "3.5.29",
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"@cypress/icons": "0.7.0",
|
||||
"@cypress/json-schemas": "5.35.0",
|
||||
"@cypress/react-tooltip": "0.5.3",
|
||||
"@cypress/webpack-preprocessor": "*",
|
||||
"@fortawesome/fontawesome-free": "5.11.2",
|
||||
"@packages/web-config": "*",
|
||||
"bluebird": "3.5.3",
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
"@cypress/bower-kendo-ui": "0.0.2",
|
||||
"@cypress/sinon-chai": "1.1.0",
|
||||
"@cypress/unique-selector": "0.4.2",
|
||||
"@cypress/webpack-preprocessor": "*",
|
||||
"@cypress/what-is-circular": "1.0.1",
|
||||
"@packages/network": "*",
|
||||
"@packages/runner": "*",
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@cypress/react-tooltip": "0.5.3",
|
||||
"@cypress/webpack-preprocessor": "*",
|
||||
"@fortawesome/fontawesome-free": "5.12.1",
|
||||
"@packages/driver": "*",
|
||||
"@packages/reporter": "*",
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
"@cypress/request": "2.88.5",
|
||||
"@cypress/request-promise": "4.2.6",
|
||||
"@cypress/webpack-batteries-included-preprocessor": "2.1.1",
|
||||
"@cypress/webpack-preprocessor": "5.4.4",
|
||||
"@cypress/webpack-preprocessor": "*",
|
||||
"@ffmpeg-installer/ffmpeg": "1.0.20",
|
||||
"ansi_up": "4.0.4",
|
||||
"black-hole-stream": "0.0.1",
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"@babel/plugin-proposal-decorators": "7.8.3",
|
||||
"@babel/preset-env": "7.9.0",
|
||||
"@babel/preset-react": "7.9.4",
|
||||
"@cypress/webpack-preprocessor": "*",
|
||||
"@fortawesome/fontawesome-free": "5.12.1",
|
||||
"@reach/dialog": "0.10.5",
|
||||
"@reach/visually-hidden": "0.10.4",
|
||||
|
||||
Reference in New Issue
Block a user