diff --git a/packages/hooks-loader/src/__tests__/__snapshots__/hooks-loader.test.ts.snap b/packages/hooks-loader/src/__tests__/__snapshots__/hooks-loader.test.ts.snap deleted file mode 100644 index a896290d2..000000000 --- a/packages/hooks-loader/src/__tests__/__snapshots__/hooks-loader.test.ts.snap +++ /dev/null @@ -1,22 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`hooks loader with proxy Compile lambda 1`] = ` -import { createRequest } from '@midwayjs/hooks-core/request'; - -export default createRequest('/api', 'default'); -`; - -exports[`hooks loader with proxy Compile render 1`] = ` -import { createRequest } from '@midwayjs/hooks-core/request'; - -export default createRequest('/', 'default'); -export const foo = createRequest('/', 'foo'); -export const bar = createRequest('/', 'bar'); -`; - -exports[`hooks loader with proxy non-lambda files should not be compiled 1`] = ` -export function isTrue(value) { - return value === 'true' || value === true; -} - -`; diff --git a/packages/hooks-loader/src/__tests__/hooks-loader.test.ts b/packages/hooks-loader/src/__tests__/hooks-loader.test.ts index 9c8e42c0b..e06a00a7b 100644 --- a/packages/hooks-loader/src/__tests__/hooks-loader.test.ts +++ b/packages/hooks-loader/src/__tests__/hooks-loader.test.ts @@ -34,12 +34,22 @@ describe('hooks loader with proxy', () => { test('Compile render', async () => { const output = await compile('render/[...index].ts') - expect(wrap(output)).toMatchSnapshot() + expect(wrap(output)).toMatchInlineSnapshot(` + import { createRequest } from '@midwayjs/hooks-core/request'; + + export default createRequest('/', 'default'); + export const foo = createRequest('/', 'foo'); + export const bar = createRequest('/', 'bar'); + `) }) test('Compile lambda', async () => { const output = await compile('lambda/index.ts') - expect(wrap(output)).toMatchSnapshot() + expect(wrap(output)).toMatchInlineSnapshot(` + import { createRequest } from '@midwayjs/hooks-core/request'; + + export default createRequest('/api', 'default'); + `) }) test('the second build should match the first.', async () => { @@ -50,6 +60,11 @@ describe('hooks loader with proxy', () => { test('non-lambda files should not be compiled', async () => { const output = await compile('util/util.ts') - expect(wrap(output)).toMatchSnapshot() + expect(wrap(output)).toMatchInlineSnapshot(` + export function isTrue(value) { + return value === 'true' || value === true; + } + + `) }) })