Include filename and line numbers in CSS parse errors (#19282)
Co-authored-by: Jordan Pittman <jordan@cryptica.me>
This commit is contained in:
parent
5a89571efd
commit
5bc90dd2e0
4 changed files with 185 additions and 21 deletions
|
|
@ -1,9 +1,12 @@
|
|||
import dedent from 'dedent'
|
||||
import os from 'node:os'
|
||||
import path from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { describe } from 'vitest'
|
||||
import { candidate, css, html, js, json, test, ts, yaml } from '../utils'
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
const STANDALONE_BINARY = (() => {
|
||||
switch (os.platform()) {
|
||||
case 'win32':
|
||||
|
|
@ -2101,6 +2104,33 @@ test(
|
|||
},
|
||||
)
|
||||
|
||||
test(
|
||||
'CSS parse errors should include filename and line number',
|
||||
{
|
||||
fs: {
|
||||
'package.json': json`
|
||||
{
|
||||
"dependencies": {
|
||||
"tailwindcss": "workspace:^",
|
||||
"@tailwindcss/cli": "workspace:^"
|
||||
}
|
||||
}
|
||||
`,
|
||||
'input.css': css`
|
||||
.test {
|
||||
color: red;
|
||||
*/
|
||||
}
|
||||
`,
|
||||
},
|
||||
},
|
||||
async ({ exec, expect }) => {
|
||||
await expect(exec('pnpm tailwindcss --input input.css --output dist/out.css')).rejects.toThrow(
|
||||
/CssSyntaxError: .*input.css:3:3: Invalid declaration: `\*\/`/,
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
function withBOM(text: string): string {
|
||||
return '\uFEFF' + text
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue