Skip to content
This repository was archived by the owner on Apr 22, 2025. It is now read-only.

Commit c91d573

Browse files
Fix ts-scenario TypeScript transpile failure (#675)
ts-scenario tests failed with Node 16 and 18 only, with the following error: TSError: ⨯ Unable to compile TypeScript: error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'. The fix is to explicitly specify the location of the tsconfig.json file (containing the required TypeScript compiler configuration) for ts-node using the TS_NODE_PROJECT environment variable. Also disable runtime type checking in ts-node using the SWC transpiler to provide a performance improvement. Signed-off-by: Mark S. Lewis <[email protected]>
1 parent ecbe99c commit c91d573

35 files changed

+54
-55
lines changed

.eslintignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
docs/**
88
fabric-network/lib/**
99
fabric-protos/**
10-
test/typescript/**
10+
test/ts-scenario/lib/**

docs/tutorials/query-peers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,4 @@ The following sample code is in TypeScript to show the object types involved.
140140
}
141141
```
142142

143-
For a complete sample plug-in query handler implementation, see [sample-query-handler.ts](https://github.com/hyperledger/fabric-sdk-node/blob/main/test/ts-scenario/config/handlers/sample-query-handler.ts).
143+
For a complete sample plug-in query handler implementation, see [sample-query-handler.ts](https://github.com/hyperledger/fabric-sdk-node/blob/main/test/ts-scenario/src/handlers/sample-query-handler.ts).

docs/tutorials/transaction-commit-events.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,4 @@ listener to monitor commit events from endorsing peers by calling
121121
[Network.addCommitListener](module-fabric-network.Network.html#addCommitListener).
122122

123123
For a complete sample plug-in event handler implementation, see
124-
[sample-transaction-event-handler.ts](https://github.com/hyperledger/fabric-sdk-node/blob/main/test/ts-scenario/config/handlers/sample-transaction-event-handler.ts).
124+
[sample-transaction-event-handler.ts](https://github.com/hyperledger/fabric-sdk-node/blob/main/test/ts-scenario/src/handlers/sample-transaction-event-handler.ts).

fabric-network/.eslintignore

Lines changed: 0 additions & 10 deletions
This file was deleted.

package.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,11 @@
3131
"unitTest": "ts-mocha --reporter list",
3232
"dockerReady": "npm run dockerClean && (cd test/fixtures/docker-compose && docker-compose -f docker-compose-tls-level-db.yaml -p node up -d && sleep 15 && docker ps -a)",
3333
"tapeIntegration": "./scripts/npm_scripts/runTape.sh",
34-
"cucumberScenario": "npm run setupCucumbers && export HFC_LOGGING='{\"debug\":\"test/temp/debugc.log\"}' && npm run test:cucumber && npm run dockerClean && nyc --check-coverage --statements 54 --branches 32 --functions 46 --lines 54 npm run test:ts-cucumber",
35-
"cucumberScenarioNoHSM": "npm run setupCucumbers && export HFC_LOGGING='{\"debug\":\"test/temp/debugc.log\"}' && npm run test:cucumber && npm run dockerClean && nyc --check-coverage --statements 54 --branches 32 --functions 46 --lines 54 npm run test:ts-cucumberNoHSM",
34+
"cucumberScenario": "npm run setupCucumbers && export HFC_LOGGING='{\"debug\":\"test/temp/debugc.log\"}' && npm run dockerClean && nyc --check-coverage --statements 54 --branches 32 --functions 46 --lines 54 npm run test:ts-cucumber",
35+
"cucumberScenarioNoHSM": "npm run setupCucumbers && export HFC_LOGGING='{\"debug\":\"test/temp/debugc.log\"}' && npm run dockerClean && nyc --check-coverage --statements 54 --branches 32 --functions 46 --lines 54 npm run test:ts-cucumberNoHSM",
3636
"setupCucumbers": "node -e 'require(\"./scripts/npm_scripts/testFunctions.js\").createCucumberLogFile()'",
37-
"test:cucumber": "cucumber-js -f @cucumber/pretty-formatter ./test/scenario/features/*.feature",
38-
"test:ts-cucumber": "cucumber-js -f @cucumber/pretty-formatter ./test/ts-scenario/features/*.feature --require './test/ts-scenario/steps/**/*.ts' --require './test/ts-scenario/support/**/*.ts' --require-module ts-node/register",
39-
"test:ts-cucumberNoHSM": "cucumber-js -f @cucumber/pretty-formatter ./test/ts-scenario/features/*.feature --require './test/ts-scenario/steps/**/*.ts' --require './test/ts-scenario/support/**/*.ts' --require-module ts-node/register --tags 'not @gateway_hsm'",
40-
"test:ts-cucumber-tagged": "npm run test:ts-cucumber -- --tags @events",
37+
"test:ts-cucumber": "tsc --project test/ts-scenario/tsconfig.json && cucumber-js -f @cucumber/pretty-formatter ./test/ts-scenario/features/*.feature --require './test/ts-scenario/lib/**/*.js'",
38+
"test:ts-cucumberNoHSM": "npm run test:ts-cucumber -- --tags 'not @gateway_hsm'",
4139
"testHeadless": "run-s cleanUp compile lint unitTest:all",
4240
"tapeAndCucumber": "run-s tapeIntegration dockerClean cucumberScenario"
4341
},
@@ -79,7 +77,6 @@
7977
"tape-promise": "^4.0.0",
8078
"ts-mocha": "^9.0.2",
8179
"ts-mock-imports": "^1.3.4",
82-
"ts-node": "^10.5.0",
8380
"typescript": "~4.4.4",
8481
"winston": "^2.4.5"
8582
},

