forked from Klaveness-Digital/cypress-parallel
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also drop support for all previous versions.
- Loading branch information
Showing
11 changed files
with
471 additions
and
85 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
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 |
---|---|---|
@@ -1,41 +1,10 @@ | ||
import { Given } from "@cucumber/cucumber"; | ||
import path from "path"; | ||
import { promises as fs } from "fs"; | ||
import { name as packageName } from "../../package.json"; | ||
|
||
async function addOrUpdateConfiguration( | ||
absoluteConfigPath: string, | ||
additionalJsonContent: string | ||
) { | ||
let existingConfig: any; | ||
|
||
try { | ||
existingConfig = JSON.parse( | ||
(await fs.readFile(absoluteConfigPath)).toString() | ||
); | ||
} catch (e: any) { | ||
if (e.code === "ENOENT") { | ||
existingConfig = {}; | ||
} else { | ||
throw e; | ||
} | ||
} | ||
|
||
await fs.writeFile( | ||
absoluteConfigPath, | ||
JSON.stringify( | ||
{ | ||
...existingConfig, | ||
...JSON.parse(additionalJsonContent), | ||
}, | ||
null, | ||
2 | ||
) | ||
); | ||
} | ||
import { insertValuesInConfigFile } from "../support/configFileUpdater"; | ||
|
||
Given("additional Cypress configuration", async function (jsonContent) { | ||
const absoluteConfigPath = path.join(this.tmpDir, "cypress.json"); | ||
|
||
await addOrUpdateConfiguration(absoluteConfigPath, jsonContent); | ||
await insertValuesInConfigFile( | ||
path.join(this.tmpDir, "cypress.config.js"), | ||
JSON.parse(jsonContent) | ||
); | ||
}); |
Oops, something went wrong.