Back | Home
الـ Path الحالي: /home/picotech/domains/instantly.picotech.app/public_html/public/uploads/../uploads/../../../../instantly.picotech.app/homes/../../wa.picotech.app/public_html/node_modules/path-exists/../duplexify/./../@protobufjs/../cheerio/../negotiator/../long/../http-errors/../atomic-sleep/.././thread-stream/test
الملفات الموجودة في هذا الـ Path:
.
..
base.test.js
bench.test.js
bundlers.test.js
close-on-gc.js
commonjs-fallback.test.js
create-and-exit.js
custom-worker.js
dir with spaces
end.test.js
error.js
esm.test.mjs
exit.js
helper.d.ts
helper.js
indexes.js
multibyte-chars.test.mjs
port.js
string-limit-2.test.js
string-limit.test.js
thread-management.test.js
to-file-on-destroy.js
to-file-on-final.js
to-file.js
to-file.mjs
transpiled.test.js
ts
ts.test.ts
uncaughtException.js
unhandledRejection.js
مشاهدة ملف: end.test.js
'use strict'
const { test } = require('tap')
const { join } = require('path')
const { readFile } = require('fs')
const { file } = require('./helper')
const ThreadStream = require('..')
test('destroy support', function (t) {
t.plan(7)
const dest = file()
const stream = new ThreadStream({
filename: join(__dirname, 'to-file-on-destroy.js'),
workerData: { dest },
sync: true
})
stream.on('close', () => {
t.notOk(stream.writable)
t.pass('close emitted')
})
t.ok(stream.write('hello world\n'))
t.ok(stream.write('something else\n'))
t.ok(stream.writable)
stream.end()
readFile(dest, 'utf8', (err, data) => {
t.error(err)
t.equal(data, 'hello world\nsomething else\n')
})
})
test('synchronous _final support', function (t) {
t.plan(7)
const dest = file()
const stream = new ThreadStream({
filename: join(__dirname, 'to-file-on-final.js'),
workerData: { dest },
sync: true
})
stream.on('close', () => {
t.notOk(stream.writable)
t.pass('close emitted')
})
t.ok(stream.write('hello world\n'))
t.ok(stream.write('something else\n'))
t.ok(stream.writable)
stream.end()
readFile(dest, 'utf8', (err, data) => {
t.error(err)
t.equal(data, 'hello world\nsomething else\n')
})
})