Skip to content

Commit

Permalink
Fix tsconfig-paths loading issue (#181)
Browse files Browse the repository at this point in the history
* Fix tsconfig path loading bug and add tests

Signed-off-by: Zabil Cheriya Maliackal <[email protected]>

* Bump version

Signed-off-by: Zabil Cheriya Maliackal <[email protected]>

---------

Signed-off-by: Zabil Cheriya Maliackal <[email protected]>
  • Loading branch information
zabil committed Jun 14, 2024
1 parent 67d1d3f commit ea389a5
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 12 deletions.
3 changes: 2 additions & 1 deletion e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"devDependencies": {
"@getgauge/cli": "latest",
"@types/node": "latest",
"taiko": "^1.4.0"
"taiko": "^1.4.0",
"tsconfig-paths": "^4.2.0"
}
}
17 changes: 17 additions & 0 deletions e2e/src/VowelCounter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export default class VowelCounter {
private vowels: string[];

constructor(vowels: string[]) {
this.vowels = vowels;
}

countVowels(word: string): number {
let count = 0;
for (const char of word) {
if (this.vowels.includes(char.toLowerCase())) {
count++;
}
}
return count;
}
}
14 changes: 9 additions & 5 deletions e2e/tests/implementation.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import * as assert from "node:assert";
import VowelCounter from "@lib/VowelCounter";
import { DataStoreFactory, Step, type Table } from "gauge-ts";

class Implementation {
static vowelsCount = (word: string): number => {
const vowels = DataStoreFactory.getSpecDataStore().get(
"vowels",
) as string[];
return word.split("").filter((c) => vowels.includes(c)).length;
const counter = DataStoreFactory.getSpecDataStore().get(
"counter",
) as VowelCounter;
return counter.countVowels(word);
};

@Step("Vowels in English language are <aeiou>.")
public async listVowels(vowels: string) {
DataStoreFactory.getSpecDataStore().put("vowels", vowels.split(""));
DataStoreFactory.getSpecDataStore().put(
"counter",
new VowelCounter(vowels.split("")),
);
}

@Step("The word <gauge> has <3> vowels.")
Expand Down
5 changes: 4 additions & 1 deletion e2e/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
"strict": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"emitDecoratorMetadata": true
"emitDecoratorMetadata": true,
"paths": {
"@lib/*": ["./src/*"]
}
},
"include": ["tests/**/*", "gen/**/*"],
"exclude": ["node_modules/"]
Expand Down
3 changes: 3 additions & 0 deletions gauge-ts/launcher.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env node

import { createRequire } from "node:module";
const require = createRequire(import.meta.url);

const version = process.versions.node.split(".");
if (Number.parseInt(version[0]) < 20) {
throw new Error(
Expand Down
2 changes: 1 addition & 1 deletion gauge-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gauge-ts",
"version": "0.3.1",
"version": "0.3.2",
"description": "Typescript runner for Gauge",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion gauge-ts/ts.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"linux": ["./launcher.mjs", "--start"],
"windows": ["launcher.bat", "--start"]
},
"version": "0.3.1",
"version": "0.3.2",
"gRPCSupport": true
}
30 changes: 27 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ea389a5

Please sign in to comment.