Skip to content

Commit 5e6c838

Browse files
authored
Reproducing Error: Cannot find module './JWTAuth' on CI (#12)
Testing `example.js` on CI
1 parent 908ee85 commit 5e6c838

5 files changed

Lines changed: 29 additions & 3 deletions

File tree

.github/workflows/node.js.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ jobs:
1313
build:
1414

1515
runs-on: ubuntu-latest
16+
defaults:
17+
run:
18+
shell: bash
1619

1720
strategy:
1821
matrix:
@@ -28,5 +31,7 @@ jobs:
2831
- run: npm run build
2932
- run: npm test
3033
env:
31-
TEST_CONFIGURATION_BASE_URL: ${{ secrets.TEST_CONFIGURATION_BASE_URL }}
34+
TEST_CONFIGURATION_ACCESS_TOKEN: ${{ secrets.TEST_CONFIGURATION_ACCESS_TOKEN }}
35+
- run: scripts/run_example.sh
36+
env:
3237
TEST_CONFIGURATION_ACCESS_TOKEN: ${{ secrets.TEST_CONFIGURATION_ACCESS_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
/test/configuration*.json
77
/coverage/
88
*.d.ts
9+
demo/

example.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ const Barcode = require('aspose-barcode-cloud-node');
33

44
const config = new Barcode.Configuration(
55
'Client Id from https://dashboard.aspose.cloud/applications',
6-
'Client Secret from https://dashboard.aspose.cloud/applications'
6+
'Client Secret from https://dashboard.aspose.cloud/applications',
7+
null,
8+
process.env['TEST_CONFIGURATION_ACCESS_TOKEN']
79
);
810

911
async function generate(api) {
@@ -17,4 +19,4 @@ async function generate(api) {
1719
}
1820

1921
const api = new Barcode.BarcodeApi(config);
20-
generate(api).catch(err => console.error(err));
22+
generate(api).catch(err => { console.error(err); process.exitCode = 1; });

scripts/docs_format.sh

100644100755
File mode changed.

scripts/run_example.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
TEST_DIR="demo"
6+
7+
mkdir -p ${TEST_DIR}
8+
cp example.js ${TEST_DIR}
9+
10+
pushd ${TEST_DIR}
11+
mkdir -p node_modules/aspose-barcode-cloud-node
12+
pushd "$_"
13+
ln -sv --force ../../../package.json
14+
ln -sv --force ../../../dist/
15+
popd
16+
# Run
17+
node example.js
18+
popd

0 commit comments

Comments
 (0)