Unverified Commit 6cb85b58 authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

[test] Use a non-native stub for the server externals list test (#97614)

Using `keyv` instead of `sqlite3`. This test never installed the package
but it just looked like it's native binding related due to its choice of
package.
parent 52e0cf3f
import { dir } from 'sqlite3'
import { dir } from 'keyv'
export default function Predefined() {
return <div id="directory">{dir}</div>
......
......@@ -26,8 +26,13 @@ describe('app-dir - server components externals', () => {
it('uses externals for predefined list in server-external-packages.json', async () => {
const $ = await next.render$('/predefined')
// `keyv` is on the built-in list in
// packages/next/src/lib/server-external-packages.jsonc. Resolving to the
// package's own directory is what proves it stayed external: a bundled copy
// would report the chunk's directory instead. The package here is a stub, so
// the assertion is about the list rather than about anything `keyv` does.
const text = $('#directory').text()
expect(text).toBe(path.join(next.testDir, 'node_modules', 'sqlite3'))
expect(text).toBe(path.join(next.testDir, 'node_modules', 'keyv'))
})
// Inspect webpack server bundles
......
{
"name": "sqlite3",
"name": "keyv",
"version": "1.0.0",
"description": "sqlite3 stub",
"description": "keyv stub",
"main": "index.js"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment