Skip to content

Commit

Permalink
test(test-tooling): fix circular deps, sample-cordapp const enum export
Browse files Browse the repository at this point in the history
1. This issue started out from the SampleCordappEnum problem where in
some test cases it was being undefined instead of the actual string values
that are defined for it's properties.
2. Suggestions on the internet said that if your enum is undefined after
importing it then it's most likely a circular dependency problem.
3. So on that clue, I added a script that checks the entire project for
Typescript circular dependencies and fixed one that was present in the
test-tooling package (there hundreds more in other packages...)
4. Ultimately though this did not help with the original issue which was
solved by simply removing the "const" modifier from the enum's declaration.
This way the compiled .js sources retain the actual values defined for the
enum instead of the compiler completely eliminating them.

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
  • Loading branch information
petermetz committed Jul 11, 2024
1 parent 06cb8d0 commit f75d60e
Show file tree
Hide file tree
Showing 4 changed files with 424 additions and 9 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"purge-build-cache": "del-cli .build-cache/*",
"clean": "npm run purge-build-cache && del-cli \"./{packages,examples,extensions}/cactus-*/{dist,.nyc_output,src/main/kotlin/generated/openapi/kotlin-client/*,src/main/proto/generated/*,src/main/typescript/generated/openapi/typescript-axios/*,src/main-server/kotlin/gen/kotlin-spring/src/**/{model,api}/*}\" \"!**/.openapi-generator-ignore\"",
"lint": "run-s format:eslint format:prettier spellcheck",
"check:circular-deps": "lerna exec --no-bail -- madge --circular --extensions ts ./src/main/typescript/",
"format:eslint": "eslint '**/*.{js,ts}' --quiet --fix",
"format:prettier": "prettier --write --config .prettierrc.js \"./**/{openapi.json,*.ts,*.js}\"",
"spellcheck": "cspell lint --no-progress \"*/*/src/**/*.{js,ts}\"",
Expand Down Expand Up @@ -131,6 +132,7 @@
"@types/debug": "4.1.12",
"@types/fs-extra": "11.0.4",
"@types/jest": "29.5.3",
"@types/madge": "5.0.3",
"@types/node": "18.11.9",
"@types/node-fetch": "2.6.4",
"@types/tape": "4.13.4",
Expand Down Expand Up @@ -172,6 +174,7 @@
"json5": "2.2.3",
"license-report": "6.4.0",
"lint-staged": "11.2.6",
"madge": "7.0.0",
"make-dir-cli": "3.1.0",
"node-polyfill-webpack-plugin": "1.1.4",
"npm-run-all": "4.1.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* organization.
* @see https://github.com/corda/samples-kotlin
*/
export const enum SampleCordappEnum {
export enum SampleCordappEnum {
ADVANCED_OBLIGATION = "ADVANCED_OBLIGATION",
ADVANCED_NEGOTIATION = "ADVANCED_NEGOTIATION",
BASIC_CORDAPP = "BASIC_CORDAPP",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
Logger,
LoggerProvider,
} from "@hyperledger/cactus-common";
import { Containers } from "../public-api";
import { Containers } from "../common/containers";
import EventEmitter from "events";
import { SupportedImageVersions } from "./supported-image-versions";
import { Network } from "./network";
Expand Down
Loading

0 comments on commit f75d60e

Please sign in to comment.