Skip to content

Commit 6508f48

Browse files
committed
refactor: add default parameter for Runner.create
Previously, Runner.create took an empty object when initializing with undefined values which differed from that documented in README. Added a default parameter for the same fixing this.
1 parent e6e2808 commit 6508f48

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/runner.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,14 @@ export class Runner {
5353
getos((err, result) => (this.osInfo = inspect(result || err)));
5454
}
5555

56-
public static async create(opts: {
57-
installer?: Installer;
58-
fiddleFactory?: FiddleFactory;
59-
paths?: Partial<Paths>;
60-
versions?: Versions;
61-
}): Promise<Runner> {
56+
public static async create(
57+
opts: {
58+
installer?: Installer;
59+
fiddleFactory?: FiddleFactory;
60+
paths?: Partial<Paths>;
61+
versions?: Versions;
62+
} = {},
63+
): Promise<Runner> {
6264
const paths = Object.freeze({ ...DefaultPaths, ...(opts.paths || {}) });
6365
const installer = opts.installer || new Installer(paths);
6466
const versions = opts.versions || (await ElectronVersions.create(paths));

tests/runner.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ describe('Runner', () => {
6363

6464
describe('create()', () => {
6565
it('creates a Runner object with the expected properties', async () => {
66-
const runner = await Runner.create({});
66+
const runner = await Runner.create();
6767
expect(Object.keys(runner)).toEqual([
6868
'installer',
6969
'versions',
@@ -171,7 +171,7 @@ describe('Runner', () => {
171171
])(
172172
'can handle a test with the `%s` status',
173173
async (status, event, exitCode) => {
174-
const runner = await Runner.create({});
174+
const runner = await Runner.create();
175175
const fakeSubprocess = new EventEmitter();
176176
runner.spawn = jest.fn().mockResolvedValue(fakeSubprocess);
177177

0 commit comments

Comments
 (0)