Fixed node environment regression. Fixed test script commands in package.json

This commit is contained in:
Nathan Johnson 2022-04-05 18:21:07 -05:00
parent d870f420d7
commit 052337aeaa
2 changed files with 11 additions and 8 deletions

View File

@ -15,7 +15,7 @@
"wait": "rimraf dist && wait-on http://localhost:3000/dist/ffmpeg.dev.js", "wait": "rimraf dist && wait-on http://localhost:3000/dist/ffmpeg.dev.js",
"test": "npm-run-all -p -r start test:all", "test": "npm-run-all -p -r start test:all",
"test:all": "npm-run-all wait test:browser:ffmpeg test:node:all", "test:all": "npm-run-all wait test:browser:ffmpeg test:node:all",
"test:node": "node --experimental-wasm-threads --experimental-wasm-bulk-memory node_modules/.bin/_mocha --exit --bail --require ./scripts/test-helper.js", "test:node": "node node_modules/mocha/bin/_mocha --exit --bail --require ./scripts/test-helper.js",
"test:node:all": "npm run test:node -- ./tests/*.test.js", "test:node:all": "npm run test:node -- ./tests/*.test.js",
"test:browser": "mocha-headless-chrome -a allow-file-access-from-files -a incognito -a no-sandbox -a disable-setuid-sandbox -a disable-logging -t 300000", "test:browser": "mocha-headless-chrome -a allow-file-access-from-files -a incognito -a no-sandbox -a disable-setuid-sandbox -a disable-logging -t 300000",
"test:browser:ffmpeg": "npm run test:browser -- -f ./tests/ffmpeg.test.html" "test:browser:ffmpeg": "npm run test:browser -- -f ./tests/ffmpeg.test.html"

View File

@ -75,14 +75,17 @@ module.exports = (_options = {}) => {
* as we are using blob URL instead of original URL to avoid cross origin issues. * as we are using blob URL instead of original URL to avoid cross origin issues.
*/ */
locateFile: (path, prefix) => { locateFile: (path, prefix) => {
if (typeof wasmPath !== 'undefined' if (typeof window !== 'undefined' || typeof WorkerGlobalScope !== 'undefined') {
&& path.endsWith('ffmpeg-core.wasm')) { if (typeof wasmPath !== 'undefined'
return wasmPath; && path.endsWith('ffmpeg-core.wasm')) {
} return wasmPath;
if (typeof workerPath !== 'undefined' }
&& path.endsWith('ffmpeg-core.worker.js')) { if (typeof workerPath !== 'undefined'
return workerPath; && path.endsWith('ffmpeg-core.worker.js')) {
return workerPath;
}
} }
return prefix + path;
}, },
}); });
ffmpeg = Core.cwrap('proxy_main', 'number', ['number', 'number']); ffmpeg = Core.cwrap('proxy_main', 'number', ['number', 'number']);