MCPcopy
hub / github.com/vercel/next.js / runTests

Function runTests

test/integration/jsconfig-paths/test/index.test.ts:28–134  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26}
27
28function runTests() {
29 describe('default behavior', () => {
30 let output = ''
31
32 beforeAll(async () => {
33 appPort = await findPort()
34 app = await launchApp(appDir, appPort, {
35 onStderr(msg) {
36 output += msg || ''
37 },
38 onStdout(msg) {
39 output += msg || ''
40 },
41 })
42 })
43 afterAll(() => killApp(app))
44
45 it('should alias components', async () => {
46 const $ = await get$('/basic-alias')
47 expect($('body').text()).toMatch(/World/)
48 })
49
50 it('should resolve the first item in the array first', async () => {
51 const $ = await get$('/resolve-order')
52 expect($('body').text()).toMatch(/Hello from a/)
53 })
54
55 it('should resolve the second item as fallback', async () => {
56 const $ = await get$('/resolve-fallback')
57 expect($('body').text()).toMatch(/Hello from only b/)
58 })
59
60 it('should resolve a single matching alias', async () => {
61 const $ = await get$('/single-alias')
62 expect($('body').text()).toMatch(/Hello/)
63 })
64
65 it('should have correct module not found error', async () => {
66 const basicPage = join(appDir, 'pages/basic-alias.js')
67 const contents = await fs.readFile(basicPage, 'utf8')
68
69 try {
70 await fs.writeFile(basicPage, contents.replace('@c/world', '@c/worldd'))
71
72 await retry(async () => {
73 await renderViaHTTP(appPort, '/basic-alias')
74 expect(stripAnsi(output)).toMatch(
75 /Module not found: Can't resolve '@c\/worldd'/
76 )
77 })
78 } finally {
79 await fs.writeFile(basicPage, contents)
80 }
81 })
82 })
83
84 describe('should build', () => {
85 ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(

Callers 1

index.test.tsFile · 0.70

Calls 15

findPortFunction · 0.90
launchAppFunction · 0.90
killAppFunction · 0.90
joinFunction · 0.90
retryFunction · 0.90
renderViaHTTPFunction · 0.90
nextBuildFunction · 0.90
describeFunction · 0.85
readJSONMethod · 0.80
someMethod · 0.80
includesMethod · 0.80
get$Function · 0.70

Tested by

no test coverage detected