Skip to content
Merged
31 changes: 30 additions & 1 deletion e2e/smoke.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {describe, expect, it} from 'vitest'
import {transformFile} from '@swc/core'
import {transform, transformFile} from '@swc/core'
import {resolve} from 'path'

const wasmPath = resolve(import.meta.dirname, '../target/wasm32-wasip1/release/lingui_macro_plugin.wasm')
Expand Down Expand Up @@ -34,4 +34,33 @@ describe('E2E Smoke Test', () => {
const result = await transformWithSwc(fixturePath, 'production')
expect(result.code).toMatchSnapshot()
})

it('should keep lingui-set directives set on TypeScript export declarations', async () => {
const result = await transform(
`
import { msg } from '@lingui/core/macro'

// lingui-set context="navigation"
type SomeType = string

const table = {
home: msg\`Home\`,
}
`,
{
filename: 'directive-after-export-type.ts',
jsc: {
parser: {
syntax: 'typescript',
tsx: false,
},
experimental: {
plugins: [[wasmPath, { descriptorFields: 'message' }]],
},
},
},
)

expect(result.code).toContain('context: "navigation"')
})
})
Loading
Loading