From 42b7a65a184e2300b085a28176012064153bb269 Mon Sep 17 00:00:00 2001 From: Domenic Del Nano Date: Sat, 6 Jun 2020 22:18:49 +0000 Subject: [PATCH 1/7] Changes to get the cucumber test suite working again --- .gitignore | 1 + .travis.yml | 3 +- Dockerfile | 5 +- Makefile | 21 +- apiary.apib | 4 +- composer.json | 3 + features/execution_order.feature | 20 +- features/failing_transaction.feature | 21 +- features/hook_handlers.feature | 24 +- features/multiple_hookfiles.feature | 26 +- features/server_configuration.feature | 10 +- features/support/steps.js | 196 ++ features/tcp_server.feature | 37 +- features/wildcard_hooks.feature | 27 +- package-lock.json | 2410 +++++++++++++++++++++++++ package.json | 12 + server.js | 14 + 17 files changed, 2718 insertions(+), 116 deletions(-) create mode 100644 features/support/steps.js create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 server.js diff --git a/.gitignore b/.gitignore index a088589..2a9dcf0 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ vendor/ tmp examples/laravel/vendor/ .phpcomplete_extended/ +node_modules diff --git a/.travis.yml b/.travis.yml index d8c848c..8e6d94a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ language: php before_install: - nvm install node && nvm use node - npm install -g dredd --no-optional - - bundle install - composer install php: - "5.4" @@ -15,4 +14,4 @@ php: script: - vendor/bin/phpcs --standard=psr2 -n src/ - vendor/bin/phpunit - - bundle exec cucumber + - npx cucumber-js features --require features/support --tags "not @skip" diff --git a/Dockerfile b/Dockerfile index a17c8ba..01d16eb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,10 @@ FROM php RUN apt-get update \ && apt-get install -y \ wget \ + nodejs \ + npm \ git \ + net-tools \ && wget https://getcomposer.org/installer \ && chmod +x installer \ - && php installer --install-dir=/usr/local/bin/ --filename=composer + && php installer --install-dir=/usr/local/bin/ --filename=composer \ diff --git a/Makefile b/Makefile index b247064..283db2d 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,22 @@ .PHONY: lint test -test: lint - vendor/bin/phpunit - bundle exec cucumber + +IMAGE := dredd-hooks-php +DOCKER_RUN := docker run -it --init -v $$(pwd):/src -w /src $(IMAGE) + +build: + docker build -t $(IMAGE) . + +test: build lint node_modules + $(DOCKER_RUN) bash -c \ + "vendor/bin/phpunit && \ + npx cucumber-js features --require features/support/ --tags 'not @skip'" lint: vendor - vendor/bin/phpcs --standard=psr2 -n src/ + $(DOCKER_RUN) vendor/bin/phpcs --standard=psr2 -n src/ vendor: - composer install + $(DOCKER_RUN) composer install + +node_modules: + $(DOCKER_RUN) npm install diff --git a/apiary.apib b/apiary.apib index f13a8ed..1bf3679 100644 --- a/apiary.apib +++ b/apiary.apib @@ -1,4 +1,4 @@ # My Api ## GET /message -+ Response 200 (text/html;charset=utf-8) - Hello World! + ++ Response 200 (text/html) diff --git a/composer.json b/composer.json index 203b37e..1e4c45e 100644 --- a/composer.json +++ b/composer.json @@ -14,6 +14,9 @@ "php": ">=5.4" }, "bin": ["bin/dredd-hooks-php"], + "scripts": { + "dredd-hooks-php": "dredd-hooks-php" + }, "require-dev": { "phpunit/phpunit": "~4.0", "mockery/mockery": "0.9.*", diff --git a/features/execution_order.feature b/features/execution_order.feature index f9383b2..ed9da40 100644 --- a/features/execution_order.feature +++ b/features/execution_order.feature @@ -1,27 +1,19 @@ Feature: Execution order Background: - Given I have "dredd-hooks-php" command installed - And I have "dredd" command installed - And a file named "server.rb" with: - """ - require 'sinatra' - get '/message' do - "Hello World!\n\n" - end - """ - + Given I have dredd-hooks-php installed + And I have Dredd installed + And a file "server.js" with a server responding on "http://localhost:4567/message" with "Hello World!" And a file named "apiary.apib" with: """ # My Api ## GET /message - + Response 200 (text/html;charset=utf-8) - Hello World! + + Response 200 (text/html) """ @announce Scenario: - Given a file named "hooks/execution_order_hookfile.php" with: + Given a file named "execution_order_hookfile.php" with: """ fail = true; echo "Yay! Failed!"; + flush(); }); """ - When I run `dredd ./apiary.apib http://localhost:4567 --server "ruby server.rb" --language "dredd-hooks-php" --hookfiles hooks/failedhook.php` + When I run `dredd ./apiary.apib http://localhost:4567 --server "nodejs server.js" --language php --hookfiles failedhook.php --loglevel debug` Then the exit status should be 1 And the output should contain: """ diff --git a/features/hook_handlers.feature b/features/hook_handlers.feature index 109d348..635fc03 100644 --- a/features/hook_handlers.feature +++ b/features/hook_handlers.feature @@ -1,23 +1,15 @@ Feature: Hook handlers Background: - Given I have "dredd-hooks-php" command installed - And I have "dredd" command installed - And a file named "server.rb" with: - """ - require 'sinatra' - get '/message' do - "Hello World!\n\n" - end - """ - + Given I have dredd-hooks-php installed + Given I have Dredd installed And a file named "apiary.apib" with: """ # My Api ## GET /message - + Response 200 (text/html;charset=utf-8) - Hello World! + + Response 200 (text/html) """ + And a file "server.js" with a server responding on "http://localhost:4567/message" with "Hello World!" @announce Scenario: @@ -30,12 +22,14 @@ Feature: Hook handlers Hooks::before('/message > GET', function(&$transaction) use ($key) { - var_dump("before hook handled"); + fprintf(STDERR, "before hook handled"); + flush(); }); Hooks::after('/message > GET', function(&$transaction) use ($key) { - echo "after hook handled"; + fprintf(STDERR, "after hook handled"); + flush(); }); Hooks::beforeValidation('/message > GET', function(&$transaction) use ($key) { @@ -69,7 +63,7 @@ Feature: Hook handlers }); """ - When I run `dredd ./apiary.apib http://localhost:4567 --server "ruby server.rb" --language dredd-hooks-php --hookfiles ./hookfile.php` + When I run `dredd ./apiary.apib http://localhost:4567 --server "node server.js" --language php --hookfiles ./hookfile.php --loglevel debug` Then the exit status should be 0 Then the output should contain: """ diff --git a/features/multiple_hookfiles.feature b/features/multiple_hookfiles.feature index 6eec68f..0f65518 100644 --- a/features/multiple_hookfiles.feature +++ b/features/multiple_hookfiles.feature @@ -1,27 +1,19 @@ Feature: Multiple hook files with a glob Background: - Given I have "dredd-hooks-php" command installed - And I have "dredd" command installed - And a file named "server.rb" with: - """ - require 'sinatra' - get '/message' do - "Hello World!\n\n" - end - """ - + Given I have dredd-hooks-php installed + Given I have Dredd installed And a file named "apiary.apib" with: """ # My Api ## GET /message - + Response 200 (text/html;charset=utf-8) - Hello World! + + Response 200 (text/html) """ + And a file "server.js" with a server responding on "http://localhost:4567/message" with "Hello World!" @announce Scenario: - Given a file named "hooks/hookfile1.php" with: + Given a file named "hookfile1.php" with: """ { + try { + process.kill(pid, 'SIGKILL'); + } catch (error) { + // re-throw except in case it is 'ESRCH' (process cannot be found) + if (error.code !== 'ESRCH') throw error; + } + }); + // remove the temporary directory + return fs.remove(this.dir); +}); + + +Given('I have Dredd installed', function step() { + which.sync(this.dreddBin); // throws if not found +}); + +Given('I have dredd-hooks-php installed', function step() { + which.sync("dredd-hooks-php"); // throws if not found +}); + +Given('a file {string} with a server responding on {string} to wildcard hooks', function step(filename, fullURL) { + const urlParts = url.parse(fullURL); + const content = `require('http') + .createServer((req, res) => { + if (req.method === 'GET') { + res.writeHead(200); + } else if (req.method === 'POST') { + res.writeHead(201); + } else if (req.method === 'DELETE') { + res.writeHead(204); + } else { + res.writeHead(500); + } + res.end(''); + }) + .listen(${urlParts.port}); +`; + fs.writeFileSync(path.join(this.dir, filename), content); +}); + +Given('a file {string} with a server responding on {string} with {string}', function step(filename, fullURL, body) { + const urlParts = url.parse(fullURL); + const content = ` +require('http') + .createServer((req, res) => { + if (req.url === '${urlParts.path}') { + res.writeHead(200, { 'Content-Type': 'text/html' }); + res.end(''); + } else { + res.writeHead(500); + res.end(); + } + }) + .listen(${urlParts.port}); +`; + fs.writeFileSync(path.join(this.dir, filename), content); +}); + +Given('a file named {string} with:', function step(filename, content) { + fs.writeFileSync(path.join(this.dir, filename), content); +}); + +Given('I set the environment variables to:', function step(env) { + this.env = { ...this.env, ...env.rowsHash() }; +}); + + +When(/^I run `dredd ([^`]+)`$/, function step(args) { + this.proc = childProcess.spawnSync(`${this.dreddBin} ${args}`, [], { + shell: true, + cwd: this.dir, + env: this.env, + }); +}); + +When('I run {string} interactively, I wait for output to contain {string}', function step(command, output, callback) { + proc = childProcess.spawn(command, [], { + shell: true, + cwd: this.dir, + env: this.env, + }); + function read(data) { + if (data.toString().includes(output)) { + proc.stdout.removeListener('data', read); + proc.stderr.removeListener('data', read); + callback(); + } + } + + proc.stdout.on('data', read); + proc.stderr.on('data', read); +}); + + +When('I wait for output to contain {string}', function step(output, callback) { + const { proc } = this; + + function read(data) { + throw new Error(data.toString()); + if (data.toString().includes(output)) { + proc.stdout.removeListener('data', read); + proc.stderr.removeListener('data', read); + setTimeout(callback, 4500); + } + } + + proc.stdout.on('data', read); + proc.stderr.on('data', read); +}); + +When('I connect to the server', async function step() { + this.socket = new net.Socket(); + const connect = util.promisify(this.socket.connect.bind(this.socket)); + await connect(61321, '127.0.0.1'); +}); + +When('It should start listening on localhost port {int}', async function step(port) { + this.socket = new net.Socket(); + const connect = util.promisify(this.socket.connect.bind(this.socket)); + await connect(port, '127.0.0.1'); +}); + +When('I send a JSON message to the socket:', function step(message) { + this.socket.write(message); + this.dataSent += message; +}); + +When('I send a newline character as a message delimiter to the socket', function step() { + this.socket.write('\n'); +}); + + +Then('the exit status should be {int}', function step(status) { + expect(this.proc.status).to.equal(status); +}); + +Then('the output should contain:', function step(output) { + expect(this.proc.stdout.toString() + this.proc.stderr.toString()).to.contain(output); +}); + +Then('it should start listening on localhost port {int}', async function step(port) { + this.socket = new net.Socket(); + const connect = util.promisify(this.socket.connect.bind(this.socket)); + await connect(port, '127.0.0.1'); // throws if there's an issue + this.socket.end(); +}); + +Then('I should receive the same response', function step(callback) { + this.socket.on('data', (data) => { + const dataReceived = JSON.parse(data.toString()); + const dataSent = JSON.parse(this.dataSent); + expect(dataReceived).to.deep.equal(dataSent); + callback(); + }); +}); + +Then('I should be able to gracefully disconnect', function step() { + this.socket.end(); +}); diff --git a/features/tcp_server.feature b/features/tcp_server.feature index 8ac90d7..2a92963 100644 --- a/features/tcp_server.feature +++ b/features/tcp_server.feature @@ -1,66 +1,67 @@ +@skip Feature: TCP server and messages Scenario: TCP server - When I run `dredd-hooks-php` interactively - And I wait for output to contain "Starting" - Then It should start listening on localhost port "61321" + Given I have dredd-hooks-php installed + When I run "dredd-hooks-php" interactively, I wait for output to contain "Starting" + Then it should start listening on localhost port 61321 Scenario: Message exchange for event beforeEach - Given I run `dredd-hooks-php` interactively - When I wait for output to contain "Starting" + Given I have dredd-hooks-php installed + When I run "dredd-hooks-php" interactively, I wait for output to contain "Starting" And I connect to the server And I send a JSON message to the socket: """ {"event": "beforeEach", "uuid": "1234-abcd", "data": {"key":"value"}} """ And I send a newline character as a message delimiter to the socket - Then I should receive same response + Then I should receive the same response And I should be able to gracefully disconnect Scenario: Message exchange for event beforeEachValidation - Given I run `dredd-hooks-php` interactively - When I wait for output to contain "Starting" + Given I have dredd-hooks-php installed + When I run "dredd-hooks-php" interactively, I wait for output to contain "Starting" And I connect to the server And I send a JSON message to the socket: """ {"event": "beforeEachValidation", "uuid": "2234-abcd", "data": {"key":"value"}} """ And I send a newline character as a message delimiter to the socket - Then I should receive same response + Then I should receive the same response And I should be able to gracefully disconnect Scenario: Message exchange for event afterEach - Given I run `dredd-hooks-php` interactively - When I wait for output to contain "Starting" + Given I have dredd-hooks-php installed + When I run "dredd-hooks-php" interactively, I wait for output to contain "Starting" And I connect to the server And I send a JSON message to the socket: """ {"event": "afterEach", "uuid": "3234-abcd", "data": {"key":"value"}} """ And I send a newline character as a message delimiter to the socket - Then I should receive same response + Then I should receive the same response And I should be able to gracefully disconnect Scenario: Message exchange for event beforeAll - Given I run `dredd-hooks-php` interactively - When I wait for output to contain "Starting" + Given I have dredd-hooks-php installed + When I run "dredd-hooks-php" interactively, I wait for output to contain "Starting" And I connect to the server And I send a JSON message to the socket: """ {"event": "beforeAll", "uuid": "4234-abcd", "data": {"key":"value"}} """ And I send a newline character as a message delimiter to the socket - Then I should receive same response + Then I should receive the same response And I should be able to gracefully disconnect Scenario: Message exchange for event afterAll - Given I run `dredd-hooks-php` interactively - When I wait for output to contain "Starting" + Given I have dredd-hooks-php installed + When I run "dredd-hooks-php" interactively, I wait for output to contain "Starting" And I connect to the server And I send a JSON message to the socket: """ {"event": "afterAll", "uuid": "5234-abcd", "data": {"key":"value"}} """ And I send a newline character as a message delimiter to the socket - Then I should receive same response + Then I should receive the same response And I should be able to gracefully disconnect diff --git a/features/wildcard_hooks.feature b/features/wildcard_hooks.feature index e0ed80d..2a71093 100644 --- a/features/wildcard_hooks.feature +++ b/features/wildcard_hooks.feature @@ -1,25 +1,9 @@ Feature: Wildcards in Hooks Background: - Given I have "dredd-hooks-php" command installed - And I have "dredd" command installed - And a file named "wildcards.rb" with: - """ - require 'sinatra' - - post '/categories' do - [201, ''] - end - - get '/categories/:id' do - [200, ''] - end - - delete '/categories/:id' do - [204, ''] - end - """ - + Given I have dredd-hooks-php installed + Given I have Dredd installed + And a file "server.js" with a server responding on "http://localhost:4567" to wildcard hooks And a file named "wildcards.apib" with: """ FORMAT: 1A @@ -44,7 +28,7 @@ Feature: Wildcards in Hooks @announce Scenario: - Given a file named "hooks/wildcards.php" with: + Given a file named "wildcards.php" with: """ { +// console.log(req) +// if (req.url === '/message') { +// res.writeHead(200, { 'Content-Type': 'text/html' }); +// res.end(''); +// } else { +// res.writeHead(500); +// res.end(); +// } +// }) +// .listen(4567); +process.env.PATH = `${process.env.PATH}:${process.cwd()}/bin` +console.log(process.env.PATH) From 3528004dcefca5bd65d7fffa85b465c7fce56875 Mon Sep 17 00:00:00 2001 From: Domenic Del Nano Date: Sat, 6 Jun 2020 22:19:15 +0000 Subject: [PATCH 2/7] Remove all ruby files from the repo --- Gemfile | 5 --- Gemfile.lock | 46 ------------------------ features/step_definitions/dredd_steps.rb | 46 ------------------------ features/support/env.rb | 12 ------- features/support/server.rb | 5 --- server.rb | 4 --- 6 files changed, 118 deletions(-) delete mode 100644 Gemfile delete mode 100644 Gemfile.lock delete mode 100644 features/step_definitions/dredd_steps.rb delete mode 100644 features/support/env.rb delete mode 100644 features/support/server.rb delete mode 100644 server.rb diff --git a/Gemfile b/Gemfile deleted file mode 100644 index f355ae3..0000000 --- a/Gemfile +++ /dev/null @@ -1,5 +0,0 @@ -# A sample Gemfile -source "https://rubygems.org" - -gem "aruba" -gem "sinatra" diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index 7b778d0..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,46 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - aruba (0.8.0) - childprocess (~> 0.5.6) - contracts (~> 0.9) - cucumber (>= 1.3.19) - rspec-expectations (>= 2.99) - builder (3.2.2) - childprocess (0.5.6) - ffi (~> 1.0, >= 1.0.11) - contracts (0.10) - cucumber (2.0.1) - builder (>= 2.1.2) - cucumber-core (~> 1.2.0) - diff-lcs (>= 1.1.3) - gherkin (~> 2.12) - multi_json (>= 1.7.5, < 2.0) - multi_test (>= 0.1.2) - cucumber-core (1.2.0) - gherkin (~> 2.12.0) - diff-lcs (1.2.5) - ffi (1.9.10) - gherkin (2.12.2) - multi_json (~> 1.3) - multi_json (1.11.2) - multi_test (0.1.2) - rack (1.6.4) - rack-protection (1.5.3) - rack - rspec-expectations (3.3.0) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.3.0) - rspec-support (3.3.0) - sinatra (1.4.6) - rack (~> 1.4) - rack-protection (~> 1.4) - tilt (>= 1.3, < 3) - tilt (2.0.1) - -PLATFORMS - ruby - -DEPENDENCIES - aruba - sinatra diff --git a/features/step_definitions/dredd_steps.rb b/features/step_definitions/dredd_steps.rb deleted file mode 100644 index f756d6e..0000000 --- a/features/step_definitions/dredd_steps.rb +++ /dev/null @@ -1,46 +0,0 @@ -require 'json' -require 'socket' - - -Given(/^I have "([^"]*)" command installed$/) do |command| - if command == "dredd-hooks-php" - is_present = system("which bin/#{command} > /dev/null 2>&1") - else - is_present = system("which #{command} > /dev/null 2>&1") - raise "Command #{command} is not present in the system" if not is_present - end -end - -Given(/^server under test is running$/) do -end - -Then(/^It should start listening on localhost port "([^"]*)"$/) do |port| - @client = TCPSocket.new 'localhost', port - @client.close -end - -Given(/^I connect to the server$/) do - @client = TCPSocket.new 'localhost', 61321 -end - -When(/^I send a JSON message to the socket:$/) do |string| - @data_sent = string - @client.send @data_sent, 0 -end - -When(/^I send a newline character as a message delimiter to the socket$/) do - @client.send "\n", 0 -end - -Then(/^I should receive same response$/) do - sleep 1 - data_received = @client.readline "\n" - if JSON.parse(data_received) != JSON.parse(@data_sent) - @client.close! - raise "Data received:\n#{data_received}\nDoesn't match data sent: #{@data_sent}\n" - end -end - -Then(/^I should be able to gracefully disconnect$/) do - @client.close -end diff --git a/features/support/env.rb b/features/support/env.rb deleted file mode 100644 index 70cc77d..0000000 --- a/features/support/env.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'aruba/cucumber' -require "sinatra/base" - -Before do - puts "Killing server..." - system "for i in `ps axu | grep 'server.rb' | awk '{print $2}'`; do kill -9 $i; done > /dev/null 2>&1" - puts "Killing handler..." - system "for i in `ps axu | grep 'dredd-hooks'| awk '{print $2}'`; do kill -9 $i; done > /dev/null 2>&1" - sleep 3 - - @aruba_timeout_seconds = 10 -end \ No newline at end of file diff --git a/features/support/server.rb b/features/support/server.rb deleted file mode 100644 index 76f511e..0000000 --- a/features/support/server.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'sinatra' - -get '/message' do - "Hello World!" -end diff --git a/server.rb b/server.rb deleted file mode 100644 index dd11671..0000000 --- a/server.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'sinatra' -get '/message' do - "Hello World!\n\n" -end \ No newline at end of file From 16d168d9b0e7d136511de6db4492fe7d12de4cf6 Mon Sep 17 00:00:00 2001 From: Domenic Del Nano Date: Sat, 6 Jun 2020 22:27:34 +0000 Subject: [PATCH 3/7] Update README with slightly better contributor testing notes --- README.md | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 05ea90b..c6e516f 100644 --- a/README.md +++ b/README.md @@ -101,24 +101,17 @@ This would execute for any transactions "nested" underneath 'Admin'. For exampl ## Tests -When making a contribution it is very important to not break existing functionality. This project uses PHPUnit for unit testing and -uses ruby based aruba. +When making a contribution it is very important to not break existing functionality. This project uses PHPUnit for unit testing and uses nodejs for Cucumber tests. + +### Dependencies +- Docker. This takes care of the php and nodejs dependencies. The test suite can be run by following these steps: -1. Install PHPUnit and cucumber locally. From the project root directory run - - `composer install` - - `bundle install` - -2. Execute PHPUnit tests - - `vendor/bin/phpunit` - -3. Run aruba/cucumber tests - - `bundle exec cucumber` +1. Run the phpunit and Cucumber tests +```bash +make test +``` More details about the integration test can be found in the [dredd-hooks-template repo](https://github.com/apiaryio/dredd-hooks-template) From 1fdb28235c7bf6414c225b667f64e073495b8512 Mon Sep 17 00:00:00 2001 From: Domenic Del Nano Date: Sat, 6 Jun 2020 22:30:24 +0000 Subject: [PATCH 4/7] Remove unnecessary changes --- apiary.apib | 4 ---- composer.json | 3 --- server.js | 14 -------------- 3 files changed, 21 deletions(-) delete mode 100644 apiary.apib delete mode 100644 server.js diff --git a/apiary.apib b/apiary.apib deleted file mode 100644 index 1bf3679..0000000 --- a/apiary.apib +++ /dev/null @@ -1,4 +0,0 @@ -# My Api -## GET /message - -+ Response 200 (text/html) diff --git a/composer.json b/composer.json index 1e4c45e..203b37e 100644 --- a/composer.json +++ b/composer.json @@ -14,9 +14,6 @@ "php": ">=5.4" }, "bin": ["bin/dredd-hooks-php"], - "scripts": { - "dredd-hooks-php": "dredd-hooks-php" - }, "require-dev": { "phpunit/phpunit": "~4.0", "mockery/mockery": "0.9.*", diff --git a/server.js b/server.js deleted file mode 100644 index 82deaeb..0000000 --- a/server.js +++ /dev/null @@ -1,14 +0,0 @@ -// require('http') -// .createServer((req, res) => { -// console.log(req) -// if (req.url === '/message') { -// res.writeHead(200, { 'Content-Type': 'text/html' }); -// res.end(''); -// } else { -// res.writeHead(500); -// res.end(); -// } -// }) -// .listen(4567); -process.env.PATH = `${process.env.PATH}:${process.cwd()}/bin` -console.log(process.env.PATH) From f35b3c377947f22e2b85cf390eedb477ee987eb2 Mon Sep 17 00:00:00 2001 From: Domenic Del Nano Date: Sat, 6 Jun 2020 22:36:18 +0000 Subject: [PATCH 5/7] Update travis build to run npm install --- .travis.yml | 1 + package-lock.json | 251 +++++++++++++++++++++++++++++++++++++--------- package.json | 4 +- 3 files changed, 207 insertions(+), 49 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8e6d94a..c233d93 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ language: php before_install: - nvm install node && nvm use node - npm install -g dredd --no-optional + - npm install - composer install php: - "5.4" diff --git a/package-lock.json b/package-lock.json index 034d104..da109d1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,16 @@ "regenerator-runtime": "0.13.5" } }, + "@babel/runtime-corejs3": { + "version": "7.10.2", + "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.10.2.tgz", + "integrity": "sha512-+a2M/u7r15o3dV1NEizr9bRi+KUVnrs/qYxF0Z06DAPx/4VCWaz1WA7EcbE+uqGgt39lp5akWGmHsTseIkHkHg==", + "dev": true, + "requires": { + "core-js-pure": "3.6.5", + "regenerator-runtime": "0.13.5" + } + }, "ajv": { "version": "6.12.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.2.tgz", @@ -112,12 +122,12 @@ "dev": true }, "assertion-error-formatter": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/assertion-error-formatter/-/assertion-error-formatter-2.0.1.tgz", - "integrity": "sha512-cjC3jUCh9spkroKue5PDSKH5RFQ/KNuZJhk3GwHYmB/8qqETxLOmMdLH+ohi/VukNzxDlMvIe7zScvLoOdhb6Q==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/assertion-error-formatter/-/assertion-error-formatter-3.0.0.tgz", + "integrity": "sha512-6YyAVLrEze0kQ7CmJfUgrLHb+Y7XghmL2Ie7ijVa2Y9ynP3LV+VDiwFk62Dn0qtqbmY0BT0ss6p1xxpiF2PYbQ==", "dev": true, "requires": { - "diff": "3.5.0", + "diff": "4.0.2", "pad-right": "0.2.2", "repeat-string": "1.6.1" } @@ -336,6 +346,12 @@ "integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==", "dev": true }, + "core-js-pure": { + "version": "3.6.5", + "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.6.5.tgz", + "integrity": "sha512-lacdXOimsiD0QyNf9BC/mxivNJ/ybBGJXQFKzRekp1WTHoVUWsUHEn+2T8GJAzzIhyOuXA+gOxCVN3l+5PLPUA==", + "dev": true + }, "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", @@ -356,55 +372,85 @@ } }, "cucumber": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cucumber/-/cucumber-5.1.0.tgz", - "integrity": "sha512-zrl2VYTBRgvxucwV2GKAvLqcfA1Naeax8plPvWgPEzl3SCJiuPPv3WxBHIRHtPYcEdbHDR6oqLpZP4bJ8UIdmA==", + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cucumber/-/cucumber-6.0.5.tgz", + "integrity": "sha512-x+W9Fwk6TvcapQsYMxwFU5AsQJDOIJVGrPKmH15OC7jzb9/Dk7Hb0ZAyw4WcpaDcUDRc8bi2k2yJejDp5eTRlg==", "dev": true, "requires": { - "@babel/polyfill": "7.10.1", - "assertion-error-formatter": "2.0.1", + "assertion-error-formatter": "3.0.0", "bluebird": "3.7.2", "cli-table3": "0.5.1", "colors": "1.4.0", - "commander": "2.20.3", - "cross-spawn": "6.0.5", - "cucumber-expressions": "6.6.2", - "cucumber-tag-expressions": "1.1.1", + "commander": "3.0.2", + "cucumber-expressions": "8.3.0", + "cucumber-tag-expressions": "2.0.3", "duration": "0.2.2", - "escape-string-regexp": "1.0.5", - "figures": "2.0.0", - "gherkin": "5.1.0", + "escape-string-regexp": "2.0.0", + "figures": "3.2.0", + "gherkin": "5.0.0", "glob": "7.1.4", - "indent-string": "3.2.0", + "indent-string": "4.0.0", "is-generator": "1.0.3", - "is-stream": "1.1.0", + "is-stream": "2.0.0", "knuth-shuffle-seeded": "1.0.6", "lodash": "4.17.15", "mz": "2.7.0", "progress": "2.0.3", "resolve": "1.17.0", - "serialize-error": "3.0.0", + "serialize-error": "4.1.0", "stack-chain": "2.0.0", "stacktrace-js": "2.0.2", - "string-argv": "0.1.1", + "string-argv": "0.3.1", "title-case": "2.1.1", "util-arity": "1.1.0", "verror": "1.10.0" + }, + "dependencies": { + "commander": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", + "integrity": "sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==", + "dev": true + }, + "escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true + }, + "figures": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "dev": true, + "requires": { + "escape-string-regexp": "1.0.5" + }, + "dependencies": { + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + } + } + } } }, "cucumber-expressions": { - "version": "6.6.2", - "resolved": "https://registry.npmjs.org/cucumber-expressions/-/cucumber-expressions-6.6.2.tgz", - "integrity": "sha512-WcFSVBiWNLJbIcAAC3t/ACU46vaOKfe1UIF5H3qveoq+Y4XQm9j3YwHurQNufRKBBg8nCnpU7Ttsx7egjS3hwA==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/cucumber-expressions/-/cucumber-expressions-8.3.0.tgz", + "integrity": "sha512-cP2ya0EiorwXBC7Ll7Cj7NELYbasNv9Ty42L4u7sso9KruWemWG1ZiTq4PMqir3SNDSrbykoqI5wZgMbLEDjLQ==", "dev": true, "requires": { - "becke-ch--regex--s0-0-v1--base--pl--lib": "1.4.0" + "becke-ch--regex--s0-0-v1--base--pl--lib": "1.4.0", + "xregexp": "4.3.0" } }, "cucumber-tag-expressions": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/cucumber-tag-expressions/-/cucumber-tag-expressions-1.1.1.tgz", - "integrity": "sha1-f1x7cACbwrZmWRv+ZIVFeL7e6Fo=", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/cucumber-tag-expressions/-/cucumber-tag-expressions-2.0.3.tgz", + "integrity": "sha512-+x5j1IfZrBtbvYHuoUX0rl4nUGxaey6Do9sM0CABmZfDCcWXuuRm1fQeCaklIYQgOFHQ6xOHvDSdkMHHpni6tQ==", "dev": true }, "curl-trace-parser": { @@ -488,9 +534,9 @@ "dev": true }, "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "dev": true }, "drange": { @@ -543,6 +589,101 @@ "glob": "7.1.4", "pidtree": "0.3.0", "which": "1.3.1" + }, + "dependencies": { + "assertion-error-formatter": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error-formatter/-/assertion-error-formatter-2.0.1.tgz", + "integrity": "sha512-cjC3jUCh9spkroKue5PDSKH5RFQ/KNuZJhk3GwHYmB/8qqETxLOmMdLH+ohi/VukNzxDlMvIe7zScvLoOdhb6Q==", + "dev": true, + "requires": { + "diff": "3.5.0", + "pad-right": "0.2.2", + "repeat-string": "1.6.1" + } + }, + "cucumber": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cucumber/-/cucumber-5.1.0.tgz", + "integrity": "sha512-zrl2VYTBRgvxucwV2GKAvLqcfA1Naeax8plPvWgPEzl3SCJiuPPv3WxBHIRHtPYcEdbHDR6oqLpZP4bJ8UIdmA==", + "dev": true, + "requires": { + "@babel/polyfill": "7.10.1", + "assertion-error-formatter": "2.0.1", + "bluebird": "3.7.2", + "cli-table3": "0.5.1", + "colors": "1.4.0", + "commander": "2.20.3", + "cross-spawn": "6.0.5", + "cucumber-expressions": "6.6.2", + "cucumber-tag-expressions": "1.1.1", + "duration": "0.2.2", + "escape-string-regexp": "1.0.5", + "figures": "2.0.0", + "gherkin": "5.0.0", + "glob": "7.1.4", + "indent-string": "3.2.0", + "is-generator": "1.0.3", + "is-stream": "1.1.0", + "knuth-shuffle-seeded": "1.0.6", + "lodash": "4.17.15", + "mz": "2.7.0", + "progress": "2.0.3", + "resolve": "1.17.0", + "serialize-error": "3.0.0", + "stack-chain": "2.0.0", + "stacktrace-js": "2.0.2", + "string-argv": "0.1.1", + "title-case": "2.1.1", + "util-arity": "1.1.0", + "verror": "1.10.0" + } + }, + "cucumber-expressions": { + "version": "6.6.2", + "resolved": "https://registry.npmjs.org/cucumber-expressions/-/cucumber-expressions-6.6.2.tgz", + "integrity": "sha512-WcFSVBiWNLJbIcAAC3t/ACU46vaOKfe1UIF5H3qveoq+Y4XQm9j3YwHurQNufRKBBg8nCnpU7Ttsx7egjS3hwA==", + "dev": true, + "requires": { + "becke-ch--regex--s0-0-v1--base--pl--lib": "1.4.0" + } + }, + "cucumber-tag-expressions": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/cucumber-tag-expressions/-/cucumber-tag-expressions-1.1.1.tgz", + "integrity": "sha1-f1x7cACbwrZmWRv+ZIVFeL7e6Fo=", + "dev": true + }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, + "indent-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", + "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", + "dev": true + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "serialize-error": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-3.0.0.tgz", + "integrity": "sha512-+y3nkkG/go1Vdw+2f/+XUXM1DXX1XcxTl99FfiD/OEPUNw4uo0i6FKABfTAN5ZcgGtjTRZcEbxcE/jtXbEY19A==", + "dev": true + }, + "string-argv": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.1.1.tgz", + "integrity": "sha512-El1Va5ehZ0XTj3Ekw4WFidXvTmt9SrC0+eigdojgtJMVtPkF0qbBe9fyNSl9eQf+kUHnTSQxdQYzuHfZy8V+DQ==", + "dev": true + } } }, "dredd-transactions": { @@ -954,9 +1095,9 @@ } }, "gherkin": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/gherkin/-/gherkin-5.1.0.tgz", - "integrity": "sha1-aEu7A63STq9731RPWAM+so+zxtU=", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/gherkin/-/gherkin-5.0.0.tgz", + "integrity": "sha1-lt70EZjsOQgli1Ea909lWidk0qE=", "dev": true }, "glob": { @@ -1064,9 +1205,9 @@ } }, "indent-string": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", - "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", "dev": true }, "inflight": { @@ -1163,9 +1304,9 @@ } }, "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", "dev": true }, "is-symbol": { @@ -1891,10 +2032,13 @@ "dev": true }, "serialize-error": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-3.0.0.tgz", - "integrity": "sha512-+y3nkkG/go1Vdw+2f/+XUXM1DXX1XcxTl99FfiD/OEPUNw4uo0i6FKABfTAN5ZcgGtjTRZcEbxcE/jtXbEY19A==", - "dev": true + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-4.1.0.tgz", + "integrity": "sha512-5j9GgyGsP9vV9Uj1S0lDCvlsd+gc2LEPVK7HHHte7IyPwOD4lVQFeaX143gx3U5AnoCi+wbcb3mvaxVysjpxEw==", + "dev": true, + "requires": { + "type-fest": "0.3.1" + } }, "shebang-command": { "version": "1.2.0", @@ -2015,9 +2159,9 @@ } }, "string-argv": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.1.1.tgz", - "integrity": "sha512-El1Va5ehZ0XTj3Ekw4WFidXvTmt9SrC0+eigdojgtJMVtPkF0qbBe9fyNSl9eQf+kUHnTSQxdQYzuHfZy8V+DQ==", + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.1.tgz", + "integrity": "sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg==", "dev": true }, "string-width": { @@ -2235,6 +2379,12 @@ "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "dev": true }, + "type-fest": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.3.1.tgz", + "integrity": "sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ==", + "dev": true + }, "typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", @@ -2387,6 +2537,15 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, + "xregexp": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-4.3.0.tgz", + "integrity": "sha512-7jXDIFXh5yJ/orPn4SXjuVrWWoi4Cr8jfV1eHv9CixKSbU+jY4mxfrBwAuDvupPNKpMUY+FeIqsVw/JLT9+B8g==", + "dev": true, + "requires": { + "@babel/runtime-corejs3": "7.10.2" + } + }, "yaml-js": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/yaml-js/-/yaml-js-0.2.3.tgz", diff --git a/package.json b/package.json index 06f1af7..168c314 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,7 @@ }, "private": true, "devDependencies": { + "cucumber": "^6.0.5", "dredd-hooks-template": "1.1.8" }, - "dependencies": { - "why-is-node-running": "^2.1.2" - } } From 9cabdc34f30f072a0f600b68faba3d659bc5bfb1 Mon Sep 17 00:00:00 2001 From: Domenic Del Nano Date: Sat, 6 Jun 2020 22:38:34 +0000 Subject: [PATCH 6/7] Fix package.json issue --- package-lock.json | 13 ------------- package.json | 3 +-- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/package-lock.json b/package-lock.json index da109d1..e4de74a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2117,11 +2117,6 @@ "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=", "dev": true }, - "stackback": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", - "integrity": "sha1-Gsig2Ug4SNFpXkGLbQMaPDzmjjs=" - }, "stackframe": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/stackframe/-/stackframe-1.2.0.tgz", @@ -2483,14 +2478,6 @@ "isexe": "2.0.0" } }, - "why-is-node-running": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.1.2.tgz", - "integrity": "sha512-TwUeoRNMAWy8jAD8oFLtgmYKecZkH3yCtbQ17CYVCxd1WaPJAEB6oqkNgm0o+wIzxJi1oHUkOxMk0M/t5jCGeA==", - "requires": { - "stackback": "0.0.2" - } - }, "winston": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/winston/-/winston-2.4.0.tgz", diff --git a/package.json b/package.json index 168c314..6be6233 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ }, "private": true, "devDependencies": { - "cucumber": "^6.0.5", "dredd-hooks-template": "1.1.8" - }, + } } From 80015a3d58700fda62a0b1ed066ee761f0aa4987 Mon Sep 17 00:00:00 2001 From: Domenic Del Nano Date: Sat, 6 Jun 2020 22:45:12 +0000 Subject: [PATCH 7/7] Add cucumber back to package.json --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 6be6233..56198bd 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ }, "private": true, "devDependencies": { + "cucumber": "^6.0.5", "dredd-hooks-template": "1.1.8" } }