[fs-detectors] Exclude the middleware builder if it's a Next.js app (#8239)

This commit is contained in:
Seiya Nuta
2022-08-01 21:18:29 +09:00
committed by GitHub
parent fc3fa61b59
commit 71b3ded398
2 changed files with 44 additions and 1 deletions

View File

@@ -2281,6 +2281,31 @@ describe('Test `detectBuilders` with `featHandleMiss=true`', () => {
},
]);
});
it('should not add middleware builder when building "nextjs"', async () => {
const files = ['package.json', 'pages/index.ts', 'middleware.ts'];
const pkg = {
scripts: { build: 'next build' },
dependencies: { next: '12.2.0' },
};
const projectSettings = {
framework: null, // "Other" framework
createdAt: Date.parse('2020-02-01'),
};
const { builders } = await detectBuilders(files, pkg, {
projectSettings,
featHandleMiss,
});
expect(builders).toEqual([
{
use: '@vercel/next',
src: 'package.json',
config: {
zeroConfig: true,
},
},
]);
});
});
it('Test `detectRoutes`', async () => {