Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make namespace @@toStringTag "Module" non-enumerable #4378

Merged
merged 13 commits into from Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions test/function/samples/namespace-to-string-tag/_config.js
@@ -0,0 +1,8 @@
module.exports = {
description: 'namespace export should have @@toStringTag with correct property descriptors #4336',
options: {
output: {
namespaceToStringTag: true
}
}
};
1 change: 1 addition & 0 deletions test/function/samples/namespace-to-string-tag/foo.js
@@ -0,0 +1 @@
export const foo = 'bar';
11 changes: 11 additions & 0 deletions test/function/samples/namespace-to-string-tag/main.js
@@ -0,0 +1,11 @@
import * as ns from './foo.js';

const { configurable, enumerable, value, writable } = Object.getOwnPropertyDescriptor(
ns,
Symbol.toStringTag
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not explicitly check the Object.assign behaviour? Then this would also document why it is important and people do not need to Google it again.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea, I'll add that to the test.


assert.strictEqual(value, 'Module', 'value');
assert.strictEqual(configurable, false, 'configurable');
assert.strictEqual(enumerable, false, 'enumerable');
assert.strictEqual(writable, false, 'writable');