Skip to content

Commit d0b03ca

Browse files
committed
feat(@angular/cli): read proxyConfig from angular-cli.json
easy proxy config by reading default from angular-cli.json (angular#6240)
1 parent 7466b91 commit d0b03ca

File tree

2 files changed

+13
-46
lines changed

2 files changed

+13
-46
lines changed

tests/e2e/tests/misc/proxy-config.ts

+13
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ export default function() {
3232

3333
return Promise.resolve()
3434
.then(() => writeFile(proxyConfigFile, JSON.stringify(proxyConfig, null, 2)))
35+
36+
.then(() => ngServe('--proxy-config', proxyConfigFile))
37+
.then(() => request('http://localhost:4200/api/test'))
38+
.then(body => {
39+
if (!body.match(/TEST_API_RETURN/)) {
40+
throw new Error('Response does not match expected value.');
41+
}
42+
})
43+
.then(() => server.close(), (err) => { server.close(); throw err; })
44+
.then(() => killAllProcesses(), (err) => { killAllProcesses(); throw err; })
45+
3546
.then(() => updateJsonFile('.angular-cli.json', configJson => {
3647
const app = configJson.defaults;
3748
app.serve = {
@@ -49,6 +60,8 @@ export default function() {
4960
.then(() => killAllProcesses(), (err) => { killAllProcesses(); throw err; })
5061

5162
// A non-existing proxy file should error.
63+
64+
.then(() => expectToFail(() => ng('serve', '--proxy-config', 'proxy.non-existent.json')))
5265
.then(() => updateJsonFile('.angular-cli.json', configJson => {
5366
const app = configJson.defaults;
5467
app.serve = {

tests/e2e/tests/misc/proxy.ts

-46
This file was deleted.

0 commit comments

Comments
 (0)