Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace ts-jest with es-jest #7374

Merged
merged 1 commit into from
Apr 11, 2023
Merged
Show file tree
Hide file tree
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
Replace ts-jest with es-jest
  • Loading branch information
stwlam committed Apr 11, 2023
commit 98a1d64ec989f824f7bc49529dedb294639b1848
3 changes: 2 additions & 1 deletion jest.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
},
"setupFiles": [
"./tests/setup.ts"
]
],
"preset": "es-jest"
}
2,177 changes: 1,041 additions & 1,136 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"@types/yaireo__tagify": "^4.17.0",
"@typescript-eslint/eslint-plugin": "^5.57.1",
"@typescript-eslint/parser": "^5.57.1",
"es-jest": "^2.1.0",
"eslint": "^8.37.0",
"eslint-config-prettier": "^8.8.0",
"eslint-import-resolver-typescript": "^3.5.5",
Expand All @@ -55,10 +56,10 @@
"pixi.js": "6.5.2",
"prettier": "^2.8.7",
"prompts": "^2.4.2",
"sass": "^1.61.0",
"socket.io": "4.5.1",
"socket.io-client": "4.5.1",
"tinymce": "6.1.2",
"ts-jest": "^29.1.0",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.0.4",
"vite": "^4.2.1",
Expand Down
8 changes: 4 additions & 4 deletions src/module/apps/world-clock/animate-darkness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function darknessLevelAtTime(time: DateTime) {
/** Calculate animateDarkness parameters from a time interval */
function intervalToTransition(interval: Interval, compactInterval: Interval): DarknessTransition {
const currentDarkness = canvas.darknessLevel;
const targetDarkness = darknessLevelAtTime(interval.end);
const targetDarkness = darknessLevelAtTime(interval.end!);
const darknessDiff = Math.abs((currentDarkness ?? targetDarkness) - targetDarkness);

// Cap the darkness transition duration
Expand Down Expand Up @@ -84,10 +84,10 @@ export async function animateDarkness(this: WorldClock, timeDiff: number): Promi

// Break up the interval into peaks and valleys of darkness
const transitionTimes = [4.75, 18]
.map((hour) => compactInterval.start.set({ hour: hour, minute: 0, second: 0 }))
.concat([4.75, 18].map((hour) => compactInterval.end.set({ hour: hour, minute: 0, second: 0 })))
.map((hour) => compactInterval.start!.set({ hour: hour, minute: 0, second: 0 }))
.concat([4.75, 18].map((hour) => compactInterval.end!.set({ hour: hour, minute: 0, second: 0 })))
.filter((dateTime) => compactInterval.contains(dateTime))
.concat([compactInterval.start, compactInterval.end])
.concat([compactInterval.start!, compactInterval.end!])
.sort((dtA, dtB) => (dtA < dtB ? -1 : dtA > dtB ? 1 : 0));

type DateTimePair = [DateTime, DateTime];
Expand Down
4 changes: 2 additions & 2 deletions src/module/apps/world-clock/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class WorldClock extends Application {
return months[month];
}
default:
return this.worldTime.monthLong;
return this.worldTime.monthLong!;
}
}

Expand All @@ -129,7 +129,7 @@ export class WorldClock extends Application {
return weekdays[weekday];
}
default:
return this.worldTime.weekdayLong;
return this.worldTime.weekdayLong!;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/module/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ interface NewDocumentSchemaRecord {
interface MigratedDocumentSchemaRecord {
version: number;
lastMigration: {
datetime: string;
datetime: string | null;
version: {
schema: number | null;
system?: string;
Expand Down
2 changes: 1 addition & 1 deletion src/module/system/settings/world-clock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export class WorldClockSettings extends FormApplication {
hint: CONFIG.PF2E.SETTINGS.worldClock.worldCreatedOn.hint,
scope: "world",
config: false,
default: DateTime.utc().toISO(),
default: DateTime.utc().toISO()!,
type: String,
},
};
Expand Down