@contrast/agent-bundle 5.42.0 → 5.45.1
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/README.md +1 -10
- package/node_modules/@contrast/agent/README.md +1 -10
- package/node_modules/@contrast/agent/package.json +12 -12
- package/node_modules/@contrast/agent-swc-plugin/package.json +3 -3
- package/node_modules/@contrast/agentify/lib/rewrite-hooks.js +3 -3
- package/node_modules/@contrast/agentify/lib/utils.js +13 -7
- package/node_modules/@contrast/agentify/package.json +17 -17
- package/node_modules/@contrast/architecture-components/package.json +6 -6
- package/node_modules/@contrast/assess/lib/dataflow/propagation/install/ejs/template.js +1 -1
- package/node_modules/@contrast/assess/lib/dataflow/propagation/install/pug/index.js +1 -1
- package/node_modules/@contrast/assess/lib/dataflow/sinks/install/http/server-response.js +1 -12
- package/node_modules/@contrast/assess/lib/dataflow/sinks/install/restify.js +1 -1
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/http.js +1 -1
- package/node_modules/@contrast/assess/lib/dataflow/tracker.js +1 -1
- package/node_modules/@contrast/assess/lib/get-source-context.js +1 -1
- package/node_modules/@contrast/assess/lib/response-scanning/install/http.js +0 -12
- package/node_modules/@contrast/assess/package.json +14 -14
- package/node_modules/@contrast/code-events/binding.gyp +1 -1
- package/node_modules/@contrast/code-events/package.json +11 -9
- package/node_modules/@contrast/code-events/prebuilds/darwin-x64+arm64/@contrast+code-events.abi108.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/darwin-x64+arm64/@contrast+code-events.abi115.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/darwin-x64+arm64/@contrast+code-events.abi127.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/darwin-x64+arm64/{@contrast+code-events.abi93.node → @contrast+code-events.abi137.node} +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-arm64/@contrast+code-events.abi108.armv8.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-arm64/@contrast+code-events.abi115.armv8.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-arm64/@contrast+code-events.abi127.armv8.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-arm64/@contrast+code-events.abi137.armv8.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi108.glibc.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi108.musl.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi115.glibc.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi115.musl.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi127.glibc.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi127.musl.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi137.glibc.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi137.musl.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/win32-x64/@contrast+code-events.abi108.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/win32-x64/@contrast+code-events.abi115.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/win32-x64/@contrast+code-events.abi127.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/win32-x64/@contrast+code-events.abi137.node +0 -0
- package/node_modules/@contrast/common/lib/constants.d.ts +1 -1
- package/node_modules/@contrast/common/lib/constants.js +1 -1
- package/node_modules/@contrast/common/lib/index.js +15 -15
- package/node_modules/@contrast/common/lib/primordials.d.ts +22 -20
- package/node_modules/@contrast/common/lib/types.d.ts +18 -6
- package/node_modules/@contrast/common/package.json +2 -2
- package/node_modules/@contrast/config/lib/options.js +29 -4
- package/node_modules/@contrast/config/package.json +4 -4
- package/node_modules/@contrast/core/lib/app-info.js +53 -74
- package/node_modules/@contrast/core/lib/index.d.ts +17 -1
- package/node_modules/@contrast/core/lib/sensitive-data-masking/index.js +33 -5
- package/node_modules/@contrast/core/package.json +10 -9
- package/node_modules/@contrast/deadzones/package.json +6 -6
- package/node_modules/@contrast/dep-hooks/lib/export-handler-registry.d.ts +17 -13
- package/node_modules/@contrast/dep-hooks/lib/export-handler-registry.js +16 -4
- package/node_modules/@contrast/dep-hooks/lib/export-hook-descriptor.d.ts +2 -2
- package/node_modules/@contrast/dep-hooks/lib/export-hook-descriptor.js +2 -3
- package/node_modules/@contrast/dep-hooks/lib/handler-invoker.d.ts +6 -6
- package/node_modules/@contrast/dep-hooks/lib/handler-invoker.js +0 -1
- package/node_modules/@contrast/dep-hooks/lib/helpers.d.ts +0 -7
- package/node_modules/@contrast/dep-hooks/lib/helpers.js +2 -18
- package/node_modules/@contrast/dep-hooks/lib/index.d.ts +17 -12
- package/node_modules/@contrast/dep-hooks/lib/index.js +5 -3
- package/node_modules/@contrast/dep-hooks/lib/package-finder.d.ts +2 -1
- package/node_modules/@contrast/dep-hooks/lib/package-finder.js +6 -6
- package/node_modules/@contrast/dep-hooks/package.json +4 -3
- package/node_modules/@contrast/distringuish/package.json +7 -6
- package/node_modules/@contrast/distringuish/prebuilds/darwin-x64+arm64/@contrast+distringuish.abi108.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/darwin-x64+arm64/@contrast+distringuish.abi115.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/darwin-x64+arm64/@contrast+distringuish.abi127.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/darwin-x64+arm64/{@contrast+distringuish.abi93.node → @contrast+distringuish.abi137.node} +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-arm64/@contrast+distringuish.abi108.armv8.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-arm64/@contrast+distringuish.abi115.armv8.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-arm64/@contrast+distringuish.abi127.armv8.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-arm64/@contrast+distringuish.abi137.armv8.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi108.glibc.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi108.musl.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi115.glibc.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi115.musl.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi127.glibc.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi127.musl.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi137.glibc.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi137.musl.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/win32-x64/@contrast+distringuish.abi108.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/win32-x64/@contrast+distringuish.abi115.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/win32-x64/@contrast+distringuish.abi127.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/win32-x64/@contrast+distringuish.abi137.node +0 -0
- package/node_modules/@contrast/esm-hooks/lib/debug-methods.mjs +4 -4
- package/node_modules/@contrast/esm-hooks/lib/get-file-type.mjs +2 -9
- package/node_modules/@contrast/esm-hooks/lib/hooks.mjs +0 -2
- package/node_modules/@contrast/esm-hooks/lib/redirects/builtin/fs/promises.mjs +2 -0
- package/node_modules/@contrast/esm-hooks/lib/redirects/builtin/fs.mjs +3 -0
- package/node_modules/@contrast/esm-hooks/lib/redirects/builtin/util.mjs +1 -0
- package/node_modules/@contrast/esm-hooks/package.json +7 -7
- package/node_modules/@contrast/fn-inspect/package.json +9 -5
- package/node_modules/@contrast/fn-inspect/prebuilds/darwin-x64+arm64/@contrast+fn-inspect.abi108.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/darwin-x64+arm64/@contrast+fn-inspect.abi115.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/darwin-x64+arm64/@contrast+fn-inspect.abi127.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/darwin-x64+arm64/{@contrast+fn-inspect.abi93.node → @contrast+fn-inspect.abi137.node} +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/@contrast+fn-inspect.abi108.armv8.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/@contrast+fn-inspect.abi115.armv8.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/@contrast+fn-inspect.abi127.armv8.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/@contrast+fn-inspect.abi137.armv8.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi108.glibc.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi108.musl.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi115.glibc.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi115.musl.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi127.glibc.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi127.musl.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi137.glibc.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/{@contrast+fn-inspect.abi93.musl.node → @contrast+fn-inspect.abi137.musl.node} +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/@contrast+fn-inspect.abi108.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/@contrast+fn-inspect.abi115.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/@contrast+fn-inspect.abi127.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/@contrast+fn-inspect.abi137.node +0 -0
- package/node_modules/@contrast/instrumentation/lib/http2.js +0 -11
- package/node_modules/@contrast/instrumentation/package.json +6 -6
- package/node_modules/@contrast/library-analysis/lib/install/library-reporting/dep.json +312 -224
- package/node_modules/@contrast/library-analysis/package.json +6 -6
- package/node_modules/@contrast/logger/lib/index.js +18 -8
- package/node_modules/@contrast/logger/lib/serializers.js +5 -5
- package/node_modules/@contrast/logger/lib/utils.d.ts +0 -6
- package/node_modules/@contrast/logger/package.json +4 -4
- package/node_modules/@contrast/metrics/lib/index.d.ts +6 -6
- package/node_modules/@contrast/metrics/lib/index.js +0 -1
- package/node_modules/@contrast/metrics/package.json +7 -7
- package/node_modules/@contrast/patcher/package.json +3 -3
- package/node_modules/@contrast/perf/package.json +7 -4
- package/node_modules/@contrast/protect/lib/hardening/handlers.js +37 -21
- package/node_modules/@contrast/protect/lib/index.d.ts +3 -2
- package/node_modules/@contrast/protect/lib/index.js +9 -2
- package/node_modules/@contrast/protect/lib/input-analysis/handlers.js +275 -233
- package/node_modules/@contrast/protect/lib/input-analysis/install/http.js +3 -4
- package/node_modules/@contrast/protect/lib/input-tracing/{handlers/index.js → handlers.js} +15 -15
- package/node_modules/@contrast/protect/lib/input-tracing/index.js +0 -1
- package/node_modules/@contrast/protect/lib/make-source-context.js +5 -7
- package/node_modules/@contrast/protect/lib/policy.js +130 -95
- package/node_modules/@contrast/protect/lib/semantic-analysis/handlers.js +19 -18
- package/node_modules/@contrast/protect/package.json +12 -12
- package/node_modules/@contrast/reporter/lib/index.js +1 -1
- package/node_modules/@contrast/reporter/lib/reporters/base.d.ts +0 -1
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/index.d.ts +4 -2
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/index.js +14 -14
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/translations.d.ts +43 -6
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/translations.js +262 -429
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/server-inventory.d.ts +3 -3
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/index.js +17 -7
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/translations.js +12 -13
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/utils.js +6 -7
- package/node_modules/@contrast/reporter/lib/reporters/file.js +1 -1
- package/node_modules/@contrast/reporter/lib/reporters/security-logger/index.d.ts +2 -3
- package/node_modules/@contrast/reporter/lib/reporters/security-logger/index.js +72 -86
- package/node_modules/@contrast/reporter/lib/reporters/security-logger/messages.js +6 -7
- package/node_modules/@contrast/reporter/lib/validators.js +0 -1
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/.husky/pre-commit +2 -2
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/.taprc +5 -0
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/README.md +2 -4
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/bench.js +5 -36
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/index.js +56 -300
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/package.json +12 -7
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test.js +1684 -0
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/types/index.d.ts +1 -2
- package/node_modules/@contrast/reporter/package.json +10 -10
- package/node_modules/@contrast/rewriter/lib/index.js +5 -43
- package/node_modules/@contrast/rewriter/package.json +8 -8
- package/node_modules/@contrast/route-coverage/lib/install/express/express5.js +0 -5
- package/node_modules/@contrast/route-coverage/lib/install/restify.js +1 -1
- package/node_modules/@contrast/route-coverage/package.json +10 -10
- package/node_modules/@contrast/scopes/package.json +6 -6
- package/node_modules/@contrast/sec-obs/lib/traces/http.js +1 -1
- package/node_modules/@contrast/sec-obs/lib/traces/http.test.js +1 -1
- package/node_modules/@contrast/sec-obs/package.json +10 -10
- package/node_modules/@contrast/sources/lib/index.js +1 -1
- package/node_modules/@contrast/sources/lib/index.test.js +0 -26
- package/node_modules/@contrast/sources/package.json +3 -3
- package/node_modules/@contrast/telemetry/package.json +6 -6
- package/node_modules/@opentelemetry/semantic-conventions/README.md +3 -2
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.d.ts +4350 -2882
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.js +4350 -2882
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_events.d.ts +136 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_events.js +154 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_events.js.map +1 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_metrics.d.ts +713 -141
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_metrics.js +713 -141
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_metrics.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/index-incubating.d.ts +2 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/index-incubating.js +2 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/index-incubating.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/index.d.ts +1 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js +1 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.d.ts +7 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js +7 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.d.ts +5 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js +23 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js.map +1 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/version.d.ts +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/version.js +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/version.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_attributes.d.ts +4350 -2882
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_attributes.js +4350 -2882
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_attributes.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_events.d.ts +136 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_events.js +154 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_events.js.map +1 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_metrics.d.ts +713 -141
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_metrics.js +713 -141
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_metrics.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index-incubating.d.ts +2 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index-incubating.js +2 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index-incubating.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index.d.ts +1 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index.js +1 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.d.ts +7 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.js +7 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_events.d.ts +5 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_events.js +23 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_events.js.map +1 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/version.d.ts +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/version.js +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/version.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_attributes.d.ts +4350 -2882
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_attributes.js +4354 -2883
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_attributes.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_events.d.ts +136 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_events.js +157 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_events.js.map +1 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.d.ts +713 -141
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.js +720 -147
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/index-incubating.d.ts +2 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/src/index-incubating.js +2 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/src/index-incubating.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/index.d.ts +1 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/src/index.js +1 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/src/index.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.d.ts +7 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.js +10 -4
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_events.d.ts +5 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_events.js +26 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_events.js.map +1 -0
- package/node_modules/@opentelemetry/semantic-conventions/build/src/version.d.ts +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/version.js +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/build/src/version.js.map +1 -1
- package/node_modules/@opentelemetry/semantic-conventions/package.json +6 -7
- package/node_modules/@swc/core/README.md +5 -0
- package/node_modules/@swc/core/binding.d.ts +2 -2
- package/node_modules/@swc/core/index.d.ts +5 -4
- package/node_modules/@swc/core/index.js +2 -2
- package/node_modules/@swc/core/package.json +12 -12
- package/node_modules/@swc/core-darwin-arm64/package.json +1 -1
- package/node_modules/@swc/core-darwin-arm64/swc.darwin-arm64.node +0 -0
- package/node_modules/@swc/core-darwin-x64/package.json +1 -1
- package/node_modules/@swc/core-darwin-x64/swc.darwin-x64.node +0 -0
- package/node_modules/@swc/core-linux-arm64-gnu/package.json +1 -1
- package/node_modules/@swc/core-linux-arm64-gnu/swc.linux-arm64-gnu.node +0 -0
- package/node_modules/@swc/core-linux-arm64-musl/package.json +1 -1
- package/node_modules/@swc/core-linux-arm64-musl/swc.linux-arm64-musl.node +0 -0
- package/node_modules/@swc/core-linux-x64-gnu/package.json +1 -1
- package/node_modules/@swc/core-linux-x64-gnu/swc.linux-x64-gnu.node +0 -0
- package/node_modules/@swc/core-linux-x64-musl/package.json +1 -1
- package/node_modules/@swc/core-linux-x64-musl/swc.linux-x64-musl.node +0 -0
- package/node_modules/@swc/core-win32-arm64-msvc/package.json +1 -1
- package/node_modules/@swc/core-win32-arm64-msvc/swc.win32-arm64-msvc.node +0 -0
- package/node_modules/@swc/core-win32-x64-msvc/package.json +1 -1
- package/node_modules/@swc/core-win32-x64-msvc/swc.win32-x64-msvc.node +0 -0
- package/node_modules/@swc/types/index.d.ts +14 -5
- package/node_modules/@swc/types/package.json +2 -2
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/buffer.d.ts +1 -1
- package/node_modules/@types/node/child_process.d.ts +26 -122
- package/node_modules/@types/node/crypto.d.ts +44 -10
- package/node_modules/@types/node/dns.d.ts +5 -0
- package/node_modules/@types/node/fs/promises.d.ts +41 -26
- package/node_modules/@types/node/fs.d.ts +52 -35
- package/node_modules/@types/node/globals.d.ts +148 -347
- package/node_modules/@types/node/http.d.ts +29 -5
- package/node_modules/@types/node/https.d.ts +5 -0
- package/node_modules/@types/node/index.d.ts +7 -2
- package/node_modules/@types/node/inspector.d.ts +187 -4089
- package/node_modules/@types/node/inspector.generated.d.ts +4052 -0
- package/node_modules/@types/node/module.d.ts +1 -0
- package/node_modules/@types/node/net.d.ts +21 -0
- package/node_modules/@types/node/package.json +3 -3
- package/node_modules/@types/node/sqlite.d.ts +34 -0
- package/node_modules/@types/node/test.d.ts +104 -0
- package/node_modules/@types/node/tls.d.ts +32 -0
- package/node_modules/@types/node/ts5.6/index.d.ts +7 -2
- package/node_modules/@types/node/ts5.7/index.d.ts +7 -2
- package/node_modules/@types/node/url.d.ts +19 -5
- package/node_modules/@types/node/util.d.ts +6 -4
- package/node_modules/@types/node/vm.d.ts +73 -10
- package/node_modules/@types/node/wasi.d.ts +21 -0
- package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
- package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
- package/node_modules/@types/node/{dom-events.d.ts → web-globals/events.d.ts} +47 -52
- package/node_modules/@types/node/web-globals/fetch.d.ts +50 -0
- package/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
- package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
- package/node_modules/@types/node/worker_threads.d.ts +51 -3
- package/node_modules/axios/CHANGELOG.md +58 -0
- package/node_modules/axios/README.md +87 -10
- package/node_modules/axios/dist/axios.js +355 -289
- package/node_modules/axios/dist/axios.js.map +1 -1
- package/node_modules/axios/dist/axios.min.js +2 -2
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +286 -213
- package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
- package/node_modules/axios/dist/esm/axios.js +286 -213
- package/node_modules/axios/dist/esm/axios.js.map +1 -1
- package/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +377 -213
- package/node_modules/axios/dist/node/axios.cjs.map +1 -1
- package/node_modules/axios/index.d.cts +12 -5
- package/node_modules/axios/index.d.ts +13 -4
- package/node_modules/axios/lib/adapters/adapters.js +6 -4
- package/node_modules/axios/lib/adapters/fetch.js +221 -162
- package/node_modules/axios/lib/adapters/http.js +18 -0
- package/node_modules/axios/lib/adapters/xhr.js +11 -8
- package/node_modules/axios/lib/core/Axios.js +0 -2
- package/node_modules/axios/lib/core/AxiosError.js +10 -3
- package/node_modules/axios/lib/core/dispatchRequest.js +1 -1
- package/node_modules/axios/lib/defaults/index.js +1 -1
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/buildURL.js +1 -3
- package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +73 -0
- package/node_modules/axios/lib/helpers/resolveConfig.js +13 -9
- package/node_modules/axios/lib/utils.js +5 -3
- package/node_modules/axios/package.json +18 -12
- package/node_modules/balanced-match/.github/FUNDING.yml +2 -0
- package/node_modules/balanced-match/LICENSE.md +21 -0
- package/node_modules/balanced-match/README.md +97 -0
- package/node_modules/balanced-match/index.js +62 -0
- package/node_modules/balanced-match/package.json +48 -0
- package/node_modules/brace-expansion/.github/FUNDING.yml +2 -0
- package/node_modules/brace-expansion/LICENSE +21 -0
- package/node_modules/brace-expansion/README.md +135 -0
- package/node_modules/brace-expansion/index.js +203 -0
- package/node_modules/brace-expansion/package.json +49 -0
- package/node_modules/detect-libc/lib/detect-libc.js +59 -13
- package/node_modules/detect-libc/lib/elf.js +39 -0
- package/node_modules/detect-libc/lib/filesystem.js +18 -8
- package/node_modules/detect-libc/package.json +3 -2
- package/node_modules/minimatch/LICENSE +15 -0
- package/node_modules/minimatch/README.md +454 -0
- package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts +2 -0
- package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
- package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map +1 -0
- package/node_modules/minimatch/dist/commonjs/ast.d.ts +20 -0
- package/node_modules/minimatch/dist/commonjs/ast.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/ast.js +592 -0
- package/node_modules/minimatch/dist/commonjs/ast.js.map +1 -0
- package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts +8 -0
- package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/brace-expressions.js +152 -0
- package/node_modules/minimatch/dist/commonjs/brace-expressions.js.map +1 -0
- package/node_modules/minimatch/dist/commonjs/escape.d.ts +12 -0
- package/node_modules/minimatch/dist/commonjs/escape.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/escape.js +22 -0
- package/node_modules/minimatch/dist/commonjs/escape.js.map +1 -0
- package/node_modules/minimatch/dist/commonjs/index.d.ts +94 -0
- package/node_modules/minimatch/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/index.js +1017 -0
- package/node_modules/minimatch/dist/commonjs/index.js.map +1 -0
- package/node_modules/minimatch/dist/commonjs/package.json +3 -0
- package/node_modules/minimatch/dist/commonjs/unescape.d.ts +17 -0
- package/node_modules/minimatch/dist/commonjs/unescape.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/unescape.js +24 -0
- package/node_modules/minimatch/dist/commonjs/unescape.js.map +1 -0
- package/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts +2 -0
- package/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/assert-valid-pattern.js +10 -0
- package/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +1 -0
- package/node_modules/minimatch/dist/esm/ast.d.ts +20 -0
- package/node_modules/minimatch/dist/esm/ast.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/ast.js +588 -0
- package/node_modules/minimatch/dist/esm/ast.js.map +1 -0
- package/node_modules/minimatch/dist/esm/brace-expressions.d.ts +8 -0
- package/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/brace-expressions.js +148 -0
- package/node_modules/minimatch/dist/esm/brace-expressions.js.map +1 -0
- package/node_modules/minimatch/dist/esm/escape.d.ts +12 -0
- package/node_modules/minimatch/dist/esm/escape.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/escape.js +18 -0
- package/node_modules/minimatch/dist/esm/escape.js.map +1 -0
- package/node_modules/minimatch/dist/esm/index.d.ts +94 -0
- package/node_modules/minimatch/dist/esm/index.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/index.js +1001 -0
- package/node_modules/minimatch/dist/esm/index.js.map +1 -0
- package/node_modules/minimatch/dist/esm/package.json +3 -0
- package/node_modules/minimatch/dist/esm/unescape.d.ts +17 -0
- package/node_modules/minimatch/dist/esm/unescape.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/unescape.js +20 -0
- package/node_modules/minimatch/dist/esm/unescape.js.map +1 -0
- package/node_modules/minimatch/package.json +82 -0
- package/node_modules/node-abi/LICENSE +21 -0
- package/node_modules/node-abi/README.md +54 -0
- package/node_modules/node-abi/abi_registry.json +408 -0
- package/node_modules/node-abi/getNextTarget.js +13 -0
- package/node_modules/node-abi/index.js +161 -0
- package/node_modules/node-abi/package.json +46 -0
- package/node_modules/node-addon-api/README.md +25 -249
- package/node_modules/node-addon-api/common.gypi +1 -0
- package/node_modules/node-addon-api/index.js +2 -0
- package/node_modules/node-addon-api/napi-inl.h +592 -166
- package/node_modules/node-addon-api/napi.h +167 -59
- package/node_modules/node-addon-api/node_addon_api.gyp +10 -0
- package/node_modules/node-addon-api/noexcept.gypi +1 -1
- package/node_modules/node-addon-api/package.json +13 -13
- package/node_modules/node-addon-api/tools/conversion.js +1 -1
- package/node_modules/protobufjs/dist/light/protobuf.js +2 -2
- package/node_modules/protobufjs/dist/light/protobuf.min.js +2 -2
- package/node_modules/protobufjs/dist/minimal/protobuf.js +2 -2
- package/node_modules/protobufjs/dist/minimal/protobuf.min.js +2 -2
- package/node_modules/protobufjs/dist/protobuf.js +2 -2
- package/node_modules/protobufjs/dist/protobuf.min.js +2 -2
- package/node_modules/protobufjs/google/protobuf/descriptor.json +2 -2
- package/node_modules/protobufjs/google/protobuf/descriptor.proto +2 -1
- package/node_modules/protobufjs/package.json +1 -1
- package/node_modules/undici-types/diagnostics-channel.d.ts +9 -0
- package/node_modules/undici-types/dispatcher.d.ts +3 -2
- package/node_modules/undici-types/env-http-proxy-agent.d.ts +2 -1
- package/node_modules/undici-types/eventsource.d.ts +3 -3
- package/node_modules/undici-types/fetch.d.ts +1 -0
- package/node_modules/undici-types/handlers.d.ts +1 -1
- package/node_modules/undici-types/mock-client.d.ts +2 -0
- package/node_modules/undici-types/mock-interceptor.d.ts +2 -0
- package/node_modules/undici-types/mock-pool.d.ts +2 -0
- package/node_modules/undici-types/package.json +1 -1
- package/node_modules/undici-types/retry-handler.d.ts +9 -0
- package/node_modules/undici-types/webidl.d.ts +29 -15
- package/node_modules/undici-types/websocket.d.ts +3 -1
- package/package.json +3 -3
- package/node_modules/@contrast/code-events/prebuilds/linux-arm64/@contrast+code-events.abi93.armv8.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi93.glibc.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi93.musl.node +0 -0
- package/node_modules/@contrast/code-events/prebuilds/win32-x64/@contrast+code-events.abi93.node +0 -0
- package/node_modules/@contrast/core/lib/sensitive-data-masking/protect-listener.js +0 -111
- package/node_modules/@contrast/distringuish/prebuilds/linux-arm64/@contrast+distringuish.abi93.armv8.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi93.glibc.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi93.musl.node +0 -0
- package/node_modules/@contrast/distringuish/prebuilds/win32-x64/@contrast+distringuish.abi93.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/@contrast+fn-inspect.abi93.armv8.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi93.glibc.node +0 -0
- package/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/@contrast+fn-inspect.abi93.node +0 -0
- package/node_modules/@contrast/perf/lib/index.test.js +0 -547
- package/node_modules/@contrast/perf/lib/tsconfig.json +0 -31
- package/node_modules/@contrast/protect/lib/input-tracing/install/spdy.js +0 -63
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/.taprc.yaml +0 -11
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/destroy.test.js +0 -49
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/end.test.js +0 -98
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/flush-sync.test.js +0 -140
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/flush.test.js +0 -419
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/fsync.test.js +0 -63
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/helper.js +0 -42
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/minlength.test.js +0 -35
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/mode.test.js +0 -116
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/reopen.test.js +0 -239
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/retry.test.js +0 -414
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/sync.test.js +0 -261
- package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/write.test.js +0 -465
- package/node_modules/node-addon-api/tools/eslint-format.js +0 -79
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const { join } = require('path')
|
|
4
|
-
const { fork } = require('child_process')
|
|
5
|
-
const fs = require('fs')
|
|
6
|
-
const SonicBoom = require('../')
|
|
7
|
-
const { file, runTests } = require('./helper')
|
|
8
|
-
|
|
9
|
-
runTests(buildTests)
|
|
10
|
-
|
|
11
|
-
function buildTests (test, sync) {
|
|
12
|
-
// Reset the umask for testing
|
|
13
|
-
process.umask(0o000)
|
|
14
|
-
|
|
15
|
-
test('end after reopen', (t) => {
|
|
16
|
-
t.plan(4)
|
|
17
|
-
|
|
18
|
-
const dest = file()
|
|
19
|
-
const stream = new SonicBoom({ dest, minLength: 4096, sync })
|
|
20
|
-
|
|
21
|
-
stream.once('ready', () => {
|
|
22
|
-
t.pass('ready emitted')
|
|
23
|
-
const after = dest + '-moved'
|
|
24
|
-
stream.reopen(after)
|
|
25
|
-
stream.write('after reopen\n')
|
|
26
|
-
stream.on('finish', () => {
|
|
27
|
-
t.pass('finish emitted')
|
|
28
|
-
fs.readFile(after, 'utf8', (err, data) => {
|
|
29
|
-
t.error(err)
|
|
30
|
-
t.equal(data, 'after reopen\n')
|
|
31
|
-
})
|
|
32
|
-
})
|
|
33
|
-
stream.end()
|
|
34
|
-
})
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
test('end after 2x reopen', (t) => {
|
|
38
|
-
t.plan(4)
|
|
39
|
-
|
|
40
|
-
const dest = file()
|
|
41
|
-
const stream = new SonicBoom({ dest, minLength: 4096, sync })
|
|
42
|
-
|
|
43
|
-
stream.once('ready', () => {
|
|
44
|
-
t.pass('ready emitted')
|
|
45
|
-
stream.reopen(dest + '-moved')
|
|
46
|
-
const after = dest + '-moved-moved'
|
|
47
|
-
stream.reopen(after)
|
|
48
|
-
stream.write('after reopen\n')
|
|
49
|
-
stream.on('finish', () => {
|
|
50
|
-
t.pass('finish emitted')
|
|
51
|
-
fs.readFile(after, 'utf8', (err, data) => {
|
|
52
|
-
t.error(err)
|
|
53
|
-
t.equal(data, 'after reopen\n')
|
|
54
|
-
})
|
|
55
|
-
})
|
|
56
|
-
stream.end()
|
|
57
|
-
})
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
test('end if not ready', (t) => {
|
|
61
|
-
t.plan(3)
|
|
62
|
-
|
|
63
|
-
const dest = file()
|
|
64
|
-
const stream = new SonicBoom({ dest, minLength: 4096, sync })
|
|
65
|
-
const after = dest + '-moved'
|
|
66
|
-
stream.reopen(after)
|
|
67
|
-
stream.write('after reopen\n')
|
|
68
|
-
stream.on('finish', () => {
|
|
69
|
-
t.pass('finish emitted')
|
|
70
|
-
fs.readFile(after, 'utf8', (err, data) => {
|
|
71
|
-
t.error(err)
|
|
72
|
-
t.equal(data, 'after reopen\n')
|
|
73
|
-
})
|
|
74
|
-
})
|
|
75
|
-
stream.end()
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
test('chunk data accordingly', (t) => {
|
|
79
|
-
t.plan(2)
|
|
80
|
-
|
|
81
|
-
const child = fork(join(__dirname, '..', 'fixtures', 'firehose.js'), { silent: true })
|
|
82
|
-
const str = Buffer.alloc(10000).fill('a').toString()
|
|
83
|
-
|
|
84
|
-
let data = ''
|
|
85
|
-
|
|
86
|
-
child.stdout.on('data', function (chunk) {
|
|
87
|
-
data += chunk.toString()
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
child.stdout.on('end', function () {
|
|
91
|
-
t.equal(data, str)
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
child.on('close', function (code) {
|
|
95
|
-
t.equal(code, 0)
|
|
96
|
-
})
|
|
97
|
-
})
|
|
98
|
-
}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const { test } = require('tap')
|
|
4
|
-
const fs = require('fs')
|
|
5
|
-
const proxyquire = require('proxyquire')
|
|
6
|
-
const SonicBoom = require('../')
|
|
7
|
-
const { file, runTests } = require('./helper')
|
|
8
|
-
|
|
9
|
-
runTests(buildTests)
|
|
10
|
-
|
|
11
|
-
function buildTests (test, sync) {
|
|
12
|
-
// Reset the umask for testing
|
|
13
|
-
process.umask(0o000)
|
|
14
|
-
|
|
15
|
-
test('flushSync', (t) => {
|
|
16
|
-
t.plan(4)
|
|
17
|
-
|
|
18
|
-
const dest = file()
|
|
19
|
-
const fd = fs.openSync(dest, 'w')
|
|
20
|
-
const stream = new SonicBoom({ fd, minLength: 4096, sync })
|
|
21
|
-
|
|
22
|
-
t.ok(stream.write('hello world\n'))
|
|
23
|
-
t.ok(stream.write('something else\n'))
|
|
24
|
-
|
|
25
|
-
stream.flushSync()
|
|
26
|
-
|
|
27
|
-
// let the file system settle down things
|
|
28
|
-
setImmediate(function () {
|
|
29
|
-
stream.end()
|
|
30
|
-
const data = fs.readFileSync(dest, 'utf8')
|
|
31
|
-
t.equal(data, 'hello world\nsomething else\n')
|
|
32
|
-
|
|
33
|
-
stream.on('close', () => {
|
|
34
|
-
t.pass('close emitted')
|
|
35
|
-
})
|
|
36
|
-
})
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
test('retry in flushSync on EAGAIN', (t) => {
|
|
41
|
-
t.plan(7)
|
|
42
|
-
|
|
43
|
-
const fakeFs = Object.create(fs)
|
|
44
|
-
const SonicBoom = proxyquire('../', {
|
|
45
|
-
fs: fakeFs
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
const dest = file()
|
|
49
|
-
const fd = fs.openSync(dest, 'w')
|
|
50
|
-
const stream = new SonicBoom({ fd, sync: false, minLength: 0 })
|
|
51
|
-
|
|
52
|
-
stream.on('ready', () => {
|
|
53
|
-
t.pass('ready emitted')
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
t.ok(stream.write('hello world\n'))
|
|
57
|
-
|
|
58
|
-
fakeFs.writeSync = function (fd, buf, enc) {
|
|
59
|
-
t.pass('fake fs.write called')
|
|
60
|
-
fakeFs.writeSync = fs.writeSync
|
|
61
|
-
const err = new Error('EAGAIN')
|
|
62
|
-
err.code = 'EAGAIN'
|
|
63
|
-
throw err
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
t.ok(stream.write('something else\n'))
|
|
67
|
-
|
|
68
|
-
stream.flushSync()
|
|
69
|
-
stream.end()
|
|
70
|
-
|
|
71
|
-
stream.on('finish', () => {
|
|
72
|
-
fs.readFile(dest, 'utf8', (err, data) => {
|
|
73
|
-
t.error(err)
|
|
74
|
-
t.equal(data, 'hello world\nsomething else\n')
|
|
75
|
-
})
|
|
76
|
-
})
|
|
77
|
-
stream.on('close', () => {
|
|
78
|
-
t.pass('close emitted')
|
|
79
|
-
})
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
test('throw error in flushSync on EAGAIN', (t) => {
|
|
83
|
-
t.plan(12)
|
|
84
|
-
|
|
85
|
-
const fakeFs = Object.create(fs)
|
|
86
|
-
const SonicBoom = proxyquire('../', {
|
|
87
|
-
fs: fakeFs
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
const dest = file()
|
|
91
|
-
const fd = fs.openSync(dest, 'w')
|
|
92
|
-
const stream = new SonicBoom({
|
|
93
|
-
fd,
|
|
94
|
-
sync: false,
|
|
95
|
-
minLength: 1000,
|
|
96
|
-
retryEAGAIN: (err, writeBufferLen, remainingBufferLen) => {
|
|
97
|
-
t.equal(err.code, 'EAGAIN')
|
|
98
|
-
t.equal(writeBufferLen, 12)
|
|
99
|
-
t.equal(remainingBufferLen, 0)
|
|
100
|
-
return false
|
|
101
|
-
}
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
stream.on('ready', () => {
|
|
105
|
-
t.pass('ready emitted')
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
const err = new Error('EAGAIN')
|
|
109
|
-
err.code = 'EAGAIN'
|
|
110
|
-
fakeFs.writeSync = function (fd, buf, enc) {
|
|
111
|
-
Error.captureStackTrace(err)
|
|
112
|
-
t.pass('fake fs.write called')
|
|
113
|
-
fakeFs.writeSync = fs.writeSync
|
|
114
|
-
throw err
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
fakeFs.fsyncSync = function (...args) {
|
|
118
|
-
t.pass('fake fs.fsyncSync called')
|
|
119
|
-
fakeFs.fsyncSync = fs.fsyncSync
|
|
120
|
-
return fs.fsyncSync.apply(null, args)
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
t.ok(stream.write('hello world\n'))
|
|
124
|
-
t.throws(stream.flushSync.bind(stream), err, 'EAGAIN')
|
|
125
|
-
|
|
126
|
-
t.ok(stream.write('something else\n'))
|
|
127
|
-
stream.flushSync()
|
|
128
|
-
|
|
129
|
-
stream.end()
|
|
130
|
-
|
|
131
|
-
stream.on('finish', () => {
|
|
132
|
-
fs.readFile(dest, 'utf8', (err, data) => {
|
|
133
|
-
t.error(err)
|
|
134
|
-
t.equal(data, 'hello world\nsomething else\n')
|
|
135
|
-
})
|
|
136
|
-
})
|
|
137
|
-
stream.on('close', () => {
|
|
138
|
-
t.pass('close emitted')
|
|
139
|
-
})
|
|
140
|
-
})
|
|
@@ -1,419 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const fs = require('fs')
|
|
4
|
-
const path = require('path')
|
|
5
|
-
const SonicBoom = require('../')
|
|
6
|
-
const { file, runTests } = require('./helper')
|
|
7
|
-
const proxyquire = require('proxyquire')
|
|
8
|
-
|
|
9
|
-
runTests(buildTests)
|
|
10
|
-
|
|
11
|
-
function buildTests (test, sync) {
|
|
12
|
-
// Reset the unmask for testing
|
|
13
|
-
process.umask(0o000)
|
|
14
|
-
|
|
15
|
-
test('append', (t) => {
|
|
16
|
-
t.plan(4)
|
|
17
|
-
|
|
18
|
-
const dest = file()
|
|
19
|
-
fs.writeFileSync(dest, 'hello world\n')
|
|
20
|
-
const stream = new SonicBoom({ dest, append: false, sync })
|
|
21
|
-
|
|
22
|
-
stream.on('ready', () => {
|
|
23
|
-
t.pass('ready emitted')
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
t.ok(stream.write('something else\n'))
|
|
27
|
-
|
|
28
|
-
stream.flush()
|
|
29
|
-
|
|
30
|
-
stream.on('drain', () => {
|
|
31
|
-
fs.readFile(dest, 'utf8', (err, data) => {
|
|
32
|
-
t.error(err)
|
|
33
|
-
t.equal(data, 'something else\n')
|
|
34
|
-
stream.end()
|
|
35
|
-
})
|
|
36
|
-
})
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
test('mkdir', (t) => {
|
|
40
|
-
t.plan(4)
|
|
41
|
-
|
|
42
|
-
const dest = path.join(file(), 'out.log')
|
|
43
|
-
const stream = new SonicBoom({ dest, mkdir: true, sync })
|
|
44
|
-
|
|
45
|
-
stream.on('ready', () => {
|
|
46
|
-
t.pass('ready emitted')
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
t.ok(stream.write('hello world\n'))
|
|
50
|
-
|
|
51
|
-
stream.flush()
|
|
52
|
-
|
|
53
|
-
stream.on('drain', () => {
|
|
54
|
-
fs.readFile(dest, 'utf8', (err, data) => {
|
|
55
|
-
t.error(err)
|
|
56
|
-
t.equal(data, 'hello world\n')
|
|
57
|
-
stream.end()
|
|
58
|
-
})
|
|
59
|
-
})
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
test('flush', (t) => {
|
|
63
|
-
t.plan(5)
|
|
64
|
-
|
|
65
|
-
const dest = file()
|
|
66
|
-
const fd = fs.openSync(dest, 'w')
|
|
67
|
-
const stream = new SonicBoom({ fd, minLength: 4096, sync })
|
|
68
|
-
|
|
69
|
-
stream.on('ready', () => {
|
|
70
|
-
t.pass('ready emitted')
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
t.ok(stream.write('hello world\n'))
|
|
74
|
-
t.ok(stream.write('something else\n'))
|
|
75
|
-
|
|
76
|
-
stream.flush()
|
|
77
|
-
|
|
78
|
-
stream.on('drain', () => {
|
|
79
|
-
fs.readFile(dest, 'utf8', (err, data) => {
|
|
80
|
-
t.error(err)
|
|
81
|
-
t.equal(data, 'hello world\nsomething else\n')
|
|
82
|
-
stream.end()
|
|
83
|
-
})
|
|
84
|
-
})
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
test('flush with no data', (t) => {
|
|
88
|
-
t.plan(2)
|
|
89
|
-
|
|
90
|
-
const dest = file()
|
|
91
|
-
const fd = fs.openSync(dest, 'w')
|
|
92
|
-
const stream = new SonicBoom({ fd, minLength: 4096, sync })
|
|
93
|
-
|
|
94
|
-
stream.on('ready', () => {
|
|
95
|
-
t.pass('ready emitted')
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
stream.flush()
|
|
99
|
-
|
|
100
|
-
stream.on('drain', () => {
|
|
101
|
-
t.pass('drain emitted')
|
|
102
|
-
})
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
test('call flush cb after flushed', (t) => {
|
|
106
|
-
t.plan(4)
|
|
107
|
-
|
|
108
|
-
const dest = file()
|
|
109
|
-
const fd = fs.openSync(dest, 'w')
|
|
110
|
-
const stream = new SonicBoom({ fd, minLength: 4096, sync })
|
|
111
|
-
|
|
112
|
-
stream.on('ready', () => {
|
|
113
|
-
t.pass('ready emitted')
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
t.ok(stream.write('hello world\n'))
|
|
117
|
-
t.ok(stream.write('something else\n'))
|
|
118
|
-
|
|
119
|
-
stream.flush((err) => {
|
|
120
|
-
if (err) t.fail(err)
|
|
121
|
-
else t.pass('flush cb called')
|
|
122
|
-
})
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
test('only call fsyncSync and not fsync when fsync: true', (t) => {
|
|
126
|
-
t.plan(6)
|
|
127
|
-
|
|
128
|
-
const fakeFs = Object.create(fs)
|
|
129
|
-
const SonicBoom = proxyquire('../', {
|
|
130
|
-
fs: fakeFs
|
|
131
|
-
})
|
|
132
|
-
|
|
133
|
-
const dest = file()
|
|
134
|
-
const fd = fs.openSync(dest, 'w')
|
|
135
|
-
const stream = new SonicBoom({
|
|
136
|
-
fd,
|
|
137
|
-
sync,
|
|
138
|
-
fsync: true,
|
|
139
|
-
minLength: 4096
|
|
140
|
-
})
|
|
141
|
-
|
|
142
|
-
stream.on('ready', () => {
|
|
143
|
-
t.pass('ready emitted')
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
fakeFs.fsync = function (fd, cb) {
|
|
147
|
-
t.fail('fake fs.fsync called while should not')
|
|
148
|
-
cb()
|
|
149
|
-
}
|
|
150
|
-
fakeFs.fsyncSync = function (fd) {
|
|
151
|
-
t.pass('fake fsyncSync called')
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
function successOnAsyncOrSyncFn (isSync, originalFn) {
|
|
155
|
-
return function (...args) {
|
|
156
|
-
t.pass(`fake fs.${originalFn.name} called`)
|
|
157
|
-
fakeFs[originalFn.name] = originalFn
|
|
158
|
-
return fakeFs[originalFn.name](...args)
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (sync) {
|
|
163
|
-
fakeFs.writeSync = successOnAsyncOrSyncFn(true, fs.writeSync)
|
|
164
|
-
} else {
|
|
165
|
-
fakeFs.write = successOnAsyncOrSyncFn(false, fs.write)
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
t.ok(stream.write('hello world\n'))
|
|
169
|
-
stream.flush((err) => {
|
|
170
|
-
if (err) t.fail(err)
|
|
171
|
-
else t.pass('flush cb called')
|
|
172
|
-
|
|
173
|
-
process.nextTick(() => {
|
|
174
|
-
// to make sure fsync is not called as well
|
|
175
|
-
t.pass('nextTick after flush called')
|
|
176
|
-
})
|
|
177
|
-
})
|
|
178
|
-
})
|
|
179
|
-
|
|
180
|
-
test('call flush cb with error when fsync failed', (t) => {
|
|
181
|
-
t.plan(5)
|
|
182
|
-
|
|
183
|
-
const fakeFs = Object.create(fs)
|
|
184
|
-
const SonicBoom = proxyquire('../', {
|
|
185
|
-
fs: fakeFs
|
|
186
|
-
})
|
|
187
|
-
|
|
188
|
-
const dest = file()
|
|
189
|
-
const fd = fs.openSync(dest, 'w')
|
|
190
|
-
const stream = new SonicBoom({
|
|
191
|
-
fd,
|
|
192
|
-
sync,
|
|
193
|
-
minLength: 4096
|
|
194
|
-
})
|
|
195
|
-
|
|
196
|
-
stream.on('ready', () => {
|
|
197
|
-
t.pass('ready emitted')
|
|
198
|
-
})
|
|
199
|
-
|
|
200
|
-
const err = new Error('other')
|
|
201
|
-
err.code = 'other'
|
|
202
|
-
|
|
203
|
-
function onFsyncOnFsyncSync (isSync, originalFn) {
|
|
204
|
-
return function (...args) {
|
|
205
|
-
Error.captureStackTrace(err)
|
|
206
|
-
t.pass(`fake fs.${originalFn.name} called`)
|
|
207
|
-
fakeFs[originalFn.name] = originalFn
|
|
208
|
-
const cb = args[args.length - 1]
|
|
209
|
-
|
|
210
|
-
cb(err)
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
// only one is called depends on sync
|
|
215
|
-
fakeFs.fsync = onFsyncOnFsyncSync(false, fs.fsync)
|
|
216
|
-
|
|
217
|
-
function successOnAsyncOrSyncFn (isSync, originalFn) {
|
|
218
|
-
return function (...args) {
|
|
219
|
-
t.pass(`fake fs.${originalFn.name} called`)
|
|
220
|
-
fakeFs[originalFn.name] = originalFn
|
|
221
|
-
return fakeFs[originalFn.name](...args)
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
if (sync) {
|
|
226
|
-
fakeFs.writeSync = successOnAsyncOrSyncFn(true, fs.writeSync)
|
|
227
|
-
} else {
|
|
228
|
-
fakeFs.write = successOnAsyncOrSyncFn(false, fs.write)
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
t.ok(stream.write('hello world\n'))
|
|
232
|
-
stream.flush((err) => {
|
|
233
|
-
if (err) t.equal(err.code, 'other')
|
|
234
|
-
else t.fail('flush cb called without an error')
|
|
235
|
-
})
|
|
236
|
-
})
|
|
237
|
-
|
|
238
|
-
test('call flush cb even when have no data', (t) => {
|
|
239
|
-
t.plan(2)
|
|
240
|
-
|
|
241
|
-
const dest = file()
|
|
242
|
-
const fd = fs.openSync(dest, 'w')
|
|
243
|
-
const stream = new SonicBoom({ fd, minLength: 4096, sync })
|
|
244
|
-
|
|
245
|
-
stream.on('ready', () => {
|
|
246
|
-
t.pass('ready emitted')
|
|
247
|
-
|
|
248
|
-
stream.flush((err) => {
|
|
249
|
-
if (err) t.fail(err)
|
|
250
|
-
else t.pass('flush cb called')
|
|
251
|
-
})
|
|
252
|
-
})
|
|
253
|
-
})
|
|
254
|
-
|
|
255
|
-
test('call flush cb even when minLength is 0', (t) => {
|
|
256
|
-
t.plan(1)
|
|
257
|
-
|
|
258
|
-
const dest = file()
|
|
259
|
-
const fd = fs.openSync(dest, 'w')
|
|
260
|
-
const stream = new SonicBoom({ fd, minLength: 0, sync })
|
|
261
|
-
|
|
262
|
-
stream.flush((err) => {
|
|
263
|
-
if (err) t.fail(err)
|
|
264
|
-
else t.pass('flush cb called')
|
|
265
|
-
})
|
|
266
|
-
})
|
|
267
|
-
|
|
268
|
-
test('call flush cb with an error when trying to flush destroyed stream', (t) => {
|
|
269
|
-
t.plan(1)
|
|
270
|
-
|
|
271
|
-
const dest = file()
|
|
272
|
-
const fd = fs.openSync(dest, 'w')
|
|
273
|
-
const stream = new SonicBoom({ fd, minLength: 4096, sync })
|
|
274
|
-
stream.destroy()
|
|
275
|
-
|
|
276
|
-
stream.flush((err) => {
|
|
277
|
-
if (err) t.pass(err)
|
|
278
|
-
else t.fail('flush cb called without an error')
|
|
279
|
-
})
|
|
280
|
-
})
|
|
281
|
-
|
|
282
|
-
test('call flush cb with an error when failed to flush', (t) => {
|
|
283
|
-
t.plan(5)
|
|
284
|
-
|
|
285
|
-
const fakeFs = Object.create(fs)
|
|
286
|
-
const SonicBoom = proxyquire('../', {
|
|
287
|
-
fs: fakeFs
|
|
288
|
-
})
|
|
289
|
-
|
|
290
|
-
const dest = file()
|
|
291
|
-
const fd = fs.openSync(dest, 'w')
|
|
292
|
-
const stream = new SonicBoom({
|
|
293
|
-
fd,
|
|
294
|
-
sync,
|
|
295
|
-
minLength: 4096
|
|
296
|
-
})
|
|
297
|
-
|
|
298
|
-
stream.on('ready', () => {
|
|
299
|
-
t.pass('ready emitted')
|
|
300
|
-
})
|
|
301
|
-
|
|
302
|
-
const err = new Error('other')
|
|
303
|
-
err.code = 'other'
|
|
304
|
-
|
|
305
|
-
function onWriteOrWriteSync (isSync, originalFn) {
|
|
306
|
-
return function (...args) {
|
|
307
|
-
Error.captureStackTrace(err)
|
|
308
|
-
t.pass(`fake fs.${originalFn.name} called`)
|
|
309
|
-
fakeFs[originalFn.name] = originalFn
|
|
310
|
-
|
|
311
|
-
if (isSync) throw err
|
|
312
|
-
const cb = args[args.length - 1]
|
|
313
|
-
|
|
314
|
-
cb(err)
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
// only one is called depends on sync
|
|
319
|
-
fakeFs.write = onWriteOrWriteSync(false, fs.write)
|
|
320
|
-
fakeFs.writeSync = onWriteOrWriteSync(true, fs.writeSync)
|
|
321
|
-
|
|
322
|
-
t.ok(stream.write('hello world\n'))
|
|
323
|
-
stream.flush((err) => {
|
|
324
|
-
if (err) t.equal(err.code, 'other')
|
|
325
|
-
else t.fail('flush cb called without an error')
|
|
326
|
-
})
|
|
327
|
-
|
|
328
|
-
stream.end()
|
|
329
|
-
|
|
330
|
-
stream.on('close', () => {
|
|
331
|
-
t.pass('close emitted')
|
|
332
|
-
})
|
|
333
|
-
})
|
|
334
|
-
|
|
335
|
-
test('call flush cb when finish writing when currently in the middle', (t) => {
|
|
336
|
-
t.plan(4)
|
|
337
|
-
|
|
338
|
-
const fakeFs = Object.create(fs)
|
|
339
|
-
const SonicBoom = proxyquire('../', {
|
|
340
|
-
fs: fakeFs
|
|
341
|
-
})
|
|
342
|
-
|
|
343
|
-
const dest = file()
|
|
344
|
-
const fd = fs.openSync(dest, 'w')
|
|
345
|
-
const stream = new SonicBoom({
|
|
346
|
-
fd,
|
|
347
|
-
sync,
|
|
348
|
-
|
|
349
|
-
// to trigger write without calling flush
|
|
350
|
-
minLength: 1
|
|
351
|
-
})
|
|
352
|
-
|
|
353
|
-
stream.on('ready', () => {
|
|
354
|
-
t.pass('ready emitted')
|
|
355
|
-
})
|
|
356
|
-
|
|
357
|
-
function onWriteOrWriteSync (originalFn) {
|
|
358
|
-
return function (...args) {
|
|
359
|
-
stream.flush((err) => {
|
|
360
|
-
if (err) t.fail(err)
|
|
361
|
-
else t.pass('flush cb called')
|
|
362
|
-
})
|
|
363
|
-
|
|
364
|
-
t.pass(`fake fs.${originalFn.name} called`)
|
|
365
|
-
fakeFs[originalFn.name] = originalFn
|
|
366
|
-
return originalFn(...args)
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
// only one is called depends on sync
|
|
371
|
-
fakeFs.write = onWriteOrWriteSync(fs.write)
|
|
372
|
-
fakeFs.writeSync = onWriteOrWriteSync(fs.writeSync)
|
|
373
|
-
|
|
374
|
-
t.ok(stream.write('hello world\n'))
|
|
375
|
-
})
|
|
376
|
-
|
|
377
|
-
test('call flush cb when writing and trying to flush before ready (on async)', (t) => {
|
|
378
|
-
t.plan(4)
|
|
379
|
-
|
|
380
|
-
const fakeFs = Object.create(fs)
|
|
381
|
-
const SonicBoom = proxyquire('../', {
|
|
382
|
-
fs: fakeFs
|
|
383
|
-
})
|
|
384
|
-
|
|
385
|
-
fakeFs.open = fsOpen
|
|
386
|
-
|
|
387
|
-
const dest = file()
|
|
388
|
-
const stream = new SonicBoom({
|
|
389
|
-
fd: dest,
|
|
390
|
-
// only async as sync is part of the constructor so the user will not be able to call write/flush
|
|
391
|
-
// before ready
|
|
392
|
-
sync: false,
|
|
393
|
-
|
|
394
|
-
// to not trigger write without calling flush
|
|
395
|
-
minLength: 4096
|
|
396
|
-
})
|
|
397
|
-
|
|
398
|
-
stream.on('ready', () => {
|
|
399
|
-
t.pass('ready emitted')
|
|
400
|
-
})
|
|
401
|
-
|
|
402
|
-
function fsOpen (...args) {
|
|
403
|
-
process.nextTick(() => {
|
|
404
|
-
// try writing and flushing before ready and in the middle of opening
|
|
405
|
-
t.pass('fake fs.open called')
|
|
406
|
-
t.ok(stream.write('hello world\n'))
|
|
407
|
-
|
|
408
|
-
// calling flush
|
|
409
|
-
stream.flush((err) => {
|
|
410
|
-
if (err) t.fail(err)
|
|
411
|
-
else t.pass('flush cb called')
|
|
412
|
-
})
|
|
413
|
-
|
|
414
|
-
fakeFs.open = fs.open
|
|
415
|
-
fs.open(...args)
|
|
416
|
-
})
|
|
417
|
-
}
|
|
418
|
-
})
|
|
419
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const { test } = require('tap')
|
|
4
|
-
const fs = require('fs')
|
|
5
|
-
const proxyquire = require('proxyquire')
|
|
6
|
-
const { file } = require('./helper')
|
|
7
|
-
|
|
8
|
-
test('fsync with sync', (t) => {
|
|
9
|
-
t.plan(5)
|
|
10
|
-
|
|
11
|
-
const fakeFs = Object.create(fs)
|
|
12
|
-
fakeFs.fsyncSync = function (fd) {
|
|
13
|
-
t.pass('fake fs.fsyncSync called')
|
|
14
|
-
return fs.fsyncSync(fd)
|
|
15
|
-
}
|
|
16
|
-
const SonicBoom = proxyquire('../', {
|
|
17
|
-
fs: fakeFs
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
const dest = file()
|
|
21
|
-
const fd = fs.openSync(dest, 'w')
|
|
22
|
-
const stream = new SonicBoom({ fd, sync: true, fsync: true })
|
|
23
|
-
|
|
24
|
-
t.ok(stream.write('hello world\n'))
|
|
25
|
-
t.ok(stream.write('something else\n'))
|
|
26
|
-
|
|
27
|
-
stream.end()
|
|
28
|
-
|
|
29
|
-
const data = fs.readFileSync(dest, 'utf8')
|
|
30
|
-
t.equal(data, 'hello world\nsomething else\n')
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
test('fsync with async', (t) => {
|
|
34
|
-
t.plan(7)
|
|
35
|
-
|
|
36
|
-
const fakeFs = Object.create(fs)
|
|
37
|
-
fakeFs.fsyncSync = function (fd) {
|
|
38
|
-
t.pass('fake fs.fsyncSync called')
|
|
39
|
-
return fs.fsyncSync(fd)
|
|
40
|
-
}
|
|
41
|
-
const SonicBoom = proxyquire('../', {
|
|
42
|
-
fs: fakeFs
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
const dest = file()
|
|
46
|
-
const fd = fs.openSync(dest, 'w')
|
|
47
|
-
const stream = new SonicBoom({ fd, fsync: true })
|
|
48
|
-
|
|
49
|
-
t.ok(stream.write('hello world\n'))
|
|
50
|
-
t.ok(stream.write('something else\n'))
|
|
51
|
-
|
|
52
|
-
stream.end()
|
|
53
|
-
|
|
54
|
-
stream.on('finish', () => {
|
|
55
|
-
fs.readFile(dest, 'utf8', (err, data) => {
|
|
56
|
-
t.error(err)
|
|
57
|
-
t.equal(data, 'hello world\nsomething else\n')
|
|
58
|
-
})
|
|
59
|
-
})
|
|
60
|
-
stream.on('close', () => {
|
|
61
|
-
t.pass('close emitted')
|
|
62
|
-
})
|
|
63
|
-
})
|