From 9137f80738c1e787988b59bbb246cf9cac961f9b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pawe=C5=82=20Smyrek?=
Date: Mon, 23 Sep 2024 13:26:08 +0200
Subject: [PATCH] Aligned scripts to `webpack.config.mjs`.
---
scripts/test.js | 9 ++++++---
scripts/utils/getkarmaconfig.js | 4 ++--
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/scripts/test.js b/scripts/test.js
index 141c68c..8ae7840 100644
--- a/scripts/test.js
+++ b/scripts/test.js
@@ -10,7 +10,10 @@
const getKarmaConfig = require( './utils/getkarmaconfig' );
const { Server, config } = require( 'karma' );
-const parsedConfig = config.parseConfig( null, getKarmaConfig() );
-const server = new Server( parsedConfig );
+( async () => {
+ const parsedConfig = config.parseConfig( null, await getKarmaConfig() );
+ const server = new Server( parsedConfig );
+
+ server.start();
+} )();
-server.start();
diff --git a/scripts/utils/getkarmaconfig.js b/scripts/utils/getkarmaconfig.js
index d03f14e..d212fc5 100644
--- a/scripts/utils/getkarmaconfig.js
+++ b/scripts/utils/getkarmaconfig.js
@@ -10,11 +10,11 @@
const path = require( 'path' );
const options = parseArguments( process.argv.slice( 2 ) );
-module.exports = function getKarmaConfig() {
+module.exports = async function getKarmaConfig() {
const basePath = process.cwd();
const coverageDir = path.join( basePath, 'coverage' );
- const webpackConfig = require( '../../webpack.config.js' )( {}, {
+ const webpackConfig = ( await import( '../../webpack.config.mjs' ) ).default( {}, {
mode: 'development'
} );