Invalid explicit resource management tests in `staging`

Open
#4,498 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
58/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Stale
Tech stack
javascript
Domain
testing-qa

Research direction

The reported cases are in test/staging/explicit-resource-management/await-using-in-switch-case-block.js and call-dispose-methods.js. Review the failing switch-case declarations, remove the invalid test cases identified in the issue, then rerun the relevant Babel/Test262 results to confirm these parser errors are no longer reported.

Written by the indexing model from the issue text.

Description

From Babel's test results:

not ok 44949 test/staging/explicit-resource-management/await-using-in-switch-case-block.js default # (expected success, got parser error)
  ---
  name: SyntaxError
  message: >-
    unknown: Using declaration cannot appear in the top level when source type is
    `script` or in the bare case statement. (358:6)

      356 |   switch (label) {
      357 |     case 1:
    > 358 |       await using x = {
          |       ^
      359 |         value: 1,
      360 |         [Symbol.asyncDispose]() {
      361 |           caseBlockValues.push(42);
  ...
not ok 44951 test/staging/explicit-resource-management/await-using-in-switch-case-block.js strict mode # (expected success, got parser error)
  ---
  name: SyntaxError
  message: >-
    unknown: Using declaration cannot appear in the top level when source type is
    `script` or in the bare case statement. (359:6)

      357 |   switch (label) {
      358 |     case 1:
    > 359 |       await using x = {
          |       ^
      360 |         value: 1,
      361 |         [Symbol.asyncDispose]() {
      362 |           caseBlockValues.push(42);
  ...
not ok 44975 test/staging/explicit-resource-management/call-dispose-methods.js default # (expected success, got parser error)
  ---
  name: SyntaxError
  message: >-
    unknown: Using declaration cannot appear in the top level when source type is
    `script` or in the bare case statement. (244:6)

      242 |   switch (label) {
      243 |     case 1:
    > 244 |       using x = {
          |       ^
      245 |         value: 1,
      246 |         [Symbol.dispose]() {
      247 |           caseBlockValues.push(42);
  ...
not ok 44976 test/staging/explicit-resource-management/call-dispose-methods.js strict mode # (expected success, got parser error)
  ---
  name: SyntaxError
  message: >-
    unknown: Using declaration cannot appear in the top level when source type is
    `script` or in the bare case statement. (245:6)

      243 |   switch (label) {
      244 |     case 1:
    > 245 |       using x = {
          |       ^
      246 |         value: 1,
      247 |         [Symbol.dispose]() {
      248 |           caseBlockValues.push(42);
  ...

These test cases are invalid since last plenary, and they should be removed eventually.

Dominant language
JavaScript
Stars
2.9k
Forks
571
Avg merge
1d 22h
Merged PRs (30d)
13

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tc39/test262

All issues in tc39/test262

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.