**refactor(tests): consolidate and replace outdated environment test scripts**
- Removed obsolete scripts: `test-all-environments.js`, `test-fallback-function.js`, `test-fallback-simple.js`, `test-fix.js`, `test-tensorflow-textencoder.js`, `test-unified-encoding.js`, and `test-worker-utils.js`. - Introduced `scripts/comprehensive-test.js` as a unified testing script covering all environments: Browser, Node.js, and CLI. - Added `examples/cli-wrapper-example.js` to demonstrate a proper CLI implementation with TensorFlow.js initialization. This refactor simplifies the testing structure by consolidating redundant scripts into a single comprehensive script while ensuring robust cross-environment coverage.
This commit is contained in:
parent
fe1f418bf9
commit
19ed3dd081
20 changed files with 1253 additions and 808 deletions
|
|
@ -36,15 +36,19 @@ export function applyTensorFlowPatch(): void {
|
|||
|
||||
constructor() {
|
||||
// Create a util object with necessary methods and constructors
|
||||
// Store the actual constructor functions, not just references
|
||||
const TextEncoderConstructor = globalThis.TextEncoder || TextEncoder
|
||||
const TextDecoderConstructor = globalThis.TextDecoder || TextDecoder
|
||||
|
||||
this.util = {
|
||||
// Use native TextEncoder and TextDecoder
|
||||
TextEncoder: globalThis.TextEncoder || TextEncoder,
|
||||
TextDecoder: globalThis.TextDecoder || TextDecoder
|
||||
// Use native TextEncoder and TextDecoder constructors
|
||||
TextEncoder: TextEncoderConstructor,
|
||||
TextDecoder: TextDecoderConstructor
|
||||
}
|
||||
|
||||
// Initialize using native constructors directly
|
||||
this.textEncoder = new (globalThis.TextEncoder || TextEncoder)()
|
||||
this.textDecoder = new (globalThis.TextDecoder || TextDecoder)()
|
||||
this.textEncoder = new TextEncoderConstructor()
|
||||
this.textDecoder = new TextDecoderConstructor()
|
||||
}
|
||||
|
||||
// Define isFloat32Array directly on the instance
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue