[js/common] a few fixes/revises to onnxruntime-common (#16853)

### Description
- enable unit test for js/common in CI
- add debug config in js/.vscode/launch.json
- enable source map for js/common/test for debugging purposes; add
source map files to ignore list
- ignore js/common/test folder for npm packaging
This commit is contained in:
Yulong Wang 2023-08-01 11:17:39 -07:00 committed by GitHub
parent c4e4b98fb2
commit 969c95f73f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 52 additions and 5 deletions

View file

@ -5,9 +5,43 @@
"version": "0.2.0",
"configurations": [
{
"name": "[common] Launch Unit Tests",
"args": [
"-u",
"bdd",
"--timeout",
"999999",
"--colors",
"${workspaceFolder}/common/test/**/*.js"
],
"internalConsoleOptions": "openOnSessionStart",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"cwd": "${workspaceFolder}/common",
"request": "launch",
"skipFiles": [
"<node_internals>/**"
],
"type": "node",
"sourceMaps": true,
"preLaunchTask": "tsc: build - common/test/tsconfig.json"
},
{
"name": "[web] Launch Test Runner",
"program": "${workspaceFolder}/web/script/test-runner-cli.js",
"request": "launch",
"skipFiles": [
"<node_internals>/**"
],
"type": "node",
"cwd": "${workspaceFolder}/web",
"args": [
"suite1"
]
},
{
"name": "[web] Attach to Chrome",
"type": "chrome",
"request": "attach",
"name": "Attach to Chrome",
"port": 9333,
"webRoot": "${workspaceFolder}",
"sourceMapPathOverrides": {
@ -18,7 +52,7 @@
"smartStep": true
},
{
"name": "Remote Browser via Webkit Adaptor",
"name": "[web] Remote Browser via Webkit Adaptor",
"type": "chrome",
"request": "attach",
"port": 9000,

View file

@ -3,5 +3,6 @@ dist/
docs/
/test/**/*.js
/test/**/*.js.map
tsconfig.tsbuildinfo

View file

@ -6,4 +6,6 @@ typedoc.json
tsconfig.json
**/*.tsbuildinfo
/test/
*.tgz

View file

@ -13,8 +13,9 @@
"build:esm": "tsc",
"build:bundles": "webpack",
"build": "node ./build.js",
"prepare": "npm run build && tsc -p test",
"test": "mocha ./test/**/*.js"
"prepare": "npm run build",
"pretest": "tsc --build ./test",
"test": "mocha ./test/**/*.js --timeout 30000"
},
"devDependencies": {
"typedoc": "^0.23.22"

View file

@ -2,6 +2,7 @@
"extends": "../../tsconfig.tools.json",
"exclude": ["type-tests/**/*.ts"],
"compilerOptions": {
"module": "ES2022"
"module": "ES2022",
"sourceMap": true
}
}

View file

@ -94,6 +94,10 @@ jobs:
npm ci
workingDirectory: '$(Build.SourcesDirectory)/js/common'
displayName: 'npm ci /js/common/'
- script: |
npm test
workingDirectory: '$(Build.SourcesDirectory)/js/common'
displayName: 'run onnxruntime-common tests'
- script: |
npm ci
workingDirectory: '$(Build.SourcesDirectory)/js/web'

View file

@ -102,6 +102,10 @@ jobs:
npm ci
workingDirectory: '$(Build.SourcesDirectory)\js\common'
displayName: 'npm ci /js/common/'
- script: |
npm test
workingDirectory: '$(Build.SourcesDirectory)\js\common'
displayName: 'run onnxruntime-common tests'
- script: |
npm ci
workingDirectory: '$(Build.SourcesDirectory)\js\web'