-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: catch transform css error (#9)
- Loading branch information
Showing
5 changed files
with
80 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.app { | ||
padding: 20px; | ||
user-select: none; | ||
} | ||
|
||
.title { | ||
font-size: var(-- 15px, 15px); | ||
color: #000; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import styles from './index.css'; | ||
|
||
import React from 'react'; | ||
import { createRoot } from 'react-dom/client'; | ||
const App = () => ( | ||
<div className={'app'}> | ||
<h1 className={'title'}>Hello World</h1> | ||
</div> | ||
); | ||
|
||
createRoot(document.getElementById('root')).render(<App />); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import path from 'path'; | ||
import { removeComments, runTest } from '../runTest'; | ||
import fse from 'fs-extra'; | ||
import { formatMessages } from 'esbuild'; | ||
|
||
const OUTPUT_HTML = !!process.env.OUTPUT_HTML; | ||
|
||
describe(path.basename(path.dirname(__filename)), function () { | ||
it('style-loader', async function () { | ||
const output = path.resolve(__dirname, 'output'); | ||
fse.removeSync(output); | ||
await runTest([path.resolve(__dirname, './index.jsx')], output).catch((error) => { | ||
formatMessages(error.errors, { kind: 'error', color: false }).then((res) => { | ||
expect(res.length).toBe(1); | ||
expect(res[0]).toContain('[ERROR] Unexpected token Dimension'); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters