Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.

Commit 6b4de15

Browse files
committed
refactor: use the world instead of constants
1 parent 4bc5736 commit 6b4de15

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

features/support/steps.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,10 @@ const {
1616
} = require('cucumber');
1717

1818

19-
const DREDD_BIN = path.join(process.cwd(), 'node_modules', '.bin', 'dredd');
20-
21-
2219
Before(function hook() {
2320
this.dir = fs.mkdtempSync(path.join(os.tmpdir(), 'dredd-hooks-template-'));
21+
this.dreddBin = path.join(process.cwd(), 'node_modules', '.bin', 'dredd');
2422
this.env = { ...process.env };
25-
this.commands = [];
2623
this.dataSent = '';
2724
});
2825

@@ -32,8 +29,8 @@ After(async function hook() {
3229
});
3330

3431

35-
Given('I have Dredd installed', () => {
36-
which.sync(DREDD_BIN); // throws if not found
32+
Given('I have Dredd installed', function step() {
33+
which.sync(this.dreddBin); // throws if not found
3734
});
3835

3936
Given(/^a file named "([^"]+)" with:$/, function step(filename, content) {
@@ -46,7 +43,7 @@ Given(/^I set the environment variables to:$/, function step(env) {
4643

4744

4845
When(/^I run `dredd ([^`]+)`$/, function step(args) {
49-
this.proc = childProcess.spawnSync(`${DREDD_BIN} ${args}`, [], {
46+
this.proc = childProcess.spawnSync(`${this.dreddBin} ${args}`, [], {
5047
shell: true,
5148
cwd: this.dir,
5249
env: this.env,

0 commit comments

Comments
 (0)