Skip to content

Commit

Permalink
Add Table parameter type support
Browse files Browse the repository at this point in the history
Signed-off-by: BugDiver <vinaysh@thoughtworks.com>
  • Loading branch information
BugDiver committed Sep 25, 2020
1 parent 6fa1c56 commit 49f1273
Show file tree
Hide file tree
Showing 21 changed files with 424 additions and 181 deletions.
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ package.json
package-lock.json
.eslintrc.js
src/gen
config.ts
config.ts
jest.config.js
launcher.js
6 changes: 4 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Node CI
name: test

on: [push, pull_request]

Expand Down Expand Up @@ -51,12 +51,14 @@ jobs:
needs: build-artifacts
strategy:
matrix:
node-version: [12.x, 14.x]
node-version: [12.x, 13.x, 14.x]
os: [macOS-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: BugDiver/setup-gauge@master
with:
gauge-version: master

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
deploy/
artifacts/
artifacts/
*.tgz
5 changes: 5 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.github
.vscode
test
src
gauge-proto
Expand All @@ -16,3 +18,6 @@ azure*
*.ps1
*.bat
docs
.eslintignore
.eslintrc.js
config.ts
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/zsh
#!/bin/bash

function checkCommand() {
command -v $1 >/dev/null 2>&1 || { echo >&2 "$1 is not installed, aborting."; exit 1; }
Expand Down
4 changes: 3 additions & 1 deletion config.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
import 'jest-ts-auto-mock';
import 'jest-ts-auto-mock';
import { tmpdir } from 'os';
process.env.gauge_screenshots_dir = tmpdir()
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ module.exports = {
"src/utils/*"
],
setupFiles: [
"<rootDir>config.ts"
"<rootDir>config.ts",
]
};
15 changes: 9 additions & 6 deletions launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ if (parseInt(version[0]) < 10) {
}

let stepImpl = `
import { Step } from "gauge-ts";
import { equal } from "assert";
import { Step, Table } from "gauge-ts";
import { strictEqual } from "assert";
export default class StepImplementation {
Expand All @@ -22,13 +22,16 @@ export default class StepImplementation {
@Step("The word <word> has <expectedCount> vowels.")
public async verifyVowelsCountInWord(word: string, expectedCount: number) {
equal(await this.countVowels(word), expectedCount);
strictEqual(this.countVowels(word), parseInt(expectedCount));
}
@Step("Almost all words have vowels <wordsTable>")
public async verifyVowelsCountInMultipleWords(wordsTable: any) {
for (const row of wordsTable.rows) {
equal(await this.countVowels(row.cells[0]), parseInt(row.cells[1]));
public async verifyVowelsCountInMultipleWords(table: Table) {
for (let row of table.getTableRows()) {
let word: string = row.getCell("Word");
let expectedCount = parseInt(row.getCell("Vowel Count"));
let actualCount = this.countVowels(word);
strictEqual(expectedCount, actualCount);
}
}
Expand Down
Loading

0 comments on commit 49f1273

Please sign in to comment.