@matter/tools 0.11.0-alpha.0-20241005-e3e4e4a7a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +100 -0
- package/bin/build.js +10 -0
- package/bin/prepare-chip.js +5 -0
- package/bin/run.js +7 -0
- package/bin/test.js +7 -0
- package/bin/version.js +7 -0
- package/chip/Dockerfile +23 -0
- package/dist/cjs/building/builder.d.ts +35 -0
- package/dist/cjs/building/builder.d.ts.map +1 -0
- package/dist/cjs/building/builder.js +210 -0
- package/dist/cjs/building/builder.js.map +6 -0
- package/dist/cjs/building/cli.d.ts +7 -0
- package/dist/cjs/building/cli.d.ts.map +1 -0
- package/dist/cjs/building/cli.js +100 -0
- package/dist/cjs/building/cli.js.map +6 -0
- package/dist/cjs/building/error.d.ts +16 -0
- package/dist/cjs/building/error.d.ts.map +1 -0
- package/dist/cjs/building/error.js +50 -0
- package/dist/cjs/building/error.js.map +6 -0
- package/dist/cjs/building/graph.d.ts +37 -0
- package/dist/cjs/building/graph.d.ts.map +1 -0
- package/dist/cjs/building/graph.js +222 -0
- package/dist/cjs/building/graph.js.map +6 -0
- package/dist/cjs/building/project.d.ts +56 -0
- package/dist/cjs/building/project.d.ts.map +1 -0
- package/dist/cjs/building/project.js +239 -0
- package/dist/cjs/building/project.js.map +6 -0
- package/dist/cjs/building/tsconfig.d.ts +16 -0
- package/dist/cjs/building/tsconfig.d.ts.map +1 -0
- package/dist/cjs/building/tsconfig.js +70 -0
- package/dist/cjs/building/tsconfig.js.map +6 -0
- package/dist/cjs/building/typescript/context.d.ts +16 -0
- package/dist/cjs/building/typescript/context.d.ts.map +1 -0
- package/dist/cjs/building/typescript/context.js +82 -0
- package/dist/cjs/building/typescript/context.js.map +6 -0
- package/dist/cjs/building/typescript/incremental-compiler.d.ts +10 -0
- package/dist/cjs/building/typescript/incremental-compiler.d.ts.map +1 -0
- package/dist/cjs/building/typescript/incremental-compiler.js +119 -0
- package/dist/cjs/building/typescript/incremental-compiler.js.map +6 -0
- package/dist/cjs/building/typescript/language-service.d.ts +13 -0
- package/dist/cjs/building/typescript/language-service.d.ts.map +1 -0
- package/dist/cjs/building/typescript/language-service.js +109 -0
- package/dist/cjs/building/typescript/language-service.js.map +6 -0
- package/dist/cjs/building/typescript/solution-builder.d.ts +10 -0
- package/dist/cjs/building/typescript/solution-builder.d.ts.map +1 -0
- package/dist/cjs/building/typescript/solution-builder.js +72 -0
- package/dist/cjs/building/typescript/solution-builder.js.map +6 -0
- package/dist/cjs/building/typescript.d.ts +13 -0
- package/dist/cjs/building/typescript.d.ts.map +1 -0
- package/dist/cjs/building/typescript.js +31 -0
- package/dist/cjs/building/typescript.js.map +6 -0
- package/dist/cjs/index.d.ts +15 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +32 -0
- package/dist/cjs/index.js.map +6 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/running/cli.d.ts +19 -0
- package/dist/cjs/running/cli.d.ts.map +1 -0
- package/dist/cjs/running/cli.js +82 -0
- package/dist/cjs/running/cli.js.map +6 -0
- package/dist/cjs/running/execute.d.ts +8 -0
- package/dist/cjs/running/execute.d.ts.map +1 -0
- package/dist/cjs/running/execute.js +82 -0
- package/dist/cjs/running/execute.js.map +6 -0
- package/dist/cjs/testing/chip/pics-file.d.ts +20 -0
- package/dist/cjs/testing/chip/pics-file.d.ts.map +1 -0
- package/dist/cjs/testing/chip/pics-file.js +79 -0
- package/dist/cjs/testing/chip/pics-file.js.map +6 -0
- package/dist/cjs/testing/chip.d.ts +60 -0
- package/dist/cjs/testing/chip.d.ts.map +1 -0
- package/dist/cjs/testing/chip.js +306 -0
- package/dist/cjs/testing/chip.js.map +6 -0
- package/dist/cjs/testing/cli.d.ts +9 -0
- package/dist/cjs/testing/cli.d.ts.map +1 -0
- package/dist/cjs/testing/cli.js +117 -0
- package/dist/cjs/testing/cli.js.map +6 -0
- package/dist/cjs/testing/failure-detail.d.ts +19 -0
- package/dist/cjs/testing/failure-detail.d.ts.map +1 -0
- package/dist/cjs/testing/failure-detail.js +143 -0
- package/dist/cjs/testing/failure-detail.js.map +6 -0
- package/dist/cjs/testing/files.d.ts +8 -0
- package/dist/cjs/testing/files.d.ts.map +1 -0
- package/dist/cjs/testing/files.js +52 -0
- package/dist/cjs/testing/files.js.map +6 -0
- package/dist/cjs/testing/global-declarations.d.ts +38 -0
- package/dist/cjs/testing/global-declarations.d.ts.map +1 -0
- package/dist/cjs/testing/global-declarations.js +8 -0
- package/dist/cjs/testing/global-declarations.js.map +6 -0
- package/dist/cjs/testing/global-definitions.d.ts +7 -0
- package/dist/cjs/testing/global-definitions.d.ts.map +1 -0
- package/dist/cjs/testing/global-definitions.js +50 -0
- package/dist/cjs/testing/global-definitions.js.map +6 -0
- package/dist/cjs/testing/mocha.d.ts +36 -0
- package/dist/cjs/testing/mocha.d.ts.map +1 -0
- package/dist/cjs/testing/mocha.js +155 -0
- package/dist/cjs/testing/mocha.js.map +6 -0
- package/dist/cjs/testing/mocharc.cjs +68 -0
- package/dist/cjs/testing/mocharc.d.cts +7 -0
- package/dist/cjs/testing/mocks/crypto.d.ts +7 -0
- package/dist/cjs/testing/mocks/crypto.d.ts.map +1 -0
- package/dist/cjs/testing/mocks/crypto.js +79 -0
- package/dist/cjs/testing/mocks/crypto.js.map +6 -0
- package/dist/cjs/testing/mocks/environment.d.ts +7 -0
- package/dist/cjs/testing/mocks/environment.d.ts.map +1 -0
- package/dist/cjs/testing/mocks/environment.js +7 -0
- package/dist/cjs/testing/mocks/environment.js.map +6 -0
- package/dist/cjs/testing/mocks/index.d.ts +10 -0
- package/dist/cjs/testing/mocks/index.d.ts.map +1 -0
- package/dist/cjs/testing/mocks/index.js +27 -0
- package/dist/cjs/testing/mocks/index.js.map +6 -0
- package/dist/cjs/testing/mocks/logging.d.ts +28 -0
- package/dist/cjs/testing/mocks/logging.d.ts.map +1 -0
- package/dist/cjs/testing/mocks/logging.js +93 -0
- package/dist/cjs/testing/mocks/logging.js.map +6 -0
- package/dist/cjs/testing/mocks/time.d.ts +88 -0
- package/dist/cjs/testing/mocks/time.d.ts.map +1 -0
- package/dist/cjs/testing/mocks/time.js +250 -0
- package/dist/cjs/testing/mocks/time.js.map +6 -0
- package/dist/cjs/testing/node.d.ts +16 -0
- package/dist/cjs/testing/node.d.ts.map +1 -0
- package/dist/cjs/testing/node.js +108 -0
- package/dist/cjs/testing/node.js.map +6 -0
- package/dist/cjs/testing/options.d.ts +19 -0
- package/dist/cjs/testing/options.d.ts.map +1 -0
- package/dist/cjs/testing/options.js +62 -0
- package/dist/cjs/testing/options.js.map +6 -0
- package/dist/cjs/testing/reporter.d.ts +50 -0
- package/dist/cjs/testing/reporter.d.ts.map +1 -0
- package/dist/cjs/testing/reporter.js +137 -0
- package/dist/cjs/testing/reporter.js.map +6 -0
- package/dist/cjs/testing/runner.d.ts +22 -0
- package/dist/cjs/testing/runner.d.ts.map +1 -0
- package/dist/cjs/testing/runner.js +116 -0
- package/dist/cjs/testing/runner.js.map +6 -0
- package/dist/cjs/testing/web.d.ts +8 -0
- package/dist/cjs/testing/web.d.ts.map +1 -0
- package/dist/cjs/testing/web.js +165 -0
- package/dist/cjs/testing/web.js.map +6 -0
- package/dist/cjs/util/bootstrap.mjs +105 -0
- package/dist/cjs/util/docker.d.ts +27 -0
- package/dist/cjs/util/docker.d.ts.map +1 -0
- package/dist/cjs/util/docker.js +163 -0
- package/dist/cjs/util/docker.js.map +6 -0
- package/dist/cjs/util/errors.d.ts +8 -0
- package/dist/cjs/util/errors.d.ts.map +1 -0
- package/dist/cjs/util/errors.js +55 -0
- package/dist/cjs/util/errors.js.map +6 -0
- package/dist/cjs/util/index.d.ts +8 -0
- package/dist/cjs/util/index.d.ts.map +1 -0
- package/dist/cjs/util/index.js +25 -0
- package/dist/cjs/util/index.js.map +6 -0
- package/dist/cjs/util/node-shims.d.ts +7 -0
- package/dist/cjs/util/node-shims.d.ts.map +1 -0
- package/dist/cjs/util/node-shims.js +12 -0
- package/dist/cjs/util/node-shims.js.map +6 -0
- package/dist/cjs/util/package.d.ts +61 -0
- package/dist/cjs/util/package.d.ts.map +1 -0
- package/dist/cjs/util/package.js +324 -0
- package/dist/cjs/util/package.js.map +6 -0
- package/dist/cjs/util/progress.d.ts +31 -0
- package/dist/cjs/util/progress.d.ts.map +1 -0
- package/dist/cjs/util/progress.js +232 -0
- package/dist/cjs/util/progress.js.map +6 -0
- package/dist/cjs/util/tools-path.cjs +13 -0
- package/dist/cjs/util/tools-path.d.cts +7 -0
- package/dist/cjs/util/trace-unhandled.d.ts +9 -0
- package/dist/cjs/util/trace-unhandled.d.ts.map +1 -0
- package/dist/cjs/util/trace-unhandled.js +48 -0
- package/dist/cjs/util/trace-unhandled.js.map +6 -0
- package/dist/cjs/util/wtf.d.ts +10 -0
- package/dist/cjs/util/wtf.d.ts.map +1 -0
- package/dist/cjs/util/wtf.js +53 -0
- package/dist/cjs/util/wtf.js.map +6 -0
- package/dist/cjs/versioning/cli.d.ts +7 -0
- package/dist/cjs/versioning/cli.d.ts.map +1 -0
- package/dist/cjs/versioning/cli.js +62 -0
- package/dist/cjs/versioning/cli.js.map +6 -0
- package/dist/cjs/versioning/versioner.d.ts +18 -0
- package/dist/cjs/versioning/versioner.d.ts.map +1 -0
- package/dist/cjs/versioning/versioner.js +145 -0
- package/dist/cjs/versioning/versioner.js.map +6 -0
- package/dist/esm/building/builder.d.ts +35 -0
- package/dist/esm/building/builder.d.ts.map +1 -0
- package/dist/esm/building/builder.js +180 -0
- package/dist/esm/building/builder.js.map +6 -0
- package/dist/esm/building/cli.d.ts +7 -0
- package/dist/esm/building/cli.d.ts.map +1 -0
- package/dist/esm/building/cli.js +70 -0
- package/dist/esm/building/cli.js.map +6 -0
- package/dist/esm/building/error.d.ts +16 -0
- package/dist/esm/building/error.d.ts.map +1 -0
- package/dist/esm/building/error.js +30 -0
- package/dist/esm/building/error.js.map +6 -0
- package/dist/esm/building/graph.d.ts +37 -0
- package/dist/esm/building/graph.d.ts.map +1 -0
- package/dist/esm/building/graph.js +192 -0
- package/dist/esm/building/graph.js.map +6 -0
- package/dist/esm/building/project.d.ts +56 -0
- package/dist/esm/building/project.d.ts.map +1 -0
- package/dist/esm/building/project.js +219 -0
- package/dist/esm/building/project.js.map +6 -0
- package/dist/esm/building/tsconfig.d.ts +16 -0
- package/dist/esm/building/tsconfig.d.ts.map +1 -0
- package/dist/esm/building/tsconfig.js +50 -0
- package/dist/esm/building/tsconfig.js.map +6 -0
- package/dist/esm/building/typescript/context.d.ts +16 -0
- package/dist/esm/building/typescript/context.d.ts.map +1 -0
- package/dist/esm/building/typescript/context.js +68 -0
- package/dist/esm/building/typescript/context.js.map +6 -0
- package/dist/esm/building/typescript/incremental-compiler.d.ts +10 -0
- package/dist/esm/building/typescript/incremental-compiler.d.ts.map +1 -0
- package/dist/esm/building/typescript/incremental-compiler.js +99 -0
- package/dist/esm/building/typescript/incremental-compiler.js.map +6 -0
- package/dist/esm/building/typescript/language-service.d.ts +13 -0
- package/dist/esm/building/typescript/language-service.d.ts.map +1 -0
- package/dist/esm/building/typescript/language-service.js +99 -0
- package/dist/esm/building/typescript/language-service.js.map +6 -0
- package/dist/esm/building/typescript/solution-builder.d.ts +10 -0
- package/dist/esm/building/typescript/solution-builder.d.ts.map +1 -0
- package/dist/esm/building/typescript/solution-builder.js +52 -0
- package/dist/esm/building/typescript/solution-builder.js.map +6 -0
- package/dist/esm/building/typescript.d.ts +13 -0
- package/dist/esm/building/typescript.d.ts.map +1 -0
- package/dist/esm/building/typescript.js +11 -0
- package/dist/esm/building/typescript.js.map +6 -0
- package/dist/esm/index.d.ts +15 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +15 -0
- package/dist/esm/index.js.map +6 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/running/cli.d.ts +19 -0
- package/dist/esm/running/cli.d.ts.map +1 -0
- package/dist/esm/running/cli.js +62 -0
- package/dist/esm/running/cli.js.map +6 -0
- package/dist/esm/running/execute.d.ts +8 -0
- package/dist/esm/running/execute.d.ts.map +1 -0
- package/dist/esm/running/execute.js +52 -0
- package/dist/esm/running/execute.js.map +6 -0
- package/dist/esm/testing/chip/pics-file.d.ts +20 -0
- package/dist/esm/testing/chip/pics-file.d.ts.map +1 -0
- package/dist/esm/testing/chip/pics-file.js +59 -0
- package/dist/esm/testing/chip/pics-file.js.map +6 -0
- package/dist/esm/testing/chip.d.ts +60 -0
- package/dist/esm/testing/chip.d.ts.map +1 -0
- package/dist/esm/testing/chip.js +286 -0
- package/dist/esm/testing/chip.js.map +6 -0
- package/dist/esm/testing/cli.d.ts +9 -0
- package/dist/esm/testing/cli.d.ts.map +1 -0
- package/dist/esm/testing/cli.js +87 -0
- package/dist/esm/testing/cli.js.map +6 -0
- package/dist/esm/testing/failure-detail.d.ts +19 -0
- package/dist/esm/testing/failure-detail.d.ts.map +1 -0
- package/dist/esm/testing/failure-detail.js +113 -0
- package/dist/esm/testing/failure-detail.js.map +6 -0
- package/dist/esm/testing/files.d.ts +8 -0
- package/dist/esm/testing/files.d.ts.map +1 -0
- package/dist/esm/testing/files.js +32 -0
- package/dist/esm/testing/files.js.map +6 -0
- package/dist/esm/testing/global-declarations.d.ts +38 -0
- package/dist/esm/testing/global-declarations.d.ts.map +1 -0
- package/dist/esm/testing/global-declarations.js +7 -0
- package/dist/esm/testing/global-declarations.js.map +6 -0
- package/dist/esm/testing/global-definitions.d.ts +7 -0
- package/dist/esm/testing/global-definitions.d.ts.map +1 -0
- package/dist/esm/testing/global-definitions.js +27 -0
- package/dist/esm/testing/global-definitions.js.map +6 -0
- package/dist/esm/testing/mocha.d.ts +36 -0
- package/dist/esm/testing/mocha.d.ts.map +1 -0
- package/dist/esm/testing/mocha.js +135 -0
- package/dist/esm/testing/mocha.js.map +6 -0
- package/dist/esm/testing/mocharc.cjs +68 -0
- package/dist/esm/testing/mocharc.d.cts +7 -0
- package/dist/esm/testing/mocks/crypto.d.ts +7 -0
- package/dist/esm/testing/mocks/crypto.d.ts.map +1 -0
- package/dist/esm/testing/mocks/crypto.js +59 -0
- package/dist/esm/testing/mocks/crypto.js.map +6 -0
- package/dist/esm/testing/mocks/environment.d.ts +7 -0
- package/dist/esm/testing/mocks/environment.d.ts.map +1 -0
- package/dist/esm/testing/mocks/environment.js +6 -0
- package/dist/esm/testing/mocks/environment.js.map +6 -0
- package/dist/esm/testing/mocks/index.d.ts +10 -0
- package/dist/esm/testing/mocks/index.d.ts.map +1 -0
- package/dist/esm/testing/mocks/index.js +10 -0
- package/dist/esm/testing/mocks/index.js.map +6 -0
- package/dist/esm/testing/mocks/logging.d.ts +28 -0
- package/dist/esm/testing/mocks/logging.d.ts.map +1 -0
- package/dist/esm/testing/mocks/logging.js +63 -0
- package/dist/esm/testing/mocks/logging.js.map +6 -0
- package/dist/esm/testing/mocks/time.d.ts +88 -0
- package/dist/esm/testing/mocks/time.d.ts.map +1 -0
- package/dist/esm/testing/mocks/time.js +230 -0
- package/dist/esm/testing/mocks/time.js.map +6 -0
- package/dist/esm/testing/node.d.ts +16 -0
- package/dist/esm/testing/node.d.ts.map +1 -0
- package/dist/esm/testing/node.js +78 -0
- package/dist/esm/testing/node.js.map +6 -0
- package/dist/esm/testing/options.d.ts +19 -0
- package/dist/esm/testing/options.d.ts.map +1 -0
- package/dist/esm/testing/options.js +42 -0
- package/dist/esm/testing/options.js.map +6 -0
- package/dist/esm/testing/reporter.d.ts +50 -0
- package/dist/esm/testing/reporter.d.ts.map +1 -0
- package/dist/esm/testing/reporter.js +107 -0
- package/dist/esm/testing/reporter.js.map +6 -0
- package/dist/esm/testing/runner.d.ts +22 -0
- package/dist/esm/testing/runner.d.ts.map +1 -0
- package/dist/esm/testing/runner.js +86 -0
- package/dist/esm/testing/runner.js.map +6 -0
- package/dist/esm/testing/web.d.ts +8 -0
- package/dist/esm/testing/web.d.ts.map +1 -0
- package/dist/esm/testing/web.js +135 -0
- package/dist/esm/testing/web.js.map +6 -0
- package/dist/esm/util/bootstrap.mjs +105 -0
- package/dist/esm/util/docker.d.ts +27 -0
- package/dist/esm/util/docker.d.ts.map +1 -0
- package/dist/esm/util/docker.js +133 -0
- package/dist/esm/util/docker.js.map +6 -0
- package/dist/esm/util/errors.d.ts +8 -0
- package/dist/esm/util/errors.d.ts.map +1 -0
- package/dist/esm/util/errors.js +35 -0
- package/dist/esm/util/errors.js.map +6 -0
- package/dist/esm/util/index.d.ts +8 -0
- package/dist/esm/util/index.d.ts.map +1 -0
- package/dist/esm/util/index.js +8 -0
- package/dist/esm/util/index.js.map +6 -0
- package/dist/esm/util/node-shims.d.ts +7 -0
- package/dist/esm/util/node-shims.d.ts.map +1 -0
- package/dist/esm/util/node-shims.js +11 -0
- package/dist/esm/util/node-shims.js.map +6 -0
- package/dist/esm/util/package.d.ts +61 -0
- package/dist/esm/util/package.d.ts.map +1 -0
- package/dist/esm/util/package.js +304 -0
- package/dist/esm/util/package.js.map +6 -0
- package/dist/esm/util/progress.d.ts +31 -0
- package/dist/esm/util/progress.d.ts.map +1 -0
- package/dist/esm/util/progress.js +202 -0
- package/dist/esm/util/progress.js.map +6 -0
- package/dist/esm/util/tools-path.cjs +13 -0
- package/dist/esm/util/tools-path.d.cts +7 -0
- package/dist/esm/util/trace-unhandled.d.ts +9 -0
- package/dist/esm/util/trace-unhandled.d.ts.map +1 -0
- package/dist/esm/util/trace-unhandled.js +18 -0
- package/dist/esm/util/trace-unhandled.js.map +6 -0
- package/dist/esm/util/wtf.d.ts +10 -0
- package/dist/esm/util/wtf.d.ts.map +1 -0
- package/dist/esm/util/wtf.js +23 -0
- package/dist/esm/util/wtf.js.map +6 -0
- package/dist/esm/versioning/cli.d.ts +7 -0
- package/dist/esm/versioning/cli.d.ts.map +1 -0
- package/dist/esm/versioning/cli.js +32 -0
- package/dist/esm/versioning/cli.js.map +6 -0
- package/dist/esm/versioning/versioner.d.ts +18 -0
- package/dist/esm/versioning/versioner.d.ts.map +1 -0
- package/dist/esm/versioning/versioner.js +115 -0
- package/dist/esm/versioning/versioner.js.map +6 -0
- package/package.json +82 -0
- package/src/building/builder.ts +216 -0
- package/src/building/cli.ts +89 -0
- package/src/building/error.ts +29 -0
- package/src/building/graph.ts +251 -0
- package/src/building/project.ts +313 -0
- package/src/building/tsconfig.ts +69 -0
- package/src/building/typescript/context.ts +85 -0
- package/src/building/typescript/incremental-compiler.ts +126 -0
- package/src/building/typescript/language-service.ts +132 -0
- package/src/building/typescript/solution-builder.ts +67 -0
- package/src/building/typescript.ts +15 -0
- package/src/index.ts +15 -0
- package/src/running/cli.ts +95 -0
- package/src/running/execute.ts +63 -0
- package/src/testing/chip/pics-file.ts +71 -0
- package/src/testing/chip/pics.properties +53 -0
- package/src/testing/chip.ts +420 -0
- package/src/testing/cli.ts +122 -0
- package/src/testing/failure-detail.ts +126 -0
- package/src/testing/files.ts +35 -0
- package/src/testing/global-declarations.ts +50 -0
- package/src/testing/global-definitions.ts +35 -0
- package/src/testing/index.html +16 -0
- package/src/testing/mocha.ts +162 -0
- package/src/testing/mocharc.cjs +68 -0
- package/src/testing/mocharc.d.cts +7 -0
- package/src/testing/mocks/crypto.ts +70 -0
- package/src/testing/mocks/environment.ts +7 -0
- package/src/testing/mocks/index.ts +10 -0
- package/src/testing/mocks/logging.ts +99 -0
- package/src/testing/mocks/time.ts +294 -0
- package/src/testing/node.ts +114 -0
- package/src/testing/options.ts +58 -0
- package/src/testing/reporter.ts +144 -0
- package/src/testing/runner.ts +98 -0
- package/src/testing/web.ts +174 -0
- package/src/tsconfig.json +14 -0
- package/src/util/bootstrap.mjs +105 -0
- package/src/util/docker.ts +176 -0
- package/src/util/errors.ts +33 -0
- package/src/util/index.ts +8 -0
- package/src/util/node-shims.ts +13 -0
- package/src/util/package.ts +369 -0
- package/src/util/progress.ts +252 -0
- package/src/util/tools-path.cjs +13 -0
- package/src/util/tools-path.d.cts +7 -0
- package/src/util/trace-unhandled.ts +17 -0
- package/src/util/wtf.ts +25 -0
- package/src/versioning/cli.ts +43 -0
- package/src/versioning/versioner.ts +139 -0
- package/test/testing/mocks/MockTimeTest.ts +113 -0
- package/test/tsconfig.json +15 -0
- package/tsc/tsconfig.app.json +7 -0
- package/tsc/tsconfig.base.json +41 -0
- package/tsc/tsconfig.lib.json +12 -0
- package/tsc/tsconfig.test.json +7 -0
- package/tsconfig.json +5 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022-2024 Matter.js Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { readFileSync, writeFileSync } from "fs";
|
|
8
|
+
|
|
9
|
+
function readValue(line: string) {
|
|
10
|
+
const valueMatch = line.match(/^(\S+)=(.*)$/);
|
|
11
|
+
if (valueMatch) {
|
|
12
|
+
return { key: valueMatch[1], value: valueMatch[2] };
|
|
13
|
+
}
|
|
14
|
+
return { key: undefined, value: undefined };
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Manages Matter PICS files.
|
|
19
|
+
*
|
|
20
|
+
* Note that we sometimes use ".properties" extension for PICS files so we get syntax highlighting, but PICS only
|
|
21
|
+
* supports a subset of the actual Java properties file format.
|
|
22
|
+
*/
|
|
23
|
+
export class PicsFile {
|
|
24
|
+
#lines: string[];
|
|
25
|
+
#values?: Record<string, string>;
|
|
26
|
+
|
|
27
|
+
constructor(pathOrBody: string, inline = false) {
|
|
28
|
+
if (inline === false) {
|
|
29
|
+
pathOrBody = readFileSync(pathOrBody, "utf-8");
|
|
30
|
+
}
|
|
31
|
+
this.#lines = pathOrBody.split("\n").map(l => l.trim());
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
get lines() {
|
|
35
|
+
return this.#lines;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
get values() {
|
|
39
|
+
if (!this.#values) {
|
|
40
|
+
const values = {} as Record<string, string>;
|
|
41
|
+
for (const line of this.lines) {
|
|
42
|
+
const { key, value } = readValue(line);
|
|
43
|
+
if (key !== undefined) {
|
|
44
|
+
values[key] = value;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
this.#values = values;
|
|
48
|
+
}
|
|
49
|
+
return this.#values;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
patch(other: PicsFile) {
|
|
53
|
+
this.#lines = this.lines.map(line => {
|
|
54
|
+
const { key } = readValue(line);
|
|
55
|
+
if (key === undefined) {
|
|
56
|
+
return line;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const otherValue = other.values[key];
|
|
60
|
+
if (otherValue === undefined) {
|
|
61
|
+
return line;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return `${key}=${otherValue}`;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
save(path: string) {
|
|
69
|
+
writeFileSync(path, this.lines.join("\n"));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# @license
|
|
2
|
+
# Copyright 2022-2024 Matter.js Authors
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
# These are overrides for CHIP "PICS" values. We use values from CHIP's "ci-pics-values" with changes listed here.
|
|
6
|
+
|
|
7
|
+
# This is CHIP's file format. It is not (intentionally) a Java .properties file 🙄 but it is a subset and we get syntax
|
|
8
|
+
# highlighting with the "properties" extension.
|
|
9
|
+
|
|
10
|
+
# We support the eventlist global attribute and so also events
|
|
11
|
+
PICS_EVENT_LIST_ENABLED=1
|
|
12
|
+
|
|
13
|
+
# We support "absolute position feature" and want to run tests for that too
|
|
14
|
+
WNCV.S.F03=1
|
|
15
|
+
|
|
16
|
+
# We need to turn off calibration because the test expect a different behavior then we do in default implementation
|
|
17
|
+
WNCV.S.M.Calibration=0
|
|
18
|
+
|
|
19
|
+
# We support "Hue/Saturation" feature and want to run tests for that too
|
|
20
|
+
CC.S.F00=1
|
|
21
|
+
|
|
22
|
+
# We do not add attributes 3..7 to our test
|
|
23
|
+
DGGEN.S.A0003=0
|
|
24
|
+
DGGEN.S.A0004=0
|
|
25
|
+
DGGEN.S.A0005=0
|
|
26
|
+
DGGEN.S.A0006=0
|
|
27
|
+
DGGEN.S.A0007=0
|
|
28
|
+
|
|
29
|
+
# We do not support the "TestTrigger" command
|
|
30
|
+
| DGGEN.S.C00.Rsp=0
|
|
31
|
+
|
|
32
|
+
# We do not support the "TimeSnapshotResponse" command
|
|
33
|
+
DGGEN.S.C03.Rsp=0
|
|
34
|
+
|
|
35
|
+
# We do not enable events 0..2 for now
|
|
36
|
+
DGGEN.S.E00=0
|
|
37
|
+
DGGEN.S.E01=0
|
|
38
|
+
DGGEN.S.E02=0
|
|
39
|
+
|
|
40
|
+
# We do not support the "DM Test" feature
|
|
41
|
+
DGGEN.S.F00=0
|
|
42
|
+
|
|
43
|
+
# We do not support the optional Battery Fault Change event
|
|
44
|
+
PS.S.E01=0
|
|
45
|
+
|
|
46
|
+
# We use an Ethernet Network commissioning cluster and so we do not have these two attributes
|
|
47
|
+
CNET.S.A0002..3=0
|
|
48
|
+
|
|
49
|
+
# We do not provide a Taglist on Descriptor cluster
|
|
50
|
+
DESC.S.F00=0
|
|
51
|
+
|
|
52
|
+
# We provide a Constant pressure pump, so these attributes must not exist
|
|
53
|
+
PCC.S.A0005..c=0
|
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022-2024 Matter.js Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { parse } from "path";
|
|
8
|
+
import { Docker } from "../util/docker.js";
|
|
9
|
+
import { Package } from "../util/package.js";
|
|
10
|
+
import { PicsFile } from "./chip/pics-file.js";
|
|
11
|
+
import { type TestRunner } from "./runner.js";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Path configuration.
|
|
15
|
+
*/
|
|
16
|
+
namespace Constants {
|
|
17
|
+
export const chip = "/connectedhomeip";
|
|
18
|
+
export const chipTool = `${chip}/scripts/tests/chipyaml/chiptool.py`;
|
|
19
|
+
export const yamlTests = `${chip}/src/app/tests/suites/certification`;
|
|
20
|
+
export const pythonTests = `${chip}/src/python_testing`;
|
|
21
|
+
export const python = ["/usr/bin/env", "-S", "python3", "-B"];
|
|
22
|
+
export const pythonRunner = `${chip}/scripts/tests/run_python_test.py`;
|
|
23
|
+
|
|
24
|
+
export const pics = "/matter.js/packages/tools/build/pics.properties";
|
|
25
|
+
export const chipPics = "/connectedhomeip/src/app/tests/suites/certification/ci-pics-values";
|
|
26
|
+
export const buildTimeout = 600_000;
|
|
27
|
+
export const defaultTimeout = 60_000;
|
|
28
|
+
export const dockerBuildPath = "chip";
|
|
29
|
+
export const dockerName = "matterjs-chip";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Internal state.
|
|
34
|
+
*/
|
|
35
|
+
const State = {
|
|
36
|
+
configured: false,
|
|
37
|
+
options: undefined as Chip.Options | undefined,
|
|
38
|
+
docker: undefined as Docker | undefined,
|
|
39
|
+
yamlTests: Array<string>(),
|
|
40
|
+
pythonTests: Array<string>(),
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Internal configuration management.
|
|
45
|
+
*/
|
|
46
|
+
const Config = {
|
|
47
|
+
set options(options: Chip.Options) {
|
|
48
|
+
State.options = options;
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
get runner() {
|
|
52
|
+
const runner = State.options?.runner;
|
|
53
|
+
|
|
54
|
+
if (runner === undefined) {
|
|
55
|
+
throw new Error("No test runner configured");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return runner;
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
async docker() {
|
|
62
|
+
if (State.docker) {
|
|
63
|
+
return State.docker;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const docker = new Docker();
|
|
67
|
+
|
|
68
|
+
const { progress } = Config.runner;
|
|
69
|
+
|
|
70
|
+
await progress.run(`Build ${progress.emphasize("CHIP image")}`, () =>
|
|
71
|
+
docker.buildImage(Constants.dockerName, Package.tools.resolve(Constants.dockerBuildPath)),
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
State.docker = docker;
|
|
75
|
+
|
|
76
|
+
return docker;
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* CHIP testing controller. "CHIP tests" are official tests implemented in the connectedhomeip repository.
|
|
82
|
+
*/
|
|
83
|
+
export const Chip = {
|
|
84
|
+
/**
|
|
85
|
+
* Configure CHIP testing. Invoke prior to use of other methods.
|
|
86
|
+
*/
|
|
87
|
+
set config(config: Chip.Options) {
|
|
88
|
+
Config.options = config;
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Initialize. This must run before defining tests to enable test definition via globs.
|
|
93
|
+
*/
|
|
94
|
+
async initialize() {
|
|
95
|
+
await initialize();
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Define YAML tests. This is a declarative CHIP test defined in a YAML file.
|
|
100
|
+
*/
|
|
101
|
+
yaml(testee: Chip.Testee, includeGlob: string, excludeGlob?: string) {
|
|
102
|
+
let tests = filterWithGlob(State.yamlTests, includeGlob);
|
|
103
|
+
if (excludeGlob !== undefined) {
|
|
104
|
+
tests = filterWithGlob(tests, excludeGlob, true);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (tests.length === 0) {
|
|
108
|
+
throw new Error(`YAML test glob ${includeGlob} matched no tests`);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
for (const file of tests) {
|
|
112
|
+
implementTest(testee, {
|
|
113
|
+
name: parse(file).base,
|
|
114
|
+
|
|
115
|
+
command: [Constants.pythonRunner, file],
|
|
116
|
+
|
|
117
|
+
// TODO - complete argument set
|
|
118
|
+
args: {
|
|
119
|
+
"--pics-file": Constants.pics,
|
|
120
|
+
"--discriminator": "1234",
|
|
121
|
+
"--passcode": "20202021",
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Define a "python" test. This is a CHIP test implemented as a python script.
|
|
129
|
+
*/
|
|
130
|
+
python(testee: Chip.Testee, tester: Chip.TestSelection, excludeGlob?: string) {
|
|
131
|
+
if (typeof tester === "string") {
|
|
132
|
+
tester = {
|
|
133
|
+
name: tester,
|
|
134
|
+
};
|
|
135
|
+
} else {
|
|
136
|
+
tester = { ...tester };
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// TODO - complete arguments
|
|
140
|
+
tester.args = {
|
|
141
|
+
"--commissioning-method": "on-network",
|
|
142
|
+
"--PICS": Constants.pics,
|
|
143
|
+
"--discriminator": "1234",
|
|
144
|
+
"--passcode": "20202021",
|
|
145
|
+
...tester.args,
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
let files = filterWithGlob(State.pythonTests, tester.name, false);
|
|
149
|
+
if (excludeGlob !== undefined) {
|
|
150
|
+
files = filterWithGlob(files, excludeGlob, true);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (files.length === 0) {
|
|
154
|
+
throw new Error(`Python test glob ${tester.name} matched no tests`);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
for (const file of files) {
|
|
158
|
+
const name = parse(file).name;
|
|
159
|
+
implementTest(testee, { ...tester, name, command: [file] });
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
let containerInitializerInstalled = false;
|
|
165
|
+
|
|
166
|
+
function implementTest(testee: Chip.Testee, tester: Chip.Tester) {
|
|
167
|
+
if (!containerInitializerInstalled) {
|
|
168
|
+
containerInitializerInstalled = true;
|
|
169
|
+
before(async function () {
|
|
170
|
+
this.timeout(Constants.buildTimeout);
|
|
171
|
+
await initialize();
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
it(tester.description ?? tester.name, async () => {
|
|
176
|
+
await testee.setup();
|
|
177
|
+
await testee.start();
|
|
178
|
+
|
|
179
|
+
try {
|
|
180
|
+
await invokeTester(tester);
|
|
181
|
+
} finally {
|
|
182
|
+
try {
|
|
183
|
+
await testee.stop();
|
|
184
|
+
} catch (e) {
|
|
185
|
+
console.warn("Error stopping test subject", e);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}).timeout(tester.timeout ?? Constants.defaultTimeout);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
async function invokeTester(tester: Chip.Tester) {
|
|
192
|
+
const docker = await Config.docker();
|
|
193
|
+
|
|
194
|
+
const args = Array<string>();
|
|
195
|
+
if (tester.command) {
|
|
196
|
+
args.push(...tester.command);
|
|
197
|
+
}
|
|
198
|
+
if (tester.args) {
|
|
199
|
+
args.push(...Object.entries(tester.args).flat());
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// TODO - define docker network to match CHIP's testing infrastructure
|
|
203
|
+
const output = docker.run(Constants.dockerName, {
|
|
204
|
+
args,
|
|
205
|
+
env: tester.environment,
|
|
206
|
+
binds: {
|
|
207
|
+
[Package.workspace.path]: "/matter.js",
|
|
208
|
+
},
|
|
209
|
+
network: "host",
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
await translateTestOutput(Config.runner, output);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export namespace Chip {
|
|
216
|
+
/**
|
|
217
|
+
* The test subject.
|
|
218
|
+
*/
|
|
219
|
+
export interface Testee {
|
|
220
|
+
setup(): Promise<void>;
|
|
221
|
+
start(): Promise<void>;
|
|
222
|
+
stop(): Promise<void>;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* The test implementation.
|
|
227
|
+
*/
|
|
228
|
+
export type TestSelection = Tester | string;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Configuration required from testing program.
|
|
232
|
+
*/
|
|
233
|
+
export interface Options {
|
|
234
|
+
runner: TestRunner;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Details of how to run a specific test.
|
|
239
|
+
*/
|
|
240
|
+
export interface Tester {
|
|
241
|
+
name: string;
|
|
242
|
+
description?: string;
|
|
243
|
+
command?: string[];
|
|
244
|
+
args?: Record<string, string>;
|
|
245
|
+
timeout?: number;
|
|
246
|
+
environment?: Record<string, string>;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export type Chip = typeof Chip;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Strip ANSI escape codes from a string.
|
|
254
|
+
*/
|
|
255
|
+
function deansify(text: string) {
|
|
256
|
+
// Credit to https://stackoverflow.com/questions/25245716/remove-all-ansi-colors-styles-from-strings
|
|
257
|
+
// eslint-disable-next-line no-control-regex
|
|
258
|
+
return text.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, "");
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// TODO - can simplify because we've removed two layers of CHIP extraction.
|
|
262
|
+
//
|
|
263
|
+
// TODO - Adaptation to support both python and yaml tests
|
|
264
|
+
async function translateTestOutput(runner: TestRunner, output: AsyncIterable<string>) {
|
|
265
|
+
let testCount = 0;
|
|
266
|
+
|
|
267
|
+
let capture = Array<string>();
|
|
268
|
+
|
|
269
|
+
let partial: string | undefined;
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Extract failure details from the test runner's output sphaghetti.
|
|
273
|
+
*/
|
|
274
|
+
function reportFailures() {
|
|
275
|
+
let testName: undefined | string;
|
|
276
|
+
let testLogs: undefined | string[];
|
|
277
|
+
for (const line of capture) {
|
|
278
|
+
const subtestBoundary = deansify(line).match(/\*{5} (Test Step \d+|Test Failure) : (.*)/);
|
|
279
|
+
if (subtestBoundary) {
|
|
280
|
+
if (subtestBoundary[1] === "Test Failure") {
|
|
281
|
+
if (testName === undefined) {
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
runner.reporter.failTest(testName, {
|
|
285
|
+
message: subtestBoundary[2],
|
|
286
|
+
logs: testLogs?.join("\n"),
|
|
287
|
+
});
|
|
288
|
+
} else {
|
|
289
|
+
testName = subtestBoundary[2];
|
|
290
|
+
testLogs = [];
|
|
291
|
+
}
|
|
292
|
+
} else if (testLogs) {
|
|
293
|
+
// Extract matter.js logs
|
|
294
|
+
const appOut = line.match(/^.* APP {2}OUT {2}: (.*)$/);
|
|
295
|
+
if (appOut) {
|
|
296
|
+
testLogs.push(appOut[1]);
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// Extract diagnostics from the test framework
|
|
301
|
+
const testOut = line.match(/(\d{4}-\d\d-\d\d) .*(\d\d:\d\d:\d\d\.\d\d\d) - TEST OUT {2}: (.*)$/);
|
|
302
|
+
if (testOut) {
|
|
303
|
+
if (deansify(testOut[3]).match(/^(?:✗ \d+.\d+ms$|\s+\d+\. Running )/)) {
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
const date = testOut[1];
|
|
308
|
+
const time = testOut[2];
|
|
309
|
+
const message = testOut[3].replace("\t\t ", "").replace(/\t/g, " ");
|
|
310
|
+
|
|
311
|
+
// Test suite logs date and time of report plus time of log message. We only care about the second
|
|
312
|
+
// time so ignore the first
|
|
313
|
+
testLogs.push(`CHIP ${date} ${time} ${message}`);
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// We don't recognize the line; pass as-is
|
|
318
|
+
testLogs.push(line);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Process test suite output.
|
|
325
|
+
*
|
|
326
|
+
* Unfortunately run_test_suite.py hides most output unless the test crashes so we can't count subtests reliably
|
|
327
|
+
* without PR or replacing with our own thing. The individual test runners do report this though so we can report
|
|
328
|
+
* per-test information from failure output.
|
|
329
|
+
*/
|
|
330
|
+
function processLine(line: string) {
|
|
331
|
+
// Inject the message into our log stream
|
|
332
|
+
MockLogger.injectExternalMessage("CHIP", line);
|
|
333
|
+
|
|
334
|
+
line = line.trim();
|
|
335
|
+
const plain = deansify(line);
|
|
336
|
+
const testBoundary = plain.match(
|
|
337
|
+
/^\d{4}-\d\d-\d\d \d\d:\d\d:\d\d\.\d{3} [A-Z ]{7} ([a-zA-Z0-9_]+)\s+- (Starting test|(?:Completed|FAILED) in \d+\.\d+ seconds)$/,
|
|
338
|
+
);
|
|
339
|
+
|
|
340
|
+
if (testBoundary) {
|
|
341
|
+
if (testBoundary[2].startsWith("Start")) {
|
|
342
|
+
testCount++;
|
|
343
|
+
capture = [];
|
|
344
|
+
runner.reporter.beginRun(testBoundary[1], undefined, false);
|
|
345
|
+
} else if (testBoundary[2].startsWith("Completed")) {
|
|
346
|
+
runner.reporter.endRun();
|
|
347
|
+
} else {
|
|
348
|
+
reportFailures();
|
|
349
|
+
runner.reporter.endRun();
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
capture.push(line);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
for await (const chunk of output) {
|
|
357
|
+
const lines = chunk.split("\n");
|
|
358
|
+
if (partial) {
|
|
359
|
+
lines[0] = partial + lines[0];
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
partial = lines.pop();
|
|
363
|
+
|
|
364
|
+
for (const line of lines) {
|
|
365
|
+
processLine(line);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
if (partial !== undefined) {
|
|
370
|
+
processLine(partial);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
async function initialize() {
|
|
375
|
+
if (State.configured) {
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
await Config.docker();
|
|
380
|
+
await configurePics();
|
|
381
|
+
await configureYaml();
|
|
382
|
+
await configurePython();
|
|
383
|
+
|
|
384
|
+
State.configured = true;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
async function configurePics() {
|
|
388
|
+
const docker = await Config.docker();
|
|
389
|
+
const ciPics = await docker.readFileFromImage(Constants.dockerName, Constants.chipPics);
|
|
390
|
+
const pics = new PicsFile(ciPics, true);
|
|
391
|
+
|
|
392
|
+
const overrides = new PicsFile(Package.tools.resolve("src/testing/chip/pics.properties"));
|
|
393
|
+
pics.patch(overrides);
|
|
394
|
+
|
|
395
|
+
pics.save(Package.tools.resolve("build/pics.properties"));
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
async function configureYaml() {
|
|
399
|
+
const docker = await Config.docker();
|
|
400
|
+
|
|
401
|
+
const tests = await docker.resolveGlobFromImage(Constants.dockerName, `${Constants.yamlTests}/Test_*.yaml`);
|
|
402
|
+
|
|
403
|
+
State.yamlTests.push(...tests);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
async function configurePython() {
|
|
407
|
+
const docker = await Config.docker();
|
|
408
|
+
|
|
409
|
+
const tests = (await docker.resolveGlobFromImage(Constants.dockerName, `${Constants.pythonTests}/*.py`)).filter(
|
|
410
|
+
name => name.match(/(?:TC_|Test)[^/]\.py$/),
|
|
411
|
+
);
|
|
412
|
+
|
|
413
|
+
State.pythonTests.push(...tests);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
function filterWithGlob(list: string[], glob: string, invert = false) {
|
|
417
|
+
const globPattern = glob.replace(/\*/g, "[^\\/]+");
|
|
418
|
+
const pattern = new RegExp(`^.*/(?:Test_TC_|TC|Test)${globPattern}\\.(?:py|yaml)$`);
|
|
419
|
+
return list.filter(s => !!s.match(pattern) === !invert);
|
|
420
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022-2024 Matter.js Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import "../util/node-shims.js";
|
|
8
|
+
import "./global-definitions.js";
|
|
9
|
+
|
|
10
|
+
import yargs from "yargs";
|
|
11
|
+
import { hideBin } from "yargs/helpers";
|
|
12
|
+
import { Builder } from "../building/builder.js";
|
|
13
|
+
import { Graph } from "../building/graph.js";
|
|
14
|
+
import { Project } from "../building/project.js";
|
|
15
|
+
import { TestRunner } from "./runner.js";
|
|
16
|
+
|
|
17
|
+
enum TestType {
|
|
18
|
+
esm = "esm",
|
|
19
|
+
cjs = "cjs",
|
|
20
|
+
web = "web",
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
Error.stackTraceLimit = 50;
|
|
24
|
+
|
|
25
|
+
export async function main(argv = process.argv) {
|
|
26
|
+
const testTypes = new Set<TestType>();
|
|
27
|
+
|
|
28
|
+
let manual = false;
|
|
29
|
+
|
|
30
|
+
const args = await yargs(hideBin(argv))
|
|
31
|
+
.usage("Runs tests in packages adhering to matter.js standards.")
|
|
32
|
+
.option("prefix", {
|
|
33
|
+
alias: "p",
|
|
34
|
+
default: ".",
|
|
35
|
+
type: "string",
|
|
36
|
+
describe: "specify directory of package to test",
|
|
37
|
+
})
|
|
38
|
+
.option("web", {
|
|
39
|
+
alias: "w",
|
|
40
|
+
default: false,
|
|
41
|
+
type: "boolean",
|
|
42
|
+
describe: "enable web tests in default test mode",
|
|
43
|
+
})
|
|
44
|
+
.option("spec", {
|
|
45
|
+
type: "array",
|
|
46
|
+
string: true,
|
|
47
|
+
describe: "One or more paths of tests to run",
|
|
48
|
+
default: "./test/**/*Test.ts",
|
|
49
|
+
})
|
|
50
|
+
.option("all-logs", { type: "boolean", describe: "Emit log messages in real time" })
|
|
51
|
+
.option("debug", { type: "boolean", describe: "Enable Mocha debugging" })
|
|
52
|
+
.option("environment", { alias: "e", type: "string", describe: "Select named test environment" })
|
|
53
|
+
.option("fgrep", { alias: "f", type: "string", describe: "Only run tests matching this string" })
|
|
54
|
+
.option("force-exit", { type: "boolean", describe: "Force Node to exit after tests complete" })
|
|
55
|
+
.option("grep", { alias: "g", type: "string", describe: "Only run tests matching this regexp" })
|
|
56
|
+
.option("invert", { alias: "i", type: "boolean", describe: "Inverts --grep and --fgrep matches" })
|
|
57
|
+
.option("profile", { type: "boolean", describe: "Write profiling data to build/profiles (node only)" })
|
|
58
|
+
.option("wtf", { type: "boolean", describe: "Enlist wtfnode to detect test leaks" })
|
|
59
|
+
.option("trace-unhandled", { type: "boolean", describe: "Detail unhandled rejections with trace-unhandled" })
|
|
60
|
+
.command("*", "run all supported test types")
|
|
61
|
+
.command("esm", "run tests on node (ES6 modules)", () => testTypes.add(TestType.esm))
|
|
62
|
+
.command("cjs", "run tests on node (CommonJS modules)", () => testTypes.add(TestType.cjs))
|
|
63
|
+
.command("web", "run tests in web browser", () => testTypes.add(TestType.web))
|
|
64
|
+
.command("manual", "start test server and print URL for manual testing", () => {
|
|
65
|
+
testTypes.add(TestType.web);
|
|
66
|
+
manual = true;
|
|
67
|
+
})
|
|
68
|
+
.strict().argv;
|
|
69
|
+
|
|
70
|
+
// If spec specified and prefix is default, use the spec file to locate the package
|
|
71
|
+
let packageLocation = args.prefix;
|
|
72
|
+
if (packageLocation === "." && args.spec) {
|
|
73
|
+
const firstSpec = Array.isArray(args.spec) ? args.spec[0] : args.spec;
|
|
74
|
+
packageLocation = firstSpec;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const project = new Project(packageLocation);
|
|
78
|
+
|
|
79
|
+
process.chdir(project.pkg.path);
|
|
80
|
+
|
|
81
|
+
// If no test types are specified explicitly, run all enabled types
|
|
82
|
+
if (!testTypes.size) {
|
|
83
|
+
if (project.pkg.supportsEsm) {
|
|
84
|
+
testTypes.add(TestType.esm);
|
|
85
|
+
}
|
|
86
|
+
if (project.pkg.supportsCjs) {
|
|
87
|
+
testTypes.add(TestType.cjs);
|
|
88
|
+
}
|
|
89
|
+
if (args.web) {
|
|
90
|
+
testTypes.add(TestType.web);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const builder = new Builder();
|
|
95
|
+
const dependencies = await Graph.forProject(packageLocation);
|
|
96
|
+
if (dependencies) {
|
|
97
|
+
await dependencies.build(builder, false);
|
|
98
|
+
} else {
|
|
99
|
+
await builder.build(project);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const progress = project.pkg.start("Testing");
|
|
103
|
+
const runner = new TestRunner(project.pkg, progress, args);
|
|
104
|
+
|
|
105
|
+
if (testTypes.has(TestType.esm)) {
|
|
106
|
+
await runner.runNode("esm");
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (testTypes.has(TestType.cjs)) {
|
|
110
|
+
await runner.runNode("cjs");
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (testTypes.has(TestType.web)) {
|
|
114
|
+
await runner.runWeb(manual);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
progress.shutdown();
|
|
118
|
+
|
|
119
|
+
if (args.forceExit) {
|
|
120
|
+
process.exit(0);
|
|
121
|
+
}
|
|
122
|
+
}
|