diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b7e0db3..ed11c0b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: - name: Set up Nodejs uses: actions/setup-node@v4 with: - node-version: 20.7.0 + node-version: 20 - name: Setup submodule run: | @@ -51,7 +51,7 @@ jobs: - name: Set up Nodejs uses: actions/setup-node@v4 with: - node-version: 20.7.0 + node-version: 20 - name: Setup java uses: actions/setup-java@v4 @@ -99,7 +99,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v4 with: - node-version: 20.7.0 + node-version: 20 - name: Set up Go uses: actions/setup-go@v5 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f7bb489..c3386d1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: - name: Set up Nodejs uses: actions/setup-node@v4 with: - node-version: 20.7.0 + node-version: 20 - name: Setup git run: | diff --git a/js.json b/js.json index 5ac47c0..2e2778f 100644 --- a/js.json +++ b/js.json @@ -51,7 +51,7 @@ "--init" ] }, - "version": "4.0.0", + "version": "4.0.1", "gaugeVersionSupport": { "minimum": "1.0.7", "maximum": "" diff --git a/package-lock.json b/package-lock.json index e93945a..34fd806 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gauge-js", - "version": "4.0.0", + "version": "4.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "gauge-js", - "version": "4.0.0", + "version": "4.0.1", "license": "MIT", "dependencies": { "@grpc/grpc-js": "^1.9.13", @@ -20,14 +20,13 @@ }, "devDependencies": { "archiver": "^6.0.1", - "chai": "^4.3.10", + "chai": "^4.4.1", "check-if-windows": "^1.0.0", "eslint": "^8.56.0", "eslint-plugin-mocha": "^10.2.0", "fs-extra": "^11.2.0", "mocha": "^10.2.0", - "mock-fs": "^5.1.2", - "patch-package": "^8.0.0", + "mock-tmp": "^0.0.2", "sinon": "^17.0.1" } }, @@ -56,9 +55,9 @@ } }, "node_modules/@eslint-community/regexpp": { - "version": "4.8.1", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.8.1.tgz", - "integrity": "sha512-PWiOzLIUAjN/w5K17PoF4n6sKBw0gqLHPhywmYHP4t1VFQQVYeb1yWsJwnMVEMl3tUHME7X/SJPZLmtG7XBDxQ==", + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", + "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", "dev": true, "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" @@ -126,13 +125,13 @@ } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.13", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", - "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", + "version": "0.11.14", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", + "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", "dev": true, "dependencies": { - "@humanwhocodes/object-schema": "^2.0.1", - "debug": "^4.1.1", + "@humanwhocodes/object-schema": "^2.0.2", + "debug": "^4.3.1", "minimatch": "^3.0.5" }, "engines": { @@ -153,9 +152,9 @@ } }, "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", - "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", + "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==", "dev": true }, "node_modules/@nodelib/fs.scandir": { @@ -292,9 +291,12 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.6.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.6.5.tgz", - "integrity": "sha512-2qGq5LAOTh9izcc0+F+dToFigBWiK1phKPt7rNhOqJSr35y8rlIBjDwGtFSgAI6MGIhjwOVNSQZVdJsZJ2uR1w==" + "version": "20.11.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.4.tgz", + "integrity": "sha512-6I0fMH8Aoy2lOejL3s4LhyIYX34DPwY8bl5xlNjBvUEk8OHrcuzsFt+Ied4LvJihbtXPM+8zUqdydfIti86v9g==", + "dependencies": { + "undici-types": "~5.26.4" + } }, "node_modules/@ungap/structured-clone": { "version": "1.2.0", @@ -302,16 +304,10 @@ "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", "dev": true }, - "node_modules/@yarnpkg/lockfile": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz", - "integrity": "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==", - "dev": true - }, "node_modules/acorn": { - "version": "8.11.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", - "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", + "version": "8.11.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", + "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -440,20 +436,11 @@ } }, "node_modules/async": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", - "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz", + "integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==", "dev": true }, - "node_modules/at-least-node": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", - "dev": true, - "engines": { - "node": ">= 4.0.0" - } - }, "node_modules/b4a": { "version": "1.6.4", "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.4.tgz", @@ -534,9 +521,9 @@ } }, "node_modules/chai": { - "version": "4.3.10", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.10.tgz", - "integrity": "sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.1.tgz", + "integrity": "sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==", "dev": true, "dependencies": { "assertion-error": "^1.1.0", @@ -627,21 +614,6 @@ "node": ">= 6" } }, - "node_modules/ci-info": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.8.0.tgz", - "integrity": "sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/sibiraj-s" - } - ], - "engines": { - "node": ">=8" - } - }, "node_modules/cliui": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", @@ -1070,9 +1042,9 @@ "dev": true }, "node_modules/fastq": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", - "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.16.0.tgz", + "integrity": "sha512-ifCoaXsDrsdkWTtiNJX5uzHDsrck5TzfKKDcuFFTIrrc/BS076qgEIfoIy1VeZqViznfKiysPYTh/QeHtnIsYA==", "dev": true, "dependencies": { "reusify": "^1.0.4" @@ -1118,15 +1090,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/find-yarn-workspace-root": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz", - "integrity": "sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ==", - "dev": true, - "dependencies": { - "micromatch": "^4.0.2" - } - }, "node_modules/flat": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", @@ -1137,17 +1100,17 @@ } }, "node_modules/flat-cache": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.1.0.tgz", - "integrity": "sha512-OHx4Qwrrt0E4jEIcI5/Xb+f+QmJYNj2rrK8wiIdQOIrB9WrrJL8cjZvXdXuBTkkEwEqLycb5BeZDV1o2i9bTew==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", + "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", "dev": true, "dependencies": { - "flatted": "^3.2.7", + "flatted": "^3.2.9", "keyv": "^4.5.3", "rimraf": "^3.0.2" }, "engines": { - "node": ">=12.0.0" + "node": "^10.12.0 || >=12.0.0" } }, "node_modules/flatted": { @@ -1260,9 +1223,9 @@ } }, "node_modules/globals": { - "version": "13.23.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.23.0.tgz", - "integrity": "sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==", + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", "dev": true, "dependencies": { "type-fest": "^0.20.2" @@ -1365,21 +1328,6 @@ "node": ">=8" } }, - "node_modules/is-docker": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", - "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", - "dev": true, - "bin": { - "is-docker": "cli.js" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -1448,22 +1396,10 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-wsl": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", - "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", - "dev": true, - "dependencies": { - "is-docker": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", "dev": true }, "node_modules/isexe": { @@ -1496,18 +1432,6 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, - "node_modules/json-stable-stringify": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.2.tgz", - "integrity": "sha512-eunSSaEnxV12z+Z73y/j5N37/In40GK4GmsSy+tEHJMxknvqnA7/djeYtAgW0GsWHUfg+847WJjKaEylk2y09g==", - "dev": true, - "dependencies": { - "jsonify": "^0.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", @@ -1526,25 +1450,16 @@ "graceful-fs": "^4.1.6" } }, - "node_modules/jsonify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz", - "integrity": "sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/just-extend": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz", - "integrity": "sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-6.2.0.tgz", + "integrity": "sha512-cYofQu2Xpom82S6qD778jBDpwvvy39s1l/hrYij2u9AMdQcGRpaBu6kY4mVhuno5kJVi1DAz4aiphA2WI1/OAw==", "dev": true }, "node_modules/keyv": { - "version": "4.5.3", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.3.tgz", - "integrity": "sha512-QCiSav9WaX1PgETJ+SpNnx2PRRapJ/oRSXM4VO5OGYGSjrxbKPVFVhB3l2OCbLCk329N8qyAtsJjSjvVBWzEug==", + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", "dev": true, "dependencies": { "json-buffer": "3.0.1" @@ -1570,12 +1485,6 @@ "node": ">= 0.6.3" } }, - "node_modules/lazystream/node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", - "dev": true - }, "node_modules/lazystream/node_modules/readable-stream": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", @@ -1679,37 +1588,12 @@ "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" }, "node_modules/loupe": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", - "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", - "dev": true, - "dependencies": { - "get-func-name": "^2.0.0" - } - }, - "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", + "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", "dev": true, "dependencies": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" + "get-func-name": "^2.0.1" } }, "node_modules/minimatch": { @@ -1724,15 +1608,6 @@ "node": "*" } }, - "node_modules/minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/mocha": { "version": "10.2.0", "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", @@ -1876,13 +1751,13 @@ "node": ">=10" } }, - "node_modules/mock-fs": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/mock-fs/-/mock-fs-5.2.0.tgz", - "integrity": "sha512-2dF2R6YMSZbpip1V1WHKGLNjr/k48uQClqMVb5H3MOvwc9qhYis3/IWbj02qIg/Y8MDXKFF4c5v0rxx2o6xTZw==", + "node_modules/mock-tmp": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/mock-tmp/-/mock-tmp-0.0.2.tgz", + "integrity": "sha512-yB7yUNshkp1rUkcNEJ20tNI/sl+t9U7pUeDdidecGn+yppiv4EOy8PrShxc8NtrOmfCPA7yP9b+pZRJ3oPvyqw==", "dev": true, "engines": { - "node": ">=12.0.0" + "node": ">=16.7" } }, "node_modules/ms": { @@ -1910,43 +1785,16 @@ "dev": true }, "node_modules/nise": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/nise/-/nise-5.1.5.tgz", - "integrity": "sha512-VJuPIfUFaXNRzETTQEEItTOP8Y171ijr+JLq42wHes3DiryR8vT+1TXQW/Rx8JNUhyYYWyIvjXTU6dOhJcs9Nw==", - "dev": true, - "dependencies": { - "@sinonjs/commons": "^2.0.0", - "@sinonjs/fake-timers": "^10.0.2", - "@sinonjs/text-encoding": "^0.7.1", - "just-extend": "^4.0.2", - "path-to-regexp": "^1.7.0" - } - }, - "node_modules/nise/node_modules/@sinonjs/commons": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz", - "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==", - "dev": true, - "dependencies": { - "type-detect": "4.0.8" - } - }, - "node_modules/nise/node_modules/@sinonjs/fake-timers": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", - "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", - "dev": true, - "dependencies": { - "@sinonjs/commons": "^3.0.0" - } - }, - "node_modules/nise/node_modules/@sinonjs/fake-timers/node_modules/@sinonjs/commons": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz", - "integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==", + "version": "5.1.7", + "resolved": "https://registry.npmjs.org/nise/-/nise-5.1.7.tgz", + "integrity": "sha512-wWtNUhkT7k58uvWTB/Gy26eA/EJKtPZFVAhEilN5UYVmmGRYOURbejRUyKm0Uu9XVEW7K5nBOZfR8VMB4QR2RQ==", "dev": true, "dependencies": { - "type-detect": "4.0.8" + "@sinonjs/commons": "^3.0.0", + "@sinonjs/fake-timers": "^11.2.2", + "@sinonjs/text-encoding": "^0.7.2", + "just-extend": "^6.2.0", + "path-to-regexp": "^6.2.1" } }, "node_modules/normalize-path": { @@ -1967,22 +1815,6 @@ "wrappy": "1" } }, - "node_modules/open": { - "version": "7.4.2", - "resolved": "https://registry.npmjs.org/open/-/open-7.4.2.tgz", - "integrity": "sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==", - "dev": true, - "dependencies": { - "is-docker": "^2.0.0", - "is-wsl": "^2.1.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/optionator": { "version": "0.9.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", @@ -2000,15 +1832,6 @@ "node": ">= 0.8.0" } }, - "node_modules/os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -2051,83 +1874,6 @@ "node": ">=6" } }, - "node_modules/patch-package": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/patch-package/-/patch-package-8.0.0.tgz", - "integrity": "sha512-da8BVIhzjtgScwDJ2TtKsfT5JFWz1hYoBl9rUQ1f38MC2HwnEIkK8VN3dKMKcP7P7bvvgzNDbfNHtx3MsQb5vA==", - "dev": true, - "dependencies": { - "@yarnpkg/lockfile": "^1.1.0", - "chalk": "^4.1.2", - "ci-info": "^3.7.0", - "cross-spawn": "^7.0.3", - "find-yarn-workspace-root": "^2.0.0", - "fs-extra": "^9.0.0", - "json-stable-stringify": "^1.0.2", - "klaw-sync": "^6.0.0", - "minimist": "^1.2.6", - "open": "^7.4.2", - "rimraf": "^2.6.3", - "semver": "^7.5.3", - "slash": "^2.0.0", - "tmp": "^0.0.33", - "yaml": "^2.2.2" - }, - "bin": { - "patch-package": "index.js" - }, - "engines": { - "node": ">=14", - "npm": ">5" - } - }, - "node_modules/patch-package/node_modules/fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", - "dev": true, - "dependencies": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/patch-package/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/patch-package/node_modules/rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - } - }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -2156,13 +1902,10 @@ } }, "node_modules/path-to-regexp": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", - "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==", - "dev": true, - "dependencies": { - "isarray": "0.0.1" - } + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.1.tgz", + "integrity": "sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==", + "dev": true }, "node_modules/pathval": { "version": "1.1.1", @@ -2443,21 +2186,6 @@ } ] }, - "node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/serialize-javascript": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", @@ -2515,15 +2243,6 @@ "node": ">=0.3.1" } }, - "node_modules/slash": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", - "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -2534,9 +2253,9 @@ } }, "node_modules/streamx": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.1.tgz", - "integrity": "sha512-fQMzy2O/Q47rgwErk/eGeLu/roaFWV0jVsogDmrszM9uIw8L5OA+t+V93MgYlufNptfjmYR1tOMWhei/Eh7TQA==", + "version": "2.15.6", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.6.tgz", + "integrity": "sha512-q+vQL4AAz+FdfT137VF69Cc/APqUbxy+MDOImRrMvchJpigHj9GksgDU2LYbO9rx7RX6osWgxJB2WxhYv4SZAw==", "dev": true, "dependencies": { "fast-fifo": "^1.1.0", @@ -2617,18 +2336,6 @@ "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true }, - "node_modules/tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, - "dependencies": { - "os-tmpdir": "~1.0.2" - }, - "engines": { - "node": ">=0.6.0" - } - }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -2674,10 +2381,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + }, "node_modules/universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", "dev": true, "engines": { "node": ">= 10.0.0" @@ -2755,21 +2467,6 @@ "node": ">=10" } }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, - "node_modules/yaml": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.2.tgz", - "integrity": "sha512-N/lyzTPaJasoDmfV7YTrYCI0G/3ivm/9wdG0aHuheKowWQwGTsK0Eoiw6utmzAnI6pkJa0DUVygvp3spqqEKXg==", - "dev": true, - "engines": { - "node": ">= 14" - } - }, "node_modules/yargs": { "version": "17.7.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", diff --git a/package.json b/package.json index dff9171..a71f28e 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "gauge-js", - "version": "4.0.0", + "version": "4.0.1", "description": "JavaScript runner for Gauge", "main": "index.js", "scripts": { "lint": "eslint index.js src/ skel/ test/ scripts/", - "test": "npm run lint && patch-package && mocha --recursive", + "test": "npm run lint && mocha --recursive", "installPlugin": "node scripts/install.js", "package": "node scripts/install.js --package" }, @@ -35,14 +35,13 @@ }, "devDependencies": { "archiver": "^6.0.1", - "chai": "^4.3.10", + "chai": "^4.4.1", "check-if-windows": "^1.0.0", "eslint": "^8.56.0", "eslint-plugin-mocha": "^10.2.0", "fs-extra": "^11.2.0", "mocha": "^10.2.0", - "mock-fs": "^5.1.2", - "patch-package": "^8.0.0", + "mock-tmp": "^0.0.2", "sinon": "^17.0.1" } } diff --git a/patches/mock-fs+5.2.0.patch b/patches/mock-fs+5.2.0.patch deleted file mode 100644 index 6e1a27b..0000000 --- a/patches/mock-fs+5.2.0.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/node_modules/mock-fs/lib/binding.js b/node_modules/mock-fs/lib/binding.js -index a4a3e6c..ab04ce3 100644 ---- a/node_modules/mock-fs/lib/binding.js -+++ b/node_modules/mock-fs/lib/binding.js -@@ -165,6 +165,8 @@ function Binding(system) { - this.trackDescriptor(stderr); - } - -+Binding.prototype.readFileSync = path => require('fs').readFileSync(path).toString('utf8'); -+ - /** - * Get the file system underlying this binding. - * @return {FileSystem} The underlying file system. diff --git a/test/file-util-test.js b/test/file-util-test.js index a7ab639..c7feedf 100644 --- a/test/file-util-test.js +++ b/test/file-util-test.js @@ -2,7 +2,7 @@ var assert = require("chai").assert; var path = require("path"); var fileUtil = require("../src/file-util"); var isWindows = require("check-if-windows"); -var mock = require("mock-fs"); +var mock = require("mock-tmp"); describe("File util functions", function () { describe("isSameFilePath", function () { @@ -81,79 +81,80 @@ describe("File util functions", function () { describe("getFileName", function () { afterEach(function () { - mock.restore(); + mock.reset(); }); it("should give default file name does not exist", function () { - mock({ + const tmp = mock({ "tests": {}, }); - var file = fileUtil.getFileName(path.join(process.cwd(), "tests")); + var file = fileUtil.getFileName(path.join(tmp, "tests")); assert.equal(path.basename(file), "step_implementation.js"); }); it("should give file name with increment if default exists", function () { - mock({ + var tmp = mock({ "tests": { "step_implementation.js": "foo" }, }); - var file = fileUtil.getFileName(path.join(process.cwd(), "tests")); + var file = fileUtil.getFileName(path.join(tmp, "tests")); assert.equal(path.basename(file), "step_implementation_1.js"); - mock.restore(); + mock.reset(); - mock({ + tmp = mock({ "tests": { "step_implementation.js": "foo", "step_implementation_1.js": "something", }, }); - file = fileUtil.getFileName(path.join(process.cwd(), "tests")); + file = fileUtil.getFileName(path.join(tmp, "tests")); assert.equal(path.basename(file), "step_implementation_2.js"); }); }); describe("isInImplDir", function () { afterEach(function () { - mock.restore(); + process.env.GAUGE_PROJECT_ROOT = process.cwd(); + mock.reset(); }); it("should be true if file is under implementation dir", function () { - mock({ + const tmp = mock({ "tests": { "step_impl.js": "file content" }, }); - process.env.GAUGE_PROJECT_ROOT = process.cwd(); - assert.isTrue(fileUtil.isInImplDir(path.join(process.cwd(), "tests", "step_impl.js"))); + process.env.GAUGE_PROJECT_ROOT = tmp; + assert.isTrue(fileUtil.isInImplDir(path.join(tmp, "tests", "step_impl.js"))); }); it("should be true if file in nested dir under implementation dir", function () { - mock({ + const tmp = mock({ "tests": { "inner-dir": { "step_impl.js": "file content", } }, }); - process.env.GAUGE_PROJECT_ROOT = process.cwd(); - assert.isTrue(fileUtil.isInImplDir(path.join(process.cwd(), "tests", "inner-dir", "step_impl.js"))); + process.env.GAUGE_PROJECT_ROOT = tmp; + assert.isTrue(fileUtil.isInImplDir(path.join(tmp, "tests", "inner-dir", "step_impl.js"))); }); it("should be false if file is not under implementation dir", function () { - mock({ + const tmp = mock({ "tests": { "inner-dir": { "step_impl.js": "file content", } }, }); - process.env.GAUGE_PROJECT_ROOT = process.cwd(); - assert.isFalse(fileUtil.isInImplDir(path.join(process.cwd(), "step_impl.js"))); + process.env.GAUGE_PROJECT_ROOT = tmp; + assert.isFalse(fileUtil.isInImplDir(path.join(tmp, "step_impl.js"))); }); }); diff --git a/test/lsp-server-test.js b/test/lsp-server-test.js index 3662821..bdbdc1c 100644 --- a/test/lsp-server-test.js +++ b/test/lsp-server-test.js @@ -1,6 +1,6 @@ var path = require("path"); var protobuf = require("protobufjs"); -var mock = require("mock-fs"); +var mock = require("mock-tmp"); var assert = require("chai").assert; var ServiceHandlers = require("../src/serviceHandlers"); @@ -31,12 +31,11 @@ describe("ServiceHandlers", function () { }); it(".getImplementationFiles should get implementation files", function (done) { - mock({ + process.env.GAUGE_PROJECT_ROOT = mock({ "tests": { "example.js": "file content" }, }); - process.env.GAUGE_PROJECT_ROOT = process.cwd(); var handler = new ServiceHandlers(null, options); handler.getImplementationFiles({ request: {} }, function (err, res) { assert.isNull(err); @@ -104,14 +103,13 @@ describe("ServiceHandlers", function () { }); it(".implementStub should add stub in existing file", function () { - mock({ + process.env.GAUGE_PROJECT_ROOT = mock({ "tests": { "example.js": "something is here" } }); - process.env.GAUGE_PROJECT_ROOT = process.cwd(); var handler = new ServiceHandlers(null, options); - const req = { request: { implementationFilePath: path.join(process.cwd(), "tests", "example.js"), codes: ["foo", "bar"] } }; + const req = { request: { implementationFilePath: path.join(process.env.GAUGE_PROJECT_ROOT, "tests", "example.js"), codes: ["foo", "bar"] } }; handler.implementStub(req, function (err, res) { assert.isNull(err); assert.equal(path.basename(res.filePath), "example.js"); @@ -121,8 +119,8 @@ describe("ServiceHandlers", function () { it(".refactor should refactor step", function () { var content = "step('shhh',function(){\n\tconsole.log('hello')\n})"; - mock({ "tests": { "example.js": content } }); - loader.reloadFile(path.join(process.cwd(), "tests", "example.js"), content); + process.env.GAUGE_PROJECT_ROOT = mock({ "tests": { "example.js": content } }); + loader.reloadFile(path.join(process.env.GAUGE_PROJECT_ROOT, "tests", "example.js"), content); var handler = new ServiceHandlers(null, options); const req = { @@ -189,6 +187,6 @@ describe("ServiceHandlers", function () { afterEach(function () { registry.clear(); - mock.restore(); + mock.reset(); }); }); diff --git a/test/message-processor-test.js b/test/message-processor-test.js index 70601bb..a84ceb1 100644 --- a/test/message-processor-test.js +++ b/test/message-processor-test.js @@ -6,12 +6,12 @@ var hookRegistry = require("../src/hook-registry"); var loader = require("../src/static-loader"); var dataStore = require("../src/data-store-factory"); var { executeBeforeSuiteHook, executeBeforeSpecHook, executeBeforeScenarioHook, stepValidateResponse, stepNameResponse, stepPositions, cacheFileResponse, implementationGlobPatternResponse } = require("../src/message-processor"); -var mock = require("mock-fs"); +var mock = require("mock-tmp"); var path = require("path"); describe("Step Validate Request Processing", function () { - var stepValidateRequests = []; - var errorType = null; + let stepValidateRequests = []; + let errorType = null; this.timeout(10000); before(function (done) { stepRegistry.clear(); @@ -81,12 +81,12 @@ describe("Step Validate Request Processing", function () { }); describe("StepNameRequest Processing", function () { - var stepNameRequest = []; + let stepNameRequest = []; this.timeout(10000); before(function () { - var filePath = "example.js"; + const filePath = "example.js"; stepRegistry.clear(); - var content = "\"use strict\";\n" + + const content = "\"use strict\";\n" + "var assert = require(\"assert\");\n" + "var vowels = require(\"./vowels\");\n" + "step([\"A context step which gets executed before every scenario\", \"A context step.\"], function() {\n" + @@ -121,12 +121,12 @@ describe("StepNameRequest Processing", function () { }); describe("StepPositionsRequest Processing", function () { - var filePath = "example.js"; + const filePath = "example.js"; this.timeout(10000); before(function () { stepRegistry.clear(); - var content = "\"use strict\";\n" + + const content = "\"use strict\";\n" + "var assert = require(\"assert\");\n" + "var vowels = require(\"./vowels\");\n" + "step(\"Vowels in English language are .\", function(vowelsGiven) {\n" + @@ -140,7 +140,7 @@ describe("StepPositionsRequest Processing", function () { }); it("StepPositionsRequest should get back StepPositionsResponse with stepValue and lineNumber", function () { - var stepPositionsRequest = { + const stepPositionsRequest = { filePath: filePath }; const response = stepPositions(stepPositionsRequest); @@ -157,9 +157,9 @@ describe("StepPositionsRequest Processing", function () { }); describe("CacheFileRequest Processing", function () { - var fileStatus = null; - var filePath = path.join(process.cwd(), "tests", "example.js"); - var fileContent = "\"use strict\";\n" + + let fileStatus = null; + let filePath; + const fileContent = "\"use strict\";\n" + "var assert = require(\"assert\");\n" + "var vowels = require(\"./vowels\");\n" + "step(\"Vowels in English language are .\", function(vowelsGiven) {\n" + @@ -167,7 +167,7 @@ describe("CacheFileRequest Processing", function () { "});"; this.timeout(10000); - var getCacheFileRequestMessage = function (filePath, status) { + const getCacheFileRequestMessage = function (filePath, status) { return { filePath: filePath, status: status @@ -175,36 +175,42 @@ describe("CacheFileRequest Processing", function () { }; before(function (done) { - process.env.GAUGE_PROJECT_ROOT = process.cwd(); - stepRegistry.clear(); protobuf.load("gauge-proto/messages.proto").then(function (root) { fileStatus = root.lookupEnum("gauge.messages.CacheFileRequest.FileStatus"); done(); }); }); + beforeEach(function() { + process.env.GAUGE_PROJECT_ROOT = mock({ "dummy" : {}}); + filePath = path.join(process.env.GAUGE_PROJECT_ROOT, "tests", "example.js"); + }); + afterEach(function () { - mock.restore(); + process.env.GAUGE_PROJECT_ROOT = process.cwd(); + mock.reset(); + stepRegistry.clear(); }); it("should reload files on create", function () { - var cacheFileRequest = getCacheFileRequestMessage(filePath, fileStatus.valuesById[fileStatus.values.CREATED]); - mock({ + process.env.GAUGE_PROJECT_ROOT = mock({ "tests": { "example.js": fileContent } }); + const cacheFileRequest = getCacheFileRequestMessage(path.join(process.env.GAUGE_PROJECT_ROOT, "tests", "example.js"), fileStatus.valuesById[fileStatus.values.CREATED]); cacheFileResponse(cacheFileRequest, fileStatus); assert.isNotEmpty(stepRegistry.get("Vowels in English language are {}.")); }); it("should not reload files on create if file is cached already", function () { - var cacheFileRequest = getCacheFileRequestMessage(filePath, fileStatus.valuesById[fileStatus.values.CREATED]); - mock({ + const tmp = mock({ "tests": { "example.js": "" } }); + const filePath = path.join(tmp, "tests", "example.js"); + const cacheFileRequest = getCacheFileRequestMessage(filePath, fileStatus.valuesById[fileStatus.values.CREATED]); loader.reloadFile(filePath, fileContent); assert.isNotEmpty(stepRegistry.get("Vowels in English language are {}.")); @@ -213,7 +219,7 @@ describe("CacheFileRequest Processing", function () { }); it("should unload file on delete.", function () { - var cacheFileRequest = getCacheFileRequestMessage(filePath, fileStatus.valuesById[fileStatus.values.DELETED]); + const cacheFileRequest = getCacheFileRequestMessage(filePath, fileStatus.valuesById[fileStatus.values.DELETED]); loader.reloadFile(filePath, fileContent); assert.isNotEmpty(stepRegistry.get("Vowels in English language are {}.")); @@ -222,12 +228,13 @@ describe("CacheFileRequest Processing", function () { }); it("should reload file from disk on closed.", function () { - var cacheFileRequest = getCacheFileRequestMessage(filePath, fileStatus.valuesById[fileStatus.values.CLOSED]); - mock({ + const tmp = mock({ "tests": { "example.js": fileContent } }); + const filePath = path.join(tmp, "tests", "example.js"); + const cacheFileRequest = getCacheFileRequestMessage(filePath, fileStatus.valuesById[fileStatus.values.CLOSED]); loader.reloadFile(filePath, fileContent); cacheFileResponse(cacheFileRequest, fileStatus); @@ -235,10 +242,12 @@ describe("CacheFileRequest Processing", function () { }); it("should unload file from disk on closed and file does not exists.", function () { - var cacheFileRequest = getCacheFileRequestMessage(filePath, fileStatus.valuesById[fileStatus.values.CLOSED]); - mock({ + const tmp = mock({ "tests": {} }); + process.env.GAUGE_PROJECT_ROOT = tmp; + const filePath = path.join(tmp, "tests", "example.js"); + const cacheFileRequest = getCacheFileRequestMessage(filePath, fileStatus.valuesById[fileStatus.values.CLOSED]); loader.reloadFile(filePath, fileContent); cacheFileResponse(cacheFileRequest, fileStatus); @@ -246,7 +255,7 @@ describe("CacheFileRequest Processing", function () { }); it("should load changed content on file opened", function () { - var cacheFileRequest = getCacheFileRequestMessage(filePath, fileStatus.valuesById[fileStatus.values.OPENED]); + const cacheFileRequest = getCacheFileRequestMessage(filePath, fileStatus.valuesById[fileStatus.values.OPENED]); cacheFileRequest.content = fileContent; cacheFileResponse(cacheFileRequest, fileStatus); @@ -254,7 +263,7 @@ describe("CacheFileRequest Processing", function () { }); it("should load changed content on file changed", function () { - var cacheFileRequest = getCacheFileRequestMessage(filePath, fileStatus.valuesById[fileStatus.values.OPENED]); + const cacheFileRequest = getCacheFileRequestMessage(filePath, fileStatus.valuesById[fileStatus.values.OPENED]); cacheFileRequest.content = fileContent; cacheFileResponse(cacheFileRequest, fileStatus); @@ -264,14 +273,13 @@ describe("CacheFileRequest Processing", function () { describe("ImplementationFileGlobPatternRequest Processing", function () { this.timeout(10000); - var implementationFileGlobPatternRequest; - var projectRoot = "exampleProject"; + let implementationFileGlobPatternRequest; + const projectRoot = "exampleProject"; before(function () { process.env.GAUGE_PROJECT_ROOT = projectRoot; stepRegistry.clear(); implementationFileGlobPatternRequest = {}; - }); after(function () { @@ -281,50 +289,50 @@ describe("ImplementationFileGlobPatternRequest Processing", function () { it("should return glob pattern for default test directory", function () { const response = implementationGlobPatternResponse(implementationFileGlobPatternRequest); - var expectedGlobPattern = [projectRoot + "/tests/**/*.js"]; + const expectedGlobPattern = [projectRoot + "/tests/**/*.js"]; assert.deepEqual(response.implementationFileGlobPatternResponse.globPatterns, expectedGlobPattern); }); it("should return glob patterns when multiple test directories present", function () { process.env.STEP_IMPL_DIR = "test1, test2"; const response = implementationGlobPatternResponse(implementationFileGlobPatternRequest); - var expectedGlobPatterns = [projectRoot + "/test1/**/*.js", projectRoot + "/test2/**/*.js"]; + const expectedGlobPatterns = [projectRoot + "/test1/**/*.js", projectRoot + "/test2/**/*.js"]; assert.deepEqual(response.implementationFileGlobPatternResponse.globPatterns, expectedGlobPatterns); }); }); describe("BeforeSpecHook", function () { this.timeout(10000); - var projectRoot = "exampleProject"; + var beforeDir; before(function () { - process.env.GAUGE_PROJECT_ROOT = projectRoot; stepRegistry.clear(); hookRegistry.clear(); dataStore.suiteStore.clear(); process.env.STEP_IMPL_DIR = "test1"; - mock( { - exampleProject: { - test1: { - "example.js":` - beforeSuite( () => { - gauge.dataStore.suiteStore.put("executedBeforeSuiteHook", true); - }); - beforeSpec( () => { - gauge.dataStore.specStore.put("executedBeforeSpecHook", true); - }) - beforeScenario( () => { - gauge.dataStore.scenarioStore.put("executedBeforeScenarioHook", true); - }) - ` - } + beforeDir = process.cwd(); + process.env.GAUGE_PROJECT_ROOT = mock( { + test1: { + "example.js":` + beforeSuite( () => { + gauge.dataStore.suiteStore.put("executedBeforeSuiteHook", true); + }); + beforeSpec( () => { + gauge.dataStore.specStore.put("executedBeforeSpecHook", true); + }) + beforeScenario( () => { + gauge.dataStore.scenarioStore.put("executedBeforeScenarioHook", true); + }) + ` } }); }); after(function () { + process.chdir(beforeDir); // Go back to where we were; vm.js changes the process working directory. process.env.GAUGE_PROJECT_ROOT = process.cwd(); process.env.STEP_IMPL_DIR = ""; + mock.reset(); }); it("should execute before suite hook and return a success response", function (done) { @@ -353,4 +361,4 @@ describe("BeforeSpecHook", function () { } executeBeforeScenarioHook({scenarioExecutionStartingRequest: {} }, callback); }); -}); \ No newline at end of file +});