@@ -4,7 +4,7 @@ import stripAnsi from 'strip-ansi'
4
4
import { retry } from 'next-test-utils'
5
5
import { nextTestSetup } from 'e2e-utils'
6
6
7
- const cahceReasonRe = / C a c h e ( m i s s e d | s k i p p e d ) r e a s o n : /
7
+ const cacheReasonRegex = / C a c h e ( m i s s e d | s k i p p e d ) r e a s o n : /
8
8
9
9
interface ParsedLog {
10
10
method : string
@@ -17,13 +17,13 @@ interface ParsedLog {
17
17
function parseLogsFromCli ( cliOutput : string ) {
18
18
const logs = stripAnsi ( cliOutput )
19
19
. split ( '\n' )
20
- . filter ( ( log ) => cahceReasonRe . test ( log ) || log . includes ( 'GET' ) )
20
+ . filter ( ( log ) => cacheReasonRegex . test ( log ) || log . includes ( 'GET' ) )
21
21
22
22
return logs . reduce < ParsedLog [ ] > ( ( parsedLogs , log ) => {
23
- if ( cahceReasonRe . test ( log ) ) {
23
+ if ( cacheReasonRegex . test ( log ) ) {
24
24
// cache miss/skip reason
25
25
// Example of `log`: "│ │ Cache skipped reason: (cache: no-cache)"
26
- const reasonSegment = log . split ( cahceReasonRe , 3 ) [ 2 ] . trim ( )
26
+ const reasonSegment = log . split ( cacheReasonRegex , 3 ) [ 2 ] . trim ( )
27
27
const reason = reasonSegment . slice ( 1 , - 1 )
28
28
parsedLogs [ parsedLogs . length - 1 ] . cache = reason
29
29
} else {
@@ -162,8 +162,10 @@ describe('app-dir - logging', () => {
162
162
await browser . elementByCss ( 'a' ) . click ( )
163
163
await browser . waitForElementByCss ( 'h2' )
164
164
const logs = stripAnsi ( next . cliOutput . slice ( outputIndex ) )
165
- expect ( logs ) . not . toContain ( 'GET /_next/static' )
166
- expect ( logs ) . not . toContain ( 'GET /foo?_rsc' )
165
+ expect ( logs ) . not . toContain ( '/_next/static' )
166
+ expect ( logs ) . not . toContain ( '?_rsc' )
167
+ // Only show `GET /` once
168
+ expect ( logs . split ( 'GET /' ) . length ) . toBe ( 2 )
167
169
} )
168
170
}
169
171
} else {
0 commit comments