我已经有了带有顺风和daisyUI的Nextjs应用程序。我试图实现Cypress,但无法配置它,它只出现de。
// package.json
"scripts": {
"tailwind-generate": " npx tailwindcss --input styles/globals.css --output styles/tailwind-generated.css"
}// cypress/tests/Button.cy.js
import { mount } from 'cypress/react'
import Button from '../../components/Inputs/Button'
describe('<Button >', () => {
it('mount', () => {
mount(<Button label={'Hola'} />, { stylesheet: '@/styles/tailwind-generated.css' })
})
})但什么都没发生

发布于 2022-06-26 21:03:45
对于一个简单的预先生成的样式表,您应该能够通过导入它来使用它。
import { mount } from 'cypress/react'
import Button from '../../components/Inputs/Button'
import from '../../styles/tailwind-generated.css' // path may need adjusting
describe('<Button >', () => {
it('mount', () => {
mount(<Button label={'Hola'} />)
})
})用于基于CDN的样式
describe('<Button >', () => {
it('mount', () => {
mount(<Button label={'Hola'} />, {
stylesheets: [
'https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.css',
],)
})
})https://stackoverflow.com/questions/72761922
复制相似问题