Skip to content

Commit 72db591

Browse files
committed
fix: resolves all requests to config-placeholder so that $extends works
1 parent 76deb63 commit 72db591

File tree

18 files changed

+190
-5
lines changed

18 files changed

+190
-5
lines changed

.github/workflows/cypress.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,12 @@ jobs:
6767
start: yarn serve -l 8993 ./dist
6868
env:
6969
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
70+
- uses: cypress-io/github-action@v2
71+
with:
72+
group: app-config-extending-other-files
73+
working-directory: tests/webpack-projects/extending-other-files
74+
install: false
75+
record: true
76+
start: yarn serve -l 8994 ./dist
77+
env:
78+
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}

app-config-webpack/src/index.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,7 @@ export default class AppConfigPlugin {
6060
this.schemaLoadingOptions,
6161
);
6262

63-
if (filePaths?.length) {
64-
[resolve.request] = filePaths; // eslint-disable-line no-param-reassign
65-
} else {
66-
resolve.request = join(__dirname, '..', '.config-placeholder'); // eslint-disable-line no-param-reassign
67-
}
63+
resolve.request = join(__dirname, '..', '.config-placeholder'); // eslint-disable-line no-param-reassign
6864
}
6965

7066
return resolve;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
generate:
2+
- file: './src/@types/lcdev__app-config/index.d.ts'
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
type: object
2+
additionalProperties: false
3+
4+
required:
5+
- foo
6+
7+
properties:
8+
foo:
9+
type: string
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
foo: bar
2+
3+
$extends: ./other-file.yml
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"projectId": "fm6zcy",
3+
"baseUrl": "http://localhost:8994"
4+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
describe('Config Loading', () => {
2+
it('should render the configuration', () => {
3+
cy.visit('/');
4+
5+
cy.get('body').should('contain', `"foo": "baz"`);
6+
});
7+
});
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
module.exports = (on, config) => {
2+
}
Loading
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// ***********************************************
2+
// This example commands.js shows you how to
3+
// create various custom commands and overwrite
4+
// existing commands.
5+
//
6+
// For more comprehensive examples of custom
7+
// commands please read more here:
8+
// https://on.cypress.io/custom-commands
9+
// ***********************************************
10+
//
11+
//
12+
// -- This is a parent command --
13+
// Cypress.Commands.add("login", (email, password) => { ... })
14+
//
15+
//
16+
// -- This is a child command --
17+
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
18+
//
19+
//
20+
// -- This is a dual command --
21+
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
22+
//
23+
//
24+
// -- This will overwrite an existing command --
25+
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })

0 commit comments

Comments
 (0)