-
-
Notifications
You must be signed in to change notification settings - Fork 485
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(transformer/class-properties): exec test for
this
in computed key
- Loading branch information
1 parent
04c1b3a
commit 638cd96
Showing
2 changed files
with
31 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
commit: 54a8389f | ||
|
||
node: v22.11.0 | ||
filter: fixtures/oxc | ||
include: **/*.{test,spec}.?(c|m)[jt]s?(x) | ||
exclude: **/node_modules/**, **/dist/**, **/cypress/**, **/.{idea,git,cache,output,temp}/**, **/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*, "" | ||
|
||
No test files found, exiting with code 1 | ||
RUN v2.1.2 /Users/jim/Programming/crates/oxc/tasks/transform_conformance | ||
|
||
✓ fixtures/oxc/babel-plugin-transform-class-properties-test-fixtures-this-in-computed-key-exec.test.js (1 test) 2ms | ||
|
||
Test Files 1 passed (1) | ||
Tests 1 passed (1) | ||
Start at 20:11:31 | ||
Duration 188ms (transform 13ms, setup 0ms, collect 7ms, tests 2ms, environment 0ms, prepare 37ms) | ||
|
22 changes: 22 additions & 0 deletions
22
.../tests/babel-plugin-transform-class-properties/test/fixtures/this-in-computed-key/exec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
function createClassDeclaration() { | ||
class C { | ||
[this] = 1; | ||
[this + 'bar'] = 2; | ||
} | ||
return C; | ||
} | ||
|
||
function createClassExpression() { | ||
return class { | ||
[this] = 3; | ||
[this + 'bar'] = 4; | ||
}; | ||
} | ||
|
||
const C = createClassDeclaration.call("foo"); | ||
expect(new C().foo).toBe(1); | ||
expect(new C().foobar).toBe(2); | ||
|
||
const D = createClassExpression.call("foo"); | ||
expect(new D().foo).toBe(3); | ||
expect(new D().foobar).toBe(4); |