Skip to content

Conversation

@styfle
Copy link
Member

@styfle styfle commented Nov 9, 2025

@styfle styfle requested review from a team as code owners November 9, 2025 20:53
import value from './bytes-from-empty-FIXTURE.bin' with { type: 'bytes' };

assert(value instanceof Uint8Array);
assert(value.buffer instanceof ArrayBuffer);
Copy link
Member

Choose a reason for hiding this comment

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

there should be some kind of assertion that it's immutable (not sure what that'd look like tho)

same throughout

Copy link
Member Author

@styfle styfle Dec 22, 2025

Choose a reason for hiding this comment

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

The lines below are checking for immutable (asserts that an error is thrown on resize and also on transfer)

assert.throws(TypeError, function() {
  value.buffer.resize(0);
});

assert.throws(TypeError, function() {
  value.buffer.transfer();
});

Let me know if there is a better way to check for immutability.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

@styfle styfle Dec 26, 2025

Choose a reason for hiding this comment

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

Interesting. I don't see any existing tests for ArrayBuffer.prototype.immutable.

I was basing this new test on the existing tests here:

var ab = (new ArrayBuffer(4)).transferToImmutable();
assert.throws(TypeError, function() {
ab.transfer();
});

var ab = (new ArrayBuffer(4)).transferToImmutable();
assert.throws(TypeError, function() {
ab.resize(0);
});

Copy link
Member Author

Choose a reason for hiding this comment

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

I went ahead and added the new assertion in cafcddc

Copy link
Member

Choose a reason for hiding this comment

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

Interesting. I don't see any existing tests for ArrayBuffer.prototype.immutable.

Still in PR, alas.

@ptomato
Copy link
Contributor

ptomato commented Nov 10, 2025

Note, the empty file is failing because fixture files need to contain the string _FIXTURE and these have a dash where they should have an underscore: https://github.com/tc39/test262/blob/main/INTERPRETING.md#modules

@styfle styfle mentioned this pull request Dec 22, 2025
8 tasks
@styfle
Copy link
Member Author

styfle commented Dec 22, 2025

@ptomato Thanks! I updated the fixtures to use underscores and that solved the Test262File: missing "contents" error.

However, I ran into another error.

  File "/home/runner/work/test262/test262/tools/generation/lib/test.py", line 29, in load
    self.source = handle.read()
                  ~~~~~~~~~~~^^
  File "<frozen codecs>", line 325, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte

So I pushed some changes to the python code to ignore binary files.

I see there are still a few engines on circleci that are failing. Please let me know how to proceed, thanks!

@ptomato
Copy link
Contributor

ptomato commented Jan 20, 2026

@styfle instead of hardcoding binary extensions I think it'd be better to just skip cleaning any files with _FIXTURE in the name? Would that work for you?

The CI jobs are timing out because they are detecting hundreds of tests as different in this PR than from main. Probably if you rebase on the latest state of the main branch, that'll go away.

@styfle styfle force-pushed the styfle/proposal-import-bytes branch from cafcddc to 25407a1 Compare January 22, 2026 02:46
@styfle
Copy link
Member Author

styfle commented Jan 22, 2026

@ptomato Thanks! I rebased on main and force pushed. That seemed to fix CI ✅

I also applied your suggestion to skip files with _FIXTURE in 7d42a35.

Let me know how that looks, thanks!

@styfle styfle requested review from bakkot and ljharb January 22, 2026 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test plan for import bytes

5 participants