Skip to content

Commit

Permalink
Merged in r2-2620-main-develop (pull request #6507)
Browse files Browse the repository at this point in the history
R2-2620: Mere main to develop 09.18.23
  • Loading branch information
jtoliver-quoin committed Sep 18, 2023
2 parents dd13cf6 + 431d6de commit 8de06ce
Show file tree
Hide file tree
Showing 6 changed files with 1,616 additions and 867 deletions.
23 changes: 23 additions & 0 deletions .swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
// .swcrc should be treated as JSONC

"sourceMaps": true,

"jsc": {
"parser": {
"syntax": "ecmascript",
"jsx": true
},

"transform": {
"react": {
"runtime": "automatic"
}
},

"baseUrl": "./app/javascript",
"paths": {
"test-utils":[ "./test-utils/index.js"]
}
}
}
2 changes: 0 additions & 2 deletions app/javascript/test-utils/globals.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import "mutationobserver-shim";
import { MessageChannel } from "worker_threads";

import get from "lodash/get";
import { parseISO, format as formatDate } from "date-fns";
Expand Down Expand Up @@ -90,4 +89,3 @@ class Worker {
addEventListener() {}
}
global.Worker = Worker;
global.MessageChannel = MessageChannel;
13 changes: 12 additions & 1 deletion app/javascript/test-utils/setup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
import "react-16-node-hanging-test-fix"; // TODO: Remove when update to React 18
import "./globals";

import "@testing-library/jest-dom/extend-expect";
import { MessageChannel } from "worker_threads";

import { createMocks } from "react-idle-timer";
import { cleanup } from "@testing-library/react";

global.IS_REACT_ACT_ENVIRONMENT = true;

beforeAll(() => {
createMocks();
global.MessageChannel = MessageChannel;
});

afterEach(cleanup);
13 changes: 8 additions & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ module.exports = {
// restoreMocks: false,

// The root directory that Jest should scan for tests and modules within
// rootDir: undefined,
rootDir: "./app/javascript",

// A list of paths to directories that Jest should use to search for files in
// roots: [
Expand All @@ -135,7 +135,7 @@ module.exports = {
setupFiles: ["fake-indexeddb/auto"],

// A list of paths to modules that run some code to configure or set up the testing framework before each test
setupFilesAfterEnv: ["./app/javascript/test-utils/setup.js"],
setupFilesAfterEnv: ["./test-utils/setup.js"],

// The number of seconds after which a test is considered as slow and reported as such in the results.
// slowTestThreshold: 5,
Expand All @@ -153,7 +153,7 @@ module.exports = {
// testLocationInResults: false,

// The glob patterns Jest uses to detect test files
testMatch: ["<rootDir>/app/javascript/components/**/*.spec.js"],
testMatch: ["<rootDir>/components/**/*.spec.js"],

// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
// testPathIgnorePatterns: ["/node_modules/"],
Expand All @@ -168,10 +168,13 @@ module.exports = {
// testRunner: "jest-circus/runner",

// A map from regular expressions to paths to transformers
// transform: {}
transform: {
"^.+\\.(t|j)sx?$": "@swc/jest",
"^.+\\.(t|j)s?$": "@swc/jest"
},

// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
transformIgnorePatterns: ["node_modules/(?!uuid|(?!proxy-memoize)|proxy-memoize)"]
transformIgnorePatterns: []

// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
// unmockedModulePathPatterns: undefined,
Expand Down
Loading

0 comments on commit 8de06ce

Please sign in to comment.