File size: 1,792 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
import { nextTestSetup } from 'e2e-utils'
describe('no-mangling', () => {
describe('with the default `next build`', () => {
const { next } = nextTestSetup({
files: __dirname,
skipStart: true,
})
it('should show mangled function names in stack traces', async () => {
try {
await next.build()
} catch {
// we expect the build to fail
}
expect(next.cliOutput).toInclude(`
Error: Kaputt!
at `) // mangled function name omitted because it's undeterministic
// `Page` is the original function name that is mangled because `next
// build` was called without `--no-mangling`.
expect(next.cliOutput).not.toInclude(`
Error: Kaputt!
at Page`)
})
})
describe('with `next build --no-mangling`', () => {
const { next } = nextTestSetup({
files: __dirname,
buildArgs: ['--no-mangling'],
skipStart: true,
})
it('should show original function names in stack traces', async () => {
try {
await next.build()
} catch {
// we expect the build to fail
}
// `Page` is the original function name that would be mangled if `next
// build` was called without `--no-mangling`.
expect(next.cliOutput).toInclude(`
Error: Kaputt!
at Page`)
})
describe('with "use cache" functions', () => {
it('should show original function names in stack traces', async () => {
try {
await next.build()
} catch {
// we expect the build to fail
}
// `CachedPage` is the original function name that would be mangled if
// `next build` was called without `--no-mangling`.
expect(next.cliOutput).toInclude(`
Error: Kaputt!
at CachedPage`)
})
})
})
})
|