mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-04-24 05:05:53 +08:00
This reverts commit 6a5b3cdaaa.
This commit is contained in:
33
test/fixtures/typescript-typecheck/index.test.js
vendored
33
test/fixtures/typescript-typecheck/index.test.js
vendored
@@ -1,33 +0,0 @@
|
||||
const testSetup = require('../__shared__/test-setup');
|
||||
const puppeteer = require('puppeteer');
|
||||
|
||||
const expectedErrorMsg = `Argument of type '123' is not assignable to parameter of type 'string'`;
|
||||
|
||||
test('shows error overlay in browser', async () => {
|
||||
const { port, done } = await testSetup.scripts.start();
|
||||
|
||||
const browser = await puppeteer.launch({ headless: true });
|
||||
try {
|
||||
const page = await browser.newPage();
|
||||
await page.goto(`http://localhost:${port}/`);
|
||||
await page.waitForSelector('iframe', { timeout: 5000 });
|
||||
const overlayMsg = await page.evaluate(() => {
|
||||
const overlay = document.querySelector('iframe').contentWindow;
|
||||
return overlay.document.body.innerHTML;
|
||||
});
|
||||
expect(overlayMsg).toContain(expectedErrorMsg);
|
||||
} finally {
|
||||
browser.close();
|
||||
done();
|
||||
}
|
||||
});
|
||||
|
||||
test('shows error in console (dev mode)', async () => {
|
||||
const { stderr } = await testSetup.scripts.start({ smoke: true });
|
||||
expect(stderr).toContain(expectedErrorMsg);
|
||||
});
|
||||
|
||||
test('shows error in console (prod mode)', async () => {
|
||||
const { stderr } = await testSetup.scripts.build();
|
||||
expect(stderr).toContain(expectedErrorMsg);
|
||||
});
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"@types/react": "*",
|
||||
"@types/react-dom": "*",
|
||||
"react": "*",
|
||||
"react-dom": "*",
|
||||
"typescript": "3.1.3"
|
||||
}
|
||||
}
|
||||
13
test/fixtures/typescript-typecheck/src/App.tsx
vendored
13
test/fixtures/typescript-typecheck/src/App.tsx
vendored
@@ -1,13 +0,0 @@
|
||||
import * as React from 'react';
|
||||
|
||||
class App extends React.Component {
|
||||
render() {
|
||||
return <div>{format(123)}</div>;
|
||||
}
|
||||
}
|
||||
|
||||
function format(value: string) {
|
||||
return value;
|
||||
}
|
||||
|
||||
export default App;
|
||||
@@ -1,5 +0,0 @@
|
||||
import * as React from 'react';
|
||||
import * as ReactDOM from 'react-dom';
|
||||
import App from './App';
|
||||
|
||||
ReactDOM.render(<App />, document.getElementById('root'));
|
||||
Reference in New Issue
Block a user