scripts/npm_scripts/checkLicense.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ CHECK=$(find . -type f \
1818
-not -path './fabric-protos/types/index.d.ts' \
1919
-not -path './fabric-network/lib/*' \
2020
-not -path './.idea/*' \
21+
-not -path './test/ts-scenario/lib/*' \
2122
-not -name '.*' \
2223
-not -name '*.txt' \
2324
-not -name '*.rst' \

scripts/utility/fabric_images.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@ FABRIC_VERSION=${FABRIC_VERSION:-2.2}
1010
COUCHDB_VERSION=${COUCHDB_VERSION:-3.2}
1111
CA_VERSION=${CA_VERSION:-1.5}
1212

13+
pull() {
14+
docker pull -q "$1" || docker pull -q --platform amd64 "$1"
15+
}
16+
1317
for image in peer orderer ccenv baseos nodeenv javaenv tools; do
14-
docker pull -q "hyperledger/fabric-${image}:${FABRIC_VERSION}"
18+
pull "hyperledger/fabric-${image}:${FABRIC_VERSION}"
1519
docker tag "hyperledger/fabric-${image}:${FABRIC_VERSION}" "hyperledger/fabric-${image}"
1620
done
1721

18-
docker pull -q "couchdb:${COUCHDB_VERSION}"
22+
pull "couchdb:${COUCHDB_VERSION}"
1923
docker tag "couchdb:${COUCHDB_VERSION}" couchdb
2024

21-
docker pull -q "hyperledger/fabric-ca:${CA_VERSION}"
25+
pull "hyperledger/fabric-ca:${CA_VERSION}"
2226
docker tag "hyperledger/fabric-ca:${CA_VERSION}" hyperledger/fabric-ca

test/ts-scenario/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lib/**

test/ts-scenario/config/handlers/sample-query-handler.ts renamed to test/ts-scenario/src/handlers/sample-query-handler.ts

File renamed without changes.

test/ts-scenario/config/handlers/sample-transaction-event-handler.ts renamed to test/ts-scenario/src/handlers/sample-transaction-event-handler.ts

File renamed without changes.

0 commit comments

Comments
 (0)