Skip to content

Commit 0e723fa

Browse files
committed
accept config snapshot
1 parent d776d63 commit 0e723fa

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

packages/selianize/__tests__/configuration.spec.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ describe("configuration code emitter", () => {
3232
skipped: true
3333
});
3434
});
35+
it("should append the configuration snapshot to the config", () => {
36+
const project = {
37+
url: "http://www.seleniumhq.org"
38+
};
39+
const snapshot = "extra global config";
40+
return expect(ConfigurationEmitter.emit(project, undefined, snapshot)).resolves.toBe(`global.BASE_URL = configuration.baseUrl || '${project.url}';let vars = {};${snapshot}`);
41+
});
3542
it("should emit a snapshot of the hooks when skipStdLibEmitting is set", () => {
3643
const project = {
3744
url: "http://www.seleniumhq.org"

packages/selianize/src/configuration.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ import config from "./config";
1919

2020
const hooks = [];
2121

22-
export async function emit(project, options = config) {
22+
export async function emit(project, options = config, snapshot) {
2323
const configHooks = (await Promise.all(hooks.map((hook) => hook({ name: project.name })))).join("");
2424
if (!options.skipStdLibEmitting) {
25-
return `global.BASE_URL = configuration.baseUrl || '${project.url}';let vars = {};${configHooks}`;
25+
return `global.BASE_URL = configuration.baseUrl || '${project.url}';let vars = {};${configHooks}${snapshot ? snapshot : ""}`;
2626
} else {
2727
if (configHooks) {
2828
return {

0 commit comments

Comments
 (0)