Skip to content

Commit

Permalink
Add a workaround for jest/swc .css issue
Browse files Browse the repository at this point in the history
  • Loading branch information
volkanceylan committed Oct 13, 2024
1 parent c328c59 commit 2ceb7bf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build/test-utils/entitydialogutils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EntityDialog } from "@serenity-is/corelib";
import { waitForAjaxRequests } from "./waitutils";

export class EntityDialogTestWrapper<TDialog extends EntityDialog<any, any>> {
export class EntityDialogWrapper<TDialog extends EntityDialog<any, any>> {
constructor(public readonly actual: TDialog) {
}

Expand Down
7 changes: 7 additions & 0 deletions build/test-utils/jest-css-workaround.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
process() {
return {
code: `module.exports = "";`,
};
}
};
11 changes: 6 additions & 5 deletions build/test-utils/jest-defaults.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { join, resolve } from "path";
import { fileURLToPath } from 'url';

const configRoot = resolve(join(fileURLToPath(new URL('.', import.meta.url)), './'));
const serenityNodeModules = resolve(join(configRoot, "../../../Serenity"));
const testUtils = resolve(join(fileURLToPath(new URL('.', import.meta.url)), './'));
const serenityNodeModules = resolve(join(testUtils, "../../../Serenity"));

export default () => ({
coveragePathIgnorePatterns: [
Expand All @@ -14,17 +14,18 @@ export default () => ({
"^@serenity-is/(.*)$": ["<rootDir>/node_modules/@serenity-is/$1", "<rootDir>/../node_modules/@serenity-is/$1", "<rootDir>/../../node_modules/@serenity-is/$1"]
},
setupFiles: [
`${configRoot}/jest-setup.js`,
`${testUtils}/jest-setup.js`,
],
setupFilesAfterEnv: [
`${configRoot}/jest-setup-afterenv.js`
`${testUtils}/jest-setup-afterenv.js`
],
testEnvironment: `${configRoot}/jsdom-global.js`,
testEnvironment: `${testUtils}/jsdom-global.js`,
testMatch: [
"<rootDir>/test/**/*.spec.ts*",
"<rootDir>/src/**/*.spec.ts*"
],
transform: {
'\\.css$': `${testUtils}/jest-css-workaround.cjs`,
"^.+\.(t|j)sx?$": [`${serenityNodeModules}/node_modules/@swc/jest`, {
jsc: {
parser: {
Expand Down

0 comments on commit 2ceb7bf

Please sign in to comment.