Skip to content

Commit

Permalink
fix: tsconfig target as es2022 temporary
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillgroshkov committed Nov 9, 2024
1 parent c0b4e9e commit d53fe9c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion cfg/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"outDir": "${configDir}/dist",

// Target/module
"target": "es2023",
"target": "es2022", // todo: es2023 when all consumers are on ts5.6+
"lib": ["esnext"], // add "dom" if needed
// module `nodenext` is a modern mode that auto-detects cjs/esm
// it also defaults `esModuleInterop` and `allowSyntheticDefaultImports` to true
Expand Down
6 changes: 1 addition & 5 deletions src/testing/time.util.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MOCK_TS_2018_06_21, mockTime, mockTimeMillis, resetTime } from './time.util'
import { MOCK_TS_2018_06_21, mockTime, resetTime } from './time.util'

const now = Date.now()

Expand All @@ -15,10 +15,6 @@ test('mockTime default', () => {

expect(Date.now()).toBeGreaterThanOrEqual(now)

mockTimeMillis(123_456)

expect(Date.now()).toBe(123_456)

resetTime()

expect(new Date().getFullYear()).toBeGreaterThan(2018)
Expand Down
9 changes: 3 additions & 6 deletions src/testing/time.util.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import type { UnixTimestamp } from '@naturalcycles/js-lib'
import timekeeper from 'timekeeper'

export const MOCK_TS_2018_06_21 = 1_529_539_200
export const MOCK_TS_2018_06_21 = 1_529_539_200 as UnixTimestamp

/**
* Locks time-related functions to return always same time.
* For deterministic tests.
*/
export function mockTime(ts = MOCK_TS_2018_06_21): void {
mockTimeMillis(ts * 1000)
}

export function mockTimeMillis(millis = MOCK_TS_2018_06_21 * 1000): void {
timekeeper.freeze(millis)
timekeeper.freeze(ts * 1000)
}

export function resetTime(): void {
Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1014,17 +1014,17 @@
typescript "^5.0.2"

"@naturalcycles/js-lib@^14.0.0", "@naturalcycles/js-lib@^14.244.0":
version "14.260.0"
resolved "https://registry.yarnpkg.com/@naturalcycles/js-lib/-/js-lib-14.260.0.tgz#1086a684ff4ccd028be053d9fa701d9cd5358dbf"
integrity sha512-GfkmD+xAP8GODx2kh++5MErmDMu50S/QAslbtoaKtpWrmFlfaMEtNpYLXLDYGjcj4NJRilbE9hwiM8Rizs5V2g==
version "14.261.0"
resolved "https://registry.yarnpkg.com/@naturalcycles/js-lib/-/js-lib-14.261.0.tgz#e85aaa6c68b5efeada4e4cfdcb5c00e5e30a8d3a"
integrity sha512-7+jI98zjNcifAkQu8q4UHhXzeclJVIDfoE8GHpwdqjbaT6a9p2KOikvBjMd1SdCH1OTR6ijBPNvax1VS9Jb2qw==
dependencies:
tslib "^2.0.0"
zod "^3.20.2"

"@naturalcycles/nodejs-lib@^13.0.1":
version "13.36.0"
resolved "https://registry.yarnpkg.com/@naturalcycles/nodejs-lib/-/nodejs-lib-13.36.0.tgz#cea71bd4e88ba37d28cb4af9a12fd5e0678d4fd0"
integrity sha512-v6t2P2HGFhaCFN9iM5Fgvg7qnf7FAK76SatCLGoQtdozyUX7xnPj8xUe35ft2YGvmu1TaWU4UWqRKTJEWGwByA==
version "13.37.1"
resolved "https://registry.yarnpkg.com/@naturalcycles/nodejs-lib/-/nodejs-lib-13.37.1.tgz#c30ace789bf7a484c548bb7d67fd6501dcb6272e"
integrity sha512-Ltw5SAGUkLH4pp+juov16LOwjSCyXdFBEgLXcCbOcQV9a5l9jLZouULrSQ+CpBvpXTElKRAFqWobU57wQHVtgw==
dependencies:
"@naturalcycles/js-lib" "^14.244.0"
"@types/js-yaml" "^4.0.9"
Expand Down

0 comments on commit d53fe9c

Please sign in to comment.