next.js/test/development/app-dir/turbopack-import-assertions-use/turbopack-import-assertions-use.test.ts
turbopack-import-assertions-use.test.ts38 lines1.2 KB
import { nextTestSetup } from 'e2e-utils'

describe('turbopack-import-assertions-use', () => {
  const { next, isTurbopack } = nextTestSetup({
    files: __dirname,
  })

  if (!isTurbopack) {
    it('should skip for webpack', () => {})
    return
  }

  it('should apply raw loader via turbopackUse import assertion', async () => {
    const $ = await next.render$('/')
    expect($('#raw').text()).toBe('Hello from raw text file')
  })

  it('should apply replace loader with options via turbopackUse import assertion', async () => {
    const $ = await next.render$('/')
    expect($('#replaced').text()).toBe('Value is: turbopackUse works!')
  })

  it('should apply raw loader with turbopackModuleType ecmascript', async () => {
    const $ = await next.render$('/')
    expect($('#module-type').text()).toBe('Hello via module type')
  })

  it('should apply identity loader with turbopackModuleType json', async () => {
    const $ = await next.render$('/')
    expect($('#json-type').text()).toBe('Hello from JSON module type')
  })

  it('should apply identity with loader rules', async () => {
    const $ = await next.render$('/')
    expect($('#json-type-2').text()).toBe('Hello from JSON module type 2')
  })
})
Quest for Codev2.0.0
/
SIGN IN