Skip to content

Commit

Permalink
Update web deps (#4451)
Browse files Browse the repository at this point in the history
Signed-off-by: khanhtc1202 <[email protected]>
  • Loading branch information
khanhtc1202 authored Jun 28, 2023
1 parent 3a15a3c commit 7cc4733
Show file tree
Hide file tree
Showing 8 changed files with 1,085 additions and 1,241 deletions.
2 changes: 1 addition & 1 deletion web/custom-jsdom.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const Environment = require("jest-environment-jsdom");

module.exports = class CustomTestEnvironment extends Environment {
module.exports = class CustomTestEnvironment extends Environment.default {
async setup() {
await super.setup();
if (typeof this.global.TextEncoder === "undefined") {
Expand Down
4 changes: 3 additions & 1 deletion web/file-transformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ const path = require("path");

module.exports = {
process(src, filename, config, options) {
return "module.exports = " + JSON.stringify(path.basename(filename)) + ";";
return {
code: `module.exports = ${JSON.stringify(path.basename(filename))};`,
};
},
};
12 changes: 6 additions & 6 deletions web/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
module.exports = {
roots: ["<rootDir>/src"],
transform: {
"^.+\\.tsx?$": "ts-jest",
"^.+\\.tsx?$": [
"ts-jest",
{
isolatedModules: true,
},
],
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|ico)$":
"<rootDir>/file-transformer.js",
},
Expand All @@ -23,9 +28,4 @@ module.exports = {
setupFilesAfterEnv: ["./jest.after-env.ts"],
coverageReporters: ["lcovonly", "text-summary"],
maxWorkers: 1,
globals: {
"ts-jest": {
isolatedModules: true,
},
},
};
19 changes: 7 additions & 12 deletions web/jest.config.local.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
module.exports = {
roots: ["<rootDir>/src"],
transform: {
"^.+\\.tsx?$": "ts-jest",
"^.+\\.tsx?$": [
"ts-jest",
{
isolatedModules: true,
},
],
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|ico)$":
"<rootDir>/file-transformer.js",
},
Expand All @@ -11,22 +16,12 @@ module.exports = {
"^~~/(.*)$": "<rootDir>/$1",
},
moduleDirectories: ["<rootDir>/node_modules", "__fixtures__"],
coveragePathIgnorePatterns: [
"/node_modules/",
".test.ts",
".stories.ts",
".d.ts",
],
coveragePathIgnorePatterns: ["/node_modules/", ".test.ts", ".d.ts"],
testEnvironment: "./custom-jsdom",
clearMocks: true,
setupFiles: ["./jest.setup.js"],
setupFilesAfterEnv: ["./jest.after-env.ts"],
coverageReporters: ["lcovonly", "text-summary", "html"],
maxWorkers: 4,
globals: {
"ts-jest": {
isolatedModules: true,
},
},
testTimeout: 10000,
};
7 changes: 3 additions & 4 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"typecheck": "tsc --noEmit"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/runtime": "^7.20.6",
"@testing-library/dom": "^8.0.0",
"@testing-library/jest-dom": "^5.14.1",
Expand Down Expand Up @@ -44,15 +43,15 @@
"faker": "^5.3.1",
"fork-ts-checker-webpack-plugin": "^6.2.10",
"html-webpack-plugin": "^5.5.0",
"jest": "^27.4.7",
"jest-environment-jsdom": "^27.4.6",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"msw": "^0.21.2",
"prettier": "^2.0.5",
"pretty-format": "^27.0.2",
"process": "^0.11.10",
"react-test-renderer": "^17.0.2",
"redux-mock-store": "^1.5.4",
"ts-jest": "^27.1.3",
"ts-jest": "^29.1.0",
"ts-loader": "^9.1.0",
"typescript": "^4.3.2",
"webpack": "^5.76.0",
Expand Down
2 changes: 1 addition & 1 deletion web/src/api/me.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ afterAll(() => {

test("getMe() call", async () => {
await expect(getMe()).resolves.toMatchInlineSnapshot(`
Object {
{
"avatarUrl": "avatar-url",
"projectId": "pipecd",
"subject": "userName",
Expand Down
84 changes: 42 additions & 42 deletions web/src/utils/__snapshots__/parse-log.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`multi lines contained in a single log block 1`] = `
Array [
Object {
[
{
"bg": 0,
"bold": false,
"content": "\\\\n",
"content": "\\n",
"fg": 7,
"underline": false,
},
Object {
{
"bg": 0,
"bold": true,
"content": " BOLD ",
"fg": 7,
"underline": false,
},
Object {
{
"bg": 0,
"bold": false,
"content": " Underline \\\\n",
"content": " Underline \\n",
"fg": 7,
"underline": true,
},
Object {
{
"bg": 7,
"bold": false,
"content": " Reversed ",
Expand All @@ -34,29 +34,29 @@ Array [
`;

exports[`parse bright colors 1`] = `
Array [
Object {
[
{
"bg": 0,
"bold": false,
"content": " A ",
"fg": 8,
"underline": false,
},
Object {
{
"bg": 0,
"bold": false,
"content": " B ",
"fg": 9,
"underline": false,
},
Object {
{
"bg": 0,
"bold": false,
"content": " C ",
"fg": 10,
"underline": false,
},
Object {
{
"bg": 0,
"bold": false,
"content": " D ",
Expand All @@ -67,29 +67,29 @@ Array [
`;

exports[`parse string that includes bg colors 1`] = `
Array [
Object {
[
{
"bg": 0,
"bold": false,
"content": " A ",
"fg": 7,
"underline": false,
},
Object {
{
"bg": 1,
"bold": false,
"content": " B ",
"fg": 7,
"underline": false,
},
Object {
{
"bg": 2,
"bold": false,
"content": " C ",
"fg": 7,
"underline": false,
},
Object {
{
"bg": 3,
"bold": false,
"content": " D ",
Expand All @@ -100,29 +100,29 @@ Array [
`;

exports[`parse string that includes bg colors 2`] = `
Array [
Object {
[
{
"bg": 4,
"bold": false,
"content": " A ",
"fg": 7,
"underline": false,
},
Object {
{
"bg": 5,
"bold": false,
"content": " B ",
"fg": 7,
"underline": false,
},
Object {
{
"bg": 6,
"bold": false,
"content": " C ",
"fg": 7,
"underline": false,
},
Object {
{
"bg": 7,
"bold": false,
"content": " D ",
Expand All @@ -133,29 +133,29 @@ Array [
`;

exports[`parse string that includes fg colors 1`] = `
Array [
Object {
[
{
"bg": 0,
"bold": false,
"content": " A ",
"fg": 0,
"underline": false,
},
Object {
{
"bg": 0,
"bold": false,
"content": " B ",
"fg": 1,
"underline": false,
},
Object {
{
"bg": 0,
"bold": false,
"content": " C ",
"fg": 2,
"underline": false,
},
Object {
{
"bg": 0,
"bold": false,
"content": " D ",
Expand All @@ -166,29 +166,29 @@ Array [
`;

exports[`parse string that includes fg colors 2`] = `
Array [
Object {
[
{
"bg": 0,
"bold": false,
"content": " E ",
"fg": 4,
"underline": false,
},
Object {
{
"bg": 0,
"bold": false,
"content": " F ",
"fg": 5,
"underline": false,
},
Object {
{
"bg": 0,
"bold": false,
"content": " G ",
"fg": 6,
"underline": false,
},
Object {
{
"bg": 0,
"bold": false,
"content": " H ",
Expand All @@ -199,22 +199,22 @@ Array [
`;

exports[`parse string that includes modifier 1`] = `
Array [
Object {
[
{
"bg": 0,
"bold": true,
"content": " BOLD ",
"fg": 7,
"underline": false,
},
Object {
{
"bg": 0,
"bold": false,
"content": " Underline ",
"fg": 7,
"underline": true,
},
Object {
{
"bg": 7,
"bold": false,
"content": " Reversed ",
Expand All @@ -225,8 +225,8 @@ Array [
`;

exports[`parse string that includes modifier 2`] = `
Array [
Object {
[
{
"bg": 7,
"bold": true,
"content": " BOLD Underline Reversed ",
Expand All @@ -237,8 +237,8 @@ Array [
`;

exports[`parse string that includes modifier 3`] = `
Array [
Object {
[
{
"bg": 0,
"bold": true,
"content": " Red Bold ",
Expand All @@ -249,8 +249,8 @@ Array [
`;

exports[`parse string that includes modifier 4`] = `
Array [
Object {
[
{
"bg": 4,
"bold": false,
"content": " Blue Background Underline ",
Expand Down
Loading

0 comments on commit 7cc4733

Please sign in to comment.