All files / lib/internal/test transfer.js

100% Statements 42/42
83.33% Branches 5/6
100% Functions 2/2
100% Lines 42/42

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 432x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 1x 1x 1x 1x 1x 2x 2x 1x 1x 2x 2x 2x  
'use strict';
 
const {
  makeTransferable,
  kClone,
  kDeserialize,
} = require('internal/worker/js_transferable');
 
process.emitWarning(
  'These APIs are for internal testing only. Do not use them.',
  'internal/test/transfer');
 
// Used as part of parallel/test-messaging-maketransferable.
// This has to exist within the lib/internal/ path in order
// for deserialization to work.
 
class E {
  constructor(b) {
    this.b = b;
  }
}
 
class F extends E {
  constructor(b) {
    super(b);
    /* eslint-disable-next-line no-constructor-return */
    return makeTransferable(this);
  }
 
  [kClone]() {
    return {
      data: { b: this.b },
      deserializeInfo: 'internal/test/transfer:F'
    };
  }
 
  [kDeserialize]({ b }) {
    this.b = b;
  }
}
 
module.exports = { E, F };