未验证 提交 3b7a20de 编写于 作者: J Joe Haddad 提交者: GitHub

Test strictly matching `next/dist` packages (#9968)

上级 c512b04e
const React = require('react')
module.exports = function() {
return React.createElement('p', null, 'BrokenExternalMarker')
}
{
"name": "notnext",
"version": "1.0.0",
"main": "dist/index.js",
"license": "MIT"
}
{
"name": "non-next-dist-exclude",
"version": "1.0.0",
"main": "index.js",
"license": "MIT"
}
import NotNext from 'notnext'
const Page = () => <NotNext />
Page.getInitialProps = () => ({})
export default Page
/* eslint-env jest */
/* global jasmine */
import fs from 'fs-extra'
import path from 'path'
import { nextBuild } from 'next-test-utils'
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 1
const appDir = path.join(__dirname, '../app')
let buildId
describe('Non-Next externalization', () => {
beforeAll(async () => {
await nextBuild(appDir)
buildId = await fs.readFile(path.join(appDir, '.next/BUILD_ID'), 'utf8')
})
it('Externalized non-Next dist-using package', async () => {
const content = await fs.readFile(
path.join(appDir, '.next/server/static', buildId, 'pages/index.js'),
'utf8'
)
expect(content).not.toContain('BrokenExternalMarker')
})
})
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册