Skip to content

Commit 7ec1e1e

Browse files
author
ydaniju
committed
setup test environment with changes to babel
1 parent 22d3990 commit 7ec1e1e

File tree

6 files changed

+33
-31
lines changed

6 files changed

+33
-31
lines changed

babel.config.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1-
module.exports = (api) => {
2-
api.cache(true);
3-
return { presets: [["@babel/preset-react"], ["@babel/preset-env"]] };
1+
module.exports = function (api) {
2+
const presets = ["@babel/preset-react", "@babel/preset-env"];
3+
const plugins = [
4+
"transform-class-properties",
5+
"syntax-dynamic-import",
6+
"@babel/plugin-proposal-object-rest-spread",
7+
"istanbul",
8+
];
9+
10+
// Cache the Babel configuration based on the environment
11+
api.cache.using(() => process.env.NODE_ENV);
12+
13+
return {
14+
presets,
15+
plugins,
16+
};
417
};

jest-puppeteer.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// jest-puppeteer.config.cjs
2+
3+
/** @type {import('jest-environment-puppeteer').JestPuppeteerConfig} */
4+
module.exports = {
5+
launch: {
6+
headless: "new",
7+
product: "chrome",
8+
},
9+
browserContext: "default",
10+
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"devDependencies": {
33
"@babel/core": "^7.20.7",
44
"@babel/eslint-parser": "^7.19.1",
5+
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
56
"@babel/preset-react": "^7.18.6",
67
"@symfony/webpack-encore": "^0.30.2",
78
"@testing-library/jest-dom": "5.11.6",
@@ -11,7 +12,6 @@
1112
"babel-plugin-istanbul": "^5.0.1",
1213
"babel-plugin-syntax-dynamic-import": "^6.18.0",
1314
"babel-plugin-transform-class-properties": "^6.24.1",
14-
"babel-plugin-transform-object-rest-spread": "^6.26.0",
1515
"babel-polyfill": "^6.26.0",
1616
"babel-preset-env": "^1.7.0",
1717
"babel-preset-react": "^6.24.1",

templates/ioda.html.twig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
<img width="180" src="/apple-touch-icon.png" alt="IODA logo" />
4848
</div>
4949
</div>
50+
<script src="{{ asset('build/runtime.js') }}"></script>
5051
<script>
5152
const div = document.querySelector('.contentLoading');
5253
/* documentMode is an IE-only property */

webpack.config.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Encore
4848

4949
// enables React support
5050
.enableReactPreset()
51+
.enableSingleRuntimeChunk()
5152

5253
// enables Sass/SCSS support
5354
//.enableSassLoader()
@@ -58,12 +59,7 @@ Encore
5859
// uncomment if you're having problems with a jQuery plugin
5960
//.autoProvidejQuery()
6061

61-
.configureBabel(function (babelConfig) {
62-
babelConfig.plugins.push('transform-class-properties');
63-
babelConfig.plugins.push('syntax-dynamic-import');
64-
babelConfig.plugins.push('transform-object-rest-spread');
65-
babelConfig.plugins.push('istanbul');
66-
})
62+
.configureBabel()
6763
;
6864

6965
let webpackConfig = Encore.getWebpackConfig();

yarn.lock

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@
618618
"@babel/helper-plugin-utils" "^7.18.6"
619619
"@babel/plugin-syntax-numeric-separator" "^7.10.4"
620620

621-
"@babel/plugin-proposal-object-rest-spread@^7.20.2":
621+
"@babel/plugin-proposal-object-rest-spread@^7.0.0", "@babel/plugin-proposal-object-rest-spread@^7.20.2":
622622
version "7.20.7"
623623
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.20.7.tgz#aa662940ef425779c75534a5c41e9d936edc390a"
624624
integrity sha512-d2S98yCiLxDVmBmE8UjGcfPvNEUbA1U5q5WxaWFUGRzJSVAZqm5W6MbPct0jxnegUZ0niLeNX+IOzEs7wYg9Dg==
@@ -3354,11 +3354,6 @@ babel-plugin-syntax-jsx@^6.3.13, babel-plugin-syntax-jsx@^6.8.0:
33543354
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946"
33553355
integrity sha512-qrPaCSo9c8RHNRHIotaufGbuOBN8rtdC4QrrFFc43vyWCCz7Kl7GL1PGaXtMGQZUXrkCjNEgxDfmAuAabr/rlw==
33563356

3357-
babel-plugin-syntax-object-rest-spread@^6.8.0:
3358-
version "6.13.0"
3359-
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5"
3360-
integrity sha512-C4Aq+GaAj83pRQ0EFgTvw5YO6T3Qz2KGrNRwIj9mSoNHVvdZY4KO2uA6HNtNXCw993iSZnckY1aLW8nOi8i4+w==
3361-
33623357
babel-plugin-syntax-trailing-function-commas@^6.22.0:
33633358
version "6.22.0"
33643359
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz#ba0360937f8d06e40180a43fe0d5616fff532cf3"
@@ -3590,14 +3585,6 @@ babel-plugin-transform-flow-strip-types@^6.22.0:
35903585
babel-plugin-syntax-flow "^6.18.0"
35913586
babel-runtime "^6.22.0"
35923587

3593-
babel-plugin-transform-object-rest-spread@^6.26.0:
3594-
version "6.26.0"
3595-
resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz#0f36692d50fef6b7e2d4b3ac1478137a963b7b06"
3596-
integrity sha512-ocgA9VJvyxwt+qJB0ncxV8kb/CjfTcECUY4tQ5VT7nP6Aohzobm8CDFaQ5FHdvZQzLmf0sgDxB8iRXZXxwZcyA==
3597-
dependencies:
3598-
babel-plugin-syntax-object-rest-spread "^6.8.0"
3599-
babel-runtime "^6.26.0"
3600-
36013588
babel-plugin-transform-react-display-name@^6.23.0:
36023589
version "6.25.0"
36033590
resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-display-name/-/babel-plugin-transform-react-display-name-6.25.0.tgz#67e2bf1f1e9c93ab08db96792e05392bf2cc28d1"
@@ -4406,14 +4393,9 @@ caniuse-api@^3.0.0:
44064393
lodash.memoize "^4.1.2"
44074394
lodash.uniq "^4.5.0"
44084395

4409-
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000844, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001400:
4410-
version "1.0.30001449"
4411-
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001449.tgz#a8d11f6a814c75c9ce9d851dc53eb1d1dfbcd657"
4412-
integrity sha512-CPB+UL9XMT/Av+pJxCKGhdx+yg1hzplvFJQlJ2n68PyQGMz9L/E2zCyLdOL8uasbouTUgnPl+y0tccI/se+BEw==
4413-
4414-
caniuse-lite@^1.0.30001587:
4396+
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000844, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001400, caniuse-lite@^1.0.30001587:
44154397
version "1.0.30001589"
4416-
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001589.tgz#7ad6dba4c9bf6561aec8291976402339dc157dfb"
4398+
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001589.tgz"
44174399
integrity sha512-vNQWS6kI+q6sBlHbh71IIeC+sRwK2N3EDySc/updIGhIee2x5z00J4c1242/5/d6EpEMdOnk/m+6tuk4/tcsqg==
44184400

44194401
canvas@^2.8.0:

0 commit comments

Comments
 (0)