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

fix:static class blocks are not enabled babel error #8267

Merged
merged 8 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
345 changes: 173 additions & 172 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-import-meta": "^7.10.4",
"@babel/plugin-transform-async-to-generator": "^7.22.5",
"@babel/plugin-transform-class-static-block": "^7.24.7",
"@babel/plugin-transform-exponentiation-operator": "^7.22.5",
"@babel/plugin-transform-for-of": "^7.22.15",
"@babel/plugin-transform-runtime": "7.23.3",
Expand Down Expand Up @@ -165,6 +166,7 @@
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-inject": "^4.0.2",
"@rollup/plugin-node-resolve": "^7.1.1",
"@testcafe/publish-please": "^5.6.0",
"@types/callsite": "^1.0.30",
"@types/chai": "^3.5.2",
"@types/debug": "^4.1.5",
Expand Down Expand Up @@ -221,7 +223,6 @@
"multer": "1.4.4-lts.1",
"openssl-self-signed-certificate": "^1.1.6",
"proxyquire": "^2.1.0",
"@testcafe/publish-please": "^5.6.0",
"react": "^16.13.1",
"recursive-copy": "^2.0.5",
"rollup": "2.16.1",
Expand Down
1 change: 1 addition & 0 deletions src/compiler/babel/load-libs.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,6 @@ export default function loadLibs ({ esm } = {}) {
presetReact: getPresetReact(),
proposalPrivateMethods: [require('@babel/plugin-proposal-private-methods'), { loose: true }],
proposalClassProperties: [require('@babel/plugin-proposal-class-properties'), { loose: true }],
transformClassStaticBlock: require('@babel/plugin-transform-class-static-block'),
};
}
3 changes: 2 additions & 1 deletion src/compiler/test-file/formats/es-next/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ export default class ESNextTestFileCompiler extends APIBasedTestFileCompilerBase
moduleResolver,
proposalPrivateMethods,
proposalClassProperties,
transformClassStaticBlock,
} = loadBabelLibs({ esm });

const opts = Object.assign({}, BASE_BABEL_OPTIONS, {
presets: [presetStage2, presetEnvForTestCode, presetReact],
plugins: [transformRuntime, moduleResolver, proposalPrivateMethods, proposalClassProperties],
plugins: [transformRuntime, moduleResolver, proposalPrivateMethods, proposalClassProperties, transformClassStaticBlock],
sourceMaps: 'inline',
filename,
});
Expand Down
5 changes: 5 additions & 0 deletions test/functional/fixtures/regression/gh-8245/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('[Regression](GH-8245)', function () {
it('Should run test with static class blocks', function () {
return runTests('testcafe-fixtures/index.js');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import ClassThatUsesStatic from './lib.js';

fixture('GH-8245 - Should run test with static class blocks');

test('Click on a split link', async () => {
ClassThatUsesStatic.foo;
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class ClassThatUsesStatic {
static { this.foo = true; }
}

export default ClassThatUsesStatic;
Loading