next.js/test/production/optimize-server-react/optimize-server-react.test.ts
optimize-server-react.test.ts20 lines586 B
import { nextTestSetup } from 'e2e-utils'
;(process.env.IS_TURBOPACK_TEST ? describe.skip : describe)(
  'optimize-server-react',
  () => {
    const { next } = nextTestSetup({
      files: __dirname,
    })

    it('should work with useEffect', async () => {
      const browser = await next.browser('/')
      expect(await browser.elementByCss('p').text()).toBe('hello world')
    })

    it('should optimize useEffect call on server side', async () => {
      const file = await next.readFile('.next/server/pages/index.js')
      expect(file).not.toContain('useEffect')
    })
  }
)
Quest for Codev2.0.0
/
SIGN IN