Skip to content
Merged
Changes from all 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
26 changes: 14 additions & 12 deletions apps/widget-e2e/src/plugins/index.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************

// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)

const { preprocessTypescript } = require("@nrwl/cypress/plugins/preprocessor");

// Custom webpack config to ignore CSS files that some dependencies require
// (CSS is not needed for e2e tests) and disable caching for Node 20 compatibility
const customizeWebpackConfig = (webpackConfig) => {
webpackConfig.module.rules.push({
loader: "null-loader",
test: /\.css$/
});
// Disable webpack caching to ensure fresh transpilation
webpackConfig.cache = false;
return webpackConfig;
};

module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config

// Preprocess Typescript file using Nx helper
on("file:preprocessor", preprocessTypescript(config));
// Preprocess Typescript file using Nx helper with custom webpack config
on("file:preprocessor", preprocessTypescript(config, customizeWebpackConfig));
on("task", {
log(message) {
console.log(message);
Expand Down
Loading