Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
a967202d
Unverified
Commit
a967202d
authored
Apr 10, 2025
by
Niklas Mischkulnig
Committed by
GitHub
Apr 10, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix CSS Data URL test on Turbopack (#77970)
parent
0c7610b7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
16 deletions
+22
-16
css-modules.test.js
test/integration/css/test/css-modules.test.js
+21
-15
turbopack-build-tests-manifest.json
test/turbopack-build-tests-manifest.json
+1
-1
No files found.
test/integration/css/test/css-modules.test.js
View file @
a967202d
/* eslint-env jest */
/* eslint-env jest */
import
cheerio
from
'cheerio'
import
cheerio
from
'cheerio'
import
{
read
dir
,
read
File
,
remove
}
from
'fs-extra'
import
{
readFile
,
remove
}
from
'fs-extra'
import
{
import
{
check
,
check
,
File
,
File
,
...
@@ -14,6 +14,7 @@ import {
...
@@ -14,6 +14,7 @@ import {
}
from
'next-test-utils'
}
from
'next-test-utils'
import
webdriver
from
'next-webdriver'
import
webdriver
from
'next-webdriver'
import
{
join
}
from
'path'
import
{
join
}
from
'path'
import
nodeFs
from
'fs'
const
fixturesDir
=
join
(
__dirname
,
'../..'
,
'css-fixtures'
)
const
fixturesDir
=
join
(
__dirname
,
'../..'
,
'css-fixtures'
)
...
@@ -145,16 +146,18 @@ describe('should handle unresolved files gracefully', () => {
...
@@ -145,16 +146,18 @@ describe('should handle unresolved files gracefully', () => {
})
})
it
(
'should have correct file references in CSS output'
,
async
()
=>
{
it
(
'should have correct file references in CSS output'
,
async
()
=>
{
const
cssFiles
=
await
readdir
(
join
(
workDir
,
'.next/static/css'
))
const
cssFolder
=
join
(
workDir
,
'.next'
,
'static'
)
const
cssFiles
=
nodeFs
.
readdirSync
(
cssFolder
,
{
recursive
:
true
,
encoding
:
'utf8'
,
})
.
filter
((
f
)
=>
f
.
endsWith
(
'.css'
))
for
(
const
file
of
cssFiles
)
{
expect
(
cssFiles
).
not
.
toBeEmpty
()
if
(
file
.
endsWith
(
'.css.map'
))
continue
const
content
=
await
readFile
(
for
(
const
file
of
cssFiles
)
{
join
(
workDir
,
'.next/static/css'
,
file
),
const
content
=
await
readFile
(
join
(
cssFolder
,
file
),
'utf8'
)
'utf8'
)
console
.
log
(
file
,
content
)
// if it is the combined global CSS file there are double the expected
// if it is the combined global CSS file there are double the expected
// results
// results
...
@@ -162,7 +165,6 @@ describe('should handle unresolved files gracefully', () => {
...
@@ -162,7 +165,6 @@ describe('should handle unresolved files gracefully', () => {
content
.
includes
(
'p{'
)
||
content
.
includes
(
'p,'
)
?
2
:
1
content
.
includes
(
'p{'
)
||
content
.
includes
(
'p,'
)
?
2
:
1
expect
(
content
.
match
(
/
\(\/
vercel
\.
svg/g
).
length
).
toBe
(
howMany
)
expect
(
content
.
match
(
/
\(\/
vercel
\.
svg/g
).
length
).
toBe
(
howMany
)
// expect(content.match(/\(vercel\.svg/g).length).toBe(howMany)
expect
(
content
.
match
(
/
\(\/
_next
\/
static
\/
media/g
).
length
).
toBe
(
1
)
expect
(
content
.
match
(
/
\(\/
_next
\/
static
\/
media/g
).
length
).
toBe
(
1
)
expect
(
content
.
match
(
/
\(
https:
\/\/
/g
).
length
).
toBe
(
howMany
)
expect
(
content
.
match
(
/
\(
https:
\/\/
/g
).
length
).
toBe
(
howMany
)
}
}
...
@@ -184,14 +186,18 @@ describe('Data URLs', () => {
...
@@ -184,14 +186,18 @@ describe('Data URLs', () => {
})
})
it
(
'should have emitted expected files'
,
async
()
=>
{
it
(
'should have emitted expected files'
,
async
()
=>
{
const
cssFolder
=
join
(
workDir
,
'.next/static/css'
)
const
cssFolder
=
join
(
workDir
,
'.next'
,
'static'
)
const
files
=
await
readdir
(
cssFolder
)
const
cssFiles
=
nodeFs
const
cssFiles
=
files
.
filter
((
f
)
=>
/
\.
css$/
.
test
(
f
))
.
readdirSync
(
cssFolder
,
{
recursive
:
true
,
encoding
:
'utf8'
,
})
.
filter
((
f
)
=>
f
.
endsWith
(
'.css'
))
expect
(
cssFiles
.
length
).
toBe
(
1
)
expect
(
cssFiles
.
length
).
toBe
(
1
)
const
cssContent
=
await
readFile
(
join
(
cssFolder
,
cssFiles
[
0
]),
'utf8'
)
const
cssContent
=
await
readFile
(
join
(
cssFolder
,
cssFiles
[
0
]),
'utf8'
)
expect
(
cssContent
.
replace
(
/
\/\*
.*
?\*\/
/g
,
''
).
trim
()).
toMatch
(
expect
(
cssContent
.
replace
(
/
\/\*
.*
?\*\/
n
/g
,
''
).
trim
()).
toMatch
(
/background:url
\(
"
data:
[^
"
]
+"
\)
/
/background:url
\(
"
?
data:
[^
"
]
+"
?
\)
/
)
)
})
})
}
}
...
...
test/turbopack-build-tests-manifest.json
View file @
a967202d
...
@@ -9713,6 +9713,7 @@
...
@@ -9713,6 +9713,7 @@
"test/integration/css/test/css-modules.test.js"
:
{
"test/integration/css/test/css-modules.test.js"
:
{
"passed"
:
[
"passed"
:
[
"Data URLs production mode should compile successfully"
,
"Data URLs production mode should compile successfully"
,
"Data URLs production mode should have emitted expected files"
,
"Ordering with Global CSS and Modules (dev) useLightnincsss(false) should have the correct color (css ordering)"
,
"Ordering with Global CSS and Modules (dev) useLightnincsss(false) should have the correct color (css ordering)"
,
"Ordering with Global CSS and Modules (dev) useLightnincsss(false) should have the correct color (css ordering) during hot reloads"
,
"Ordering with Global CSS and Modules (dev) useLightnincsss(false) should have the correct color (css ordering) during hot reloads"
,
"Ordering with Global CSS and Modules (dev) useLightnincsss(false) should not execute scripts in any order"
,
"Ordering with Global CSS and Modules (dev) useLightnincsss(false) should not execute scripts in any order"
,
...
@@ -9726,7 +9727,6 @@
...
@@ -9726,7 +9727,6 @@
"should handle unresolved files gracefully production mode should build correctly"
"should handle unresolved files gracefully production mode should build correctly"
],
],
"failed"
:
[
"failed"
:
[
"Data URLs production mode should have emitted expected files"
,
"should handle unresolved files gracefully production mode should have correct file references in CSS output"
"should handle unresolved files gracefully production mode should have correct file references in CSS output"
],
],
"pending"
:
[
"pending"
:
[
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment