Skip to content

Commit

Permalink
Don't support MessageChannel
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Dec 19, 2023
1 parent 4f040bd commit 0fcbc99
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -100,6 +100,7 @@ There are a few rare cases where native type cannot be correctly determined:
* `typeOf( Object.setPrototypeOf( Promise.resolve(), Array.prototype ) ) === 'Object'` ([issue](https://github.com/overlookmotel/native-type-of/issues/1))
* `typeOf( Object.setPrototypeOf( new Error(), Map.prototype ) ) === 'Object'` ([issue](https://github.com/overlookmotel/native-type-of/issues/2))
* `typeOf( Object.setPrototypeOf( {}, TypeError.prototype ) ) === 'TypeError'` ([issue](https://github.com/overlookmotel/native-type-of/issues/3))
* `typeOf( new MessageChannel() ) === 'Object'` ([issue](https://github.com/overlookmotel/native-type-of/issues/59))
These are the only known cases where the result is inaccurate.
Expand Down
6 changes: 5 additions & 1 deletion test/index.test.js
Expand Up @@ -25,6 +25,10 @@ for (const name of Object.getOwnPropertyNames(global)) {

globals.sort(([name1], [name2]) => (name1 > name2 ? 1 : -1));

// Detecting `MessageChannel`s is not supported
// https://github.com/overlookmotel/native-type-of/issues/59
const testGlobals = globals.filter(([name]) => name !== 'MessageChannel');

const initArgs = {
Promise: [() => {}],
DataView: [new ArrayBuffer(8)],
Expand Down Expand Up @@ -57,7 +61,7 @@ describe('Primitives', () => {
});

describe('Objects', () => {
describe.each(globals)('%s', (type) => {
describe.each(testGlobals)('%s', (type) => {
it('correctly identified', () => {
const instance = createInstance(type);
expect(typeOf(instance)).toBe(type);
Expand Down

0 comments on commit 0fcbc99

Please sign in to comment.