-
Notifications
You must be signed in to change notification settings - Fork 468
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
Add tests for import attributes #3843
Conversation
flags: [module] | ||
---*/ | ||
|
||
import x from './import-assertion-1_FIXTURE.js' with {test262:'',}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the new proposal, unknown import attributes should throw rather than being ignored. Should we require runner to define a no-op test262
attribute that we can use for testing purposes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how the runner would add a new attribute -- the set of expected attributes isn't user-extensible is my understanding.
For this test case, it seems like type: 'js'
would be sufficient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how the runner would add a new attribute -- the set of expected attributes isn't user-extensible is my understanding.
It's defined at the embedder level.
For this test case, it seems like type: 'js' would be sufficient?
In this specific case it would, however:
- the
type
attribute is not defined in ECMA-262. It's defined by the JSON modules proposal, but only withtype: "json"
- we need multiple attributes for some tests, for example for testing the order properties in dynamic import are accessed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So hosts will have to implement 'test262-only' attributes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems like it'd be prohibitive for runners that aren't a JS engine's shell...
Nevermind -- I see this is still keeping the old tag :) |
// Define a property on the global "this" value so that the effect of the | ||
// expected IdentifierReference can be observed. | ||
Object.defineProperty(globalThis, 'assert', { | ||
get: function() { | ||
callCount += 1; | ||
} | ||
}); | ||
|
||
import x from './import-assertion-1_FIXTURE.js' | ||
with | ||
{test262:''}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test currently is sort of splinched; should define with
and ensure callCount ===
0 right?
|
||
var thrown = new Test262Error(); | ||
var options = { | ||
get assert() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/assert/with/
|
||
test262 | ||
|
||
:with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This with
doesn't seem to belong here.
'' | ||
|
||
}; | ||
import './import-assertion-2_FIXTURE.js' assert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/assert//
'' | ||
|
||
}; | ||
export * from './import-assertion-3_FIXTURE.js' assert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/assert/with/ right?
2372a51
to
de99e4c
Compare
I don't think this was supposed to be auto-closed by #3921! |
Yes it was :) This PR was split in separate PRs to make it easier to review. |
https://github.com/tc39/proposal-import-attributes
The proposal supersedes import assertions, and is at stage 3 conditional on ecma-262 editors reviewing its spec.
Closes #3829
TODO (Maybe in a separate PR, to keep this one only about renaming and copying tests):