Files
Umbraco-CMS/src/Umbraco.Web.UI.Client/web-test-runner.config.mjs

104 lines
4.3 KiB
JavaScript
Raw Normal View History

2022-05-24 16:14:15 +02:00
import { esbuildPlugin } from '@web/dev-server-esbuild';
import { playwrightLauncher } from '@web/test-runner-playwright';
2022-10-18 14:03:42 +02:00
import { importMapsPlugin } from '@web/dev-server-import-maps';
import rollupUrl from 'rollup-plugin-url';
import { fromRollup } from '@web/dev-server-rollup';
2022-05-24 16:14:15 +02:00
const url = fromRollup(rollupUrl);
/** @type {import('@web/dev-server').DevServerConfig} */
2022-05-24 16:14:15 +02:00
export default {
2022-10-18 14:03:42 +02:00
nodeResolve: true,
files: ['src/**/*.test.ts', 'libs/**/*.test.ts'],
mimeTypes: {
'./public/**/*': 'js',
},
2022-10-18 14:03:42 +02:00
plugins: [
{
name: 'resolve-umbraco-and-vite-imports',
// Rewrite Vite's root imports to the public folder
transformImport(args) {
if (args.source.match(/^\/.*?\.(png|gif|jpg|jpeg|svg)$/is)) {
return `/public${args.source}`;
}
},
},
// Serve images from the public folder as JS modules
url({ include: ['public/**/*'] }),
2022-12-20 10:49:44 +01:00
esbuildPlugin({ ts: true, target: 'auto', json: true }),
2022-10-18 14:03:42 +02:00
importMapsPlugin({
inject: {
importMap: {
imports: {
2023-01-12 12:50:37 +01:00
'src/': './src/',
2023-05-16 14:10:57 +02:00
// LIBS
Refactor libs into @umbraco-cms/backoffice/* (#608) * merge libs rollup configs to one rollup * move css from libs to src/core * run rollup on cms build * move test-utils to /utils folder * move css to src/core * mark @umbraco-cms/backoffice as external when building for CMS * rename all models to include @umbraco-cms/backoffice in their path to allow us to publish as a single module * rename all imports to @umbraco-cms/backoffice/* * rename events to umb-events to avoid rollup error of protected module name(?) * test that libs can build * move css to src/core * move umb-lit-element and modal elements to src/core * move some modal interfaces back to libs/modal * move the icon store into src/core since it is very localized to the backoffice * comment out build:libs for now since Github runs out of memory * rename to match tsconfig alias * add package.json to libs * only make libs for lib folders * turn off emit for typescript since we are handling types for libs separately * build libs locally * add script to move libs to final destination with some transform * move libs after build * move package.json to dist folder first (so we can publish from there) * remove inline comments * ensure the outputDir exists * Remove re-export of extensions-registry library from models library * move to individual files to avoid circular imports * check if outputDir exists before trying to create it * write transforms first in dist file and then copy the file to outputDir * ensure all umbraco types are external * copy information from main package.json file
2023-03-21 11:41:06 +01:00
'@umbraco-cms/backoffice/backend-api': './libs/backend-api/index.ts',
'@umbraco-cms/backoffice/context-api': './libs/context-api/index.ts',
2023-05-16 14:10:57 +02:00
'@umbraco-cms/backoffice/controller-api': './libs/controller-api/index.ts',
2023-05-16 14:16:46 +02:00
'@umbraco-cms/backoffice/element-api': './libs/element-api/index.ts',
2023-05-16 14:10:57 +02:00
'@umbraco-cms/backoffice/extension-api': './libs/extension-api/index.ts',
'@umbraco-cms/backoffice/observable-api': './libs/observable-api/index.ts',
// PACKAGES
2023-05-16 14:34:58 +02:00
'@umbraco-cms/backoffice/resources': './libs/resources/index.ts',
2023-05-16 14:10:57 +02:00
'@umbraco-cms/backoffice/content-type': './libs/content-type/index.ts',
'@umbraco-cms/backoffice/data-type': './libs/data-type/index.ts',
Refactor libs into @umbraco-cms/backoffice/* (#608) * merge libs rollup configs to one rollup * move css from libs to src/core * run rollup on cms build * move test-utils to /utils folder * move css to src/core * mark @umbraco-cms/backoffice as external when building for CMS * rename all models to include @umbraco-cms/backoffice in their path to allow us to publish as a single module * rename all imports to @umbraco-cms/backoffice/* * rename events to umb-events to avoid rollup error of protected module name(?) * test that libs can build * move css to src/core * move umb-lit-element and modal elements to src/core * move some modal interfaces back to libs/modal * move the icon store into src/core since it is very localized to the backoffice * comment out build:libs for now since Github runs out of memory * rename to match tsconfig alias * add package.json to libs * only make libs for lib folders * turn off emit for typescript since we are handling types for libs separately * build libs locally * add script to move libs to final destination with some transform * move libs after build * move package.json to dist folder first (so we can publish from there) * remove inline comments * ensure the outputDir exists * Remove re-export of extensions-registry library from models library * move to individual files to avoid circular imports * check if outputDir exists before trying to create it * write transforms first in dist file and then copy the file to outputDir * ensure all umbraco types are external * copy information from main package.json file
2023-03-21 11:41:06 +01:00
'@umbraco-cms/backoffice/entity-action': './libs/entity-action/index.ts',
'@umbraco-cms/backoffice/events': './libs/umb-events/index.ts',
2023-05-16 13:36:51 +02:00
'@umbraco-cms/backoffice/extension-registry': './libs/extension-registry/index.ts',
Refactor libs into @umbraco-cms/backoffice/* (#608) * merge libs rollup configs to one rollup * move css from libs to src/core * run rollup on cms build * move test-utils to /utils folder * move css to src/core * mark @umbraco-cms/backoffice as external when building for CMS * rename all models to include @umbraco-cms/backoffice in their path to allow us to publish as a single module * rename all imports to @umbraco-cms/backoffice/* * rename events to umb-events to avoid rollup error of protected module name(?) * test that libs can build * move css to src/core * move umb-lit-element and modal elements to src/core * move some modal interfaces back to libs/modal * move the icon store into src/core since it is very localized to the backoffice * comment out build:libs for now since Github runs out of memory * rename to match tsconfig alias * add package.json to libs * only make libs for lib folders * turn off emit for typescript since we are handling types for libs separately * build libs locally * add script to move libs to final destination with some transform * move libs after build * move package.json to dist folder first (so we can publish from there) * remove inline comments * ensure the outputDir exists * Remove re-export of extensions-registry library from models library * move to individual files to avoid circular imports * check if outputDir exists before trying to create it * write transforms first in dist file and then copy the file to outputDir * ensure all umbraco types are external * copy information from main package.json file
2023-03-21 11:41:06 +01:00
'@umbraco-cms/backoffice/modal': './libs/modal/index.ts',
'@umbraco-cms/backoffice/models': './libs/models/index.ts',
'@umbraco-cms/backoffice/notification': './libs/notification/index.ts',
'@umbraco-cms/backoffice/property-editor': './libs/property-editor/index.ts',
'@umbraco-cms/backoffice/repository': './libs/repository/index.ts',
2023-05-23 10:02:09 +02:00
'@umbraco-cms/backoffice/router': './libs/router/index.ts',
'@umbraco-cms/backoffice/sorter': './libs/sorter/index.ts',
Refactor libs into @umbraco-cms/backoffice/* (#608) * merge libs rollup configs to one rollup * move css from libs to src/core * run rollup on cms build * move test-utils to /utils folder * move css to src/core * mark @umbraco-cms/backoffice as external when building for CMS * rename all models to include @umbraco-cms/backoffice in their path to allow us to publish as a single module * rename all imports to @umbraco-cms/backoffice/* * rename events to umb-events to avoid rollup error of protected module name(?) * test that libs can build * move css to src/core * move umb-lit-element and modal elements to src/core * move some modal interfaces back to libs/modal * move the icon store into src/core since it is very localized to the backoffice * comment out build:libs for now since Github runs out of memory * rename to match tsconfig alias * add package.json to libs * only make libs for lib folders * turn off emit for typescript since we are handling types for libs separately * build libs locally * add script to move libs to final destination with some transform * move libs after build * move package.json to dist folder first (so we can publish from there) * remove inline comments * ensure the outputDir exists * Remove re-export of extensions-registry library from models library * move to individual files to avoid circular imports * check if outputDir exists before trying to create it * write transforms first in dist file and then copy the file to outputDir * ensure all umbraco types are external * copy information from main package.json file
2023-03-21 11:41:06 +01:00
'@umbraco-cms/backoffice/store': './libs/store/index.ts',
'@umbraco-cms/backoffice/utils': './libs/utils/index.ts',
'@umbraco-cms/backoffice/workspace': './libs/workspace/index.ts',
2023-04-20 13:44:45 +02:00
'@umbraco-cms/backoffice/picker-input': './libs/picker-input/index.ts',
2023-04-27 21:13:46 +02:00
'@umbraco-cms/backoffice/id': './libs/id/index.ts',
2023-04-27 22:04:14 +02:00
'@umbraco-cms/backoffice/collection': './libs/collection/index.ts',
'@umbraco-cms/backoffice/tree': './libs/tree/index.ts',
'@umbraco-cms/backoffice/section': './libs/section/index.ts',
'@umbraco-cms/backoffice/variant': './libs/variant/index.ts',
2023-05-17 18:04:27 +02:00
'@umbraco-cms/backoffice/components': './src/packages/core/components/index.ts',
2023-05-16 21:31:16 +02:00
'@umbraco-cms/backoffice/user-group': './src/packages/users/user-groups/index.ts',
2023-05-16 14:10:57 +02:00
// SHARED
2023-05-16 22:11:11 +02:00
'@umbraco-cms/internal/lit-element': './src/shared/lit-element/index.ts',
'@umbraco-cms/internal/modal': './src/shared/modal/index.ts',
2023-04-12 17:05:14 +02:00
'@umbraco-cms/internal/test-utils': './utils/test-utils.ts',
2022-10-18 14:03:42 +02:00
},
},
},
}),
],
browsers: [playwrightLauncher({ product: 'firefox' }), playwrightLauncher({ product: 'webkit' })],
coverageConfig: {
reporters: ['lcovonly', 'text-summary'],
},
2022-10-18 14:03:42 +02:00
testRunnerHtml: (testFramework) =>
`<html>
2022-08-10 12:03:01 +02:00
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/svg+xml" href="public/favicon.svg" />
<title>Umbraco</title>
<base href="/" />
<script src="/node_modules/msw/lib/iife/index.js"></script>
<link rel="stylesheet" href="node_modules/@umbraco-ui/uui-css/dist/uui-css.css">
2023-05-16 22:31:05 +02:00
<link rel="stylesheet" href="src/shared/css/custom-properties.css">
2022-08-10 12:03:01 +02:00
</head>
2022-05-24 16:14:15 +02:00
<body>
<script type="module" src="${testFramework}"></script>
<script type="module">
import 'element-internals-polyfill';
import '@umbraco-ui/uui';
2022-05-25 13:11:54 +02:00
</script>
2022-05-24 16:14:15 +02:00
</body>
</html>`,
};