Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
4,689 changes: 1,061 additions & 3,628 deletions e2e/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@aws-sdk/client-s3": "3.450.0",
"@aws-sdk/client-sts": "3.450.0",
"@salesforce/pwa-kit-dev": "3.17.0-dev",
"jest": "^26.6.3"
"jest": "^29.7.0"
},
"jest": {
"setupFilesAfterEnv": [
Expand Down
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions packages/internal-lib-build/bin/prepare-dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
*/
/* istanbul ignore file */
/* eslint-disable @typescript-eslint/no-var-requires */
const promisify = require('util').promisify
const fs = require('fs')
const fsPromises = require('fs').promises
const rimraf = promisify(require('rimraf'))
const path = require('path')
const replace = require('replace-in-file')
const packlist = require('npm-packlist')
Expand Down Expand Up @@ -55,7 +53,7 @@ const main = async () => {
console.log('Preparing dist...')
// Remove the dist/package.json so we don't end up including more files in
// the package.
await rimraf(`${DEST_DIR}/package.json`)
await fsPromises.rm(`${DEST_DIR}/package.json`, {force: true})

try {
// Get a list of files from the `npm pack --dry-run` command.
Expand Down
6 changes: 5 additions & 1 deletion packages/internal-lib-build/configs/jest/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ module.exports = {
],
testEnvironment: 'jest-environment-jsdom-global',
testEnvironmentOptions: {
resources: 'usable'
resources: 'usable',
// Prevent jest-environment-jsdom from using 'browser' export conditions (Jest 29+).
// Without this, packages like uuid and nanoid resolve to ESM browser builds
// that Jest cannot parse in a CJS context.
customExportConditions: ['node', 'node-addons']
}
}
21 changes: 21 additions & 0 deletions packages/internal-lib-build/configs/jest/setup-jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,26 @@ import 'raf/polyfill' // fix requestAnimationFrame issue with polyfill
import fetch from 'jest-fetch-mock'
import 'regenerator-runtime/runtime'

// Polyfill setImmediate/clearImmediate for jsdom environment (Jest 28+)
// jsdom no longer provides these Node.js globals by default
if (typeof global.setImmediate === 'undefined') {
global.setImmediate = (fn, ...args) => setTimeout(fn, 0, ...args)
global.clearImmediate = (id) => clearTimeout(id)
}

// Polyfill performance.mark/measure for jsdom environment (Jest 29+)
// jsdom v20 does not implement the User Timing API (performance.mark/measure)
// Use the Node.js built-in performance API as a fallback
if (typeof global.performance !== 'undefined' && typeof global.performance.mark !== 'function') {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const {performance: nodePerformance} = require('perf_hooks')
global.performance.mark = nodePerformance.mark.bind(nodePerformance)
global.performance.measure = nodePerformance.measure.bind(nodePerformance)
global.performance.getEntriesByName = nodePerformance.getEntriesByName.bind(nodePerformance)
global.performance.getEntriesByType = nodePerformance.getEntriesByType.bind(nodePerformance)
global.performance.clearMarks = nodePerformance.clearMarks.bind(nodePerformance)
global.performance.clearMeasures = nodePerformance.clearMeasures.bind(nodePerformance)
}

// Mock Fetch
global.fetch = fetch
Loading
Loading