-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(builders): do not copy fixtures if not defined by cypress.json
- Loading branch information
1 parent
e2cd2f9
commit dfba24d
Showing
3 changed files
with
105 additions
and
8 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,9 @@ export default class CypressBuilder implements Builder<CypressBuilderOptions> { | |
); | ||
|
||
return this.compileTypescriptFiles(options.tsConfig, options.watch).pipe( | ||
tap(() => this.copyCypressFixtures(options.tsConfig)), | ||
tap(() => | ||
this.copyCypressFixtures(options.tsConfig, options.cypressConfig) | ||
), | ||
concatMap( | ||
() => | ||
!options.baseUrl && options.devServerTarget | ||
|
@@ -147,14 +149,16 @@ export default class CypressBuilder implements Builder<CypressBuilderOptions> { | |
* This is done because `tsc` doesn't handle `json` files. | ||
* @param tsConfigPath | ||
*/ | ||
private copyCypressFixtures(tsConfigPath: string) { | ||
const tsconfigJson = JSON.parse(readFile(tsConfigPath)); | ||
private copyCypressFixtures(tsConfigPath: string, cypressConfigPath: string) { | ||
const cypressConfig = JSON.parse(readFile(cypressConfigPath)); | ||
// DOn't copy fixtures if cypress config does not have it set | ||
if (!cypressConfig.fixtures) { | ||
This comment has been minimized.
Sorry, something went wrong.
skorunka
|
||
return; | ||
} | ||
|
||
copySync( | ||
`${path.dirname(tsConfigPath)}/src/fixtures`, | ||
`${path.resolve( | ||
path.dirname(tsConfigPath), | ||
tsconfigJson.compilerOptions.outDir | ||
)}/fixtures`, | ||
path.join(path.dirname(cypressConfigPath), cypressConfig.fixtures), | ||
{ overwrite: true } | ||
); | ||
} | ||
|
why you don't look in
cypress.json
forfixturesFolder
?