Skip to content

Commit

Permalink
changes following migration guide
Browse files Browse the repository at this point in the history
  • Loading branch information
jtoar committed Aug 7, 2022
1 parent e6056dd commit a54eaef
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 66 deletions.
4 changes: 2 additions & 2 deletions packages/testing/config/jest/api/RedwoodApiJestEnv.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const NodeEnvironment = require('jest-environment-node')
const { TestEnvironment } = require('jest-environment-node')

class RedwoodApiJestEnvironment extends NodeEnvironment {
class RedwoodApiJestEnvironment extends TestEnvironment {
constructor(config, context) {
super(config, context)
this.testPath = context.testPath
Expand Down
2 changes: 1 addition & 1 deletion packages/testing/config/jest/api/jest-preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const rwjsPaths = getPaths()
const NODE_MODULES_PATH = path.join(rwjsPaths.base, 'node_modules')
const { babelrc } = getApiSideDefaultBabelConfig()

// @NOTE: is there a better way we could implmenet this?
// @NOTE: is there a better way we could implement this?
if (process.env.SKIP_DB_PUSH !== '1') {
const process = require('process')
const path = require('path')
Expand Down
4 changes: 2 additions & 2 deletions packages/testing/config/jest/web/RedwoodWebJestEnv.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const Environment = require('jest-environment-jsdom')
const { TestEnvironment } = require('jest-environment-jsdom')

// Due to issue: https://github.com/jsdom/jsdom/issues/2524
// Fix from: https://github.com/jsdom/jsdom/issues/2524#issuecomment-736672511
module.exports = class RedwoodWebJestEnv extends Environment {
module.exports = class RedwoodWebJestEnv extends TestEnvironment {
async setup() {
await super.setup()
if (typeof this.global.TextEncoder === 'undefined') {
Expand Down
1 change: 1 addition & 0 deletions packages/testing/config/jest/web/jest-preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@ module.exports = {
},
],
},
resolver: path.resolve(__dirname, './resolver.js'),
}
15 changes: 15 additions & 0 deletions packages/testing/config/jest/web/resolver.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// See these threads:
// - https://github.com/facebook/jest/issues/12770
// - https://github.com/microsoft/accessibility-insights-web/pull/5421#issuecomment-1109168149.
module.exports = (path, options) => {
return options.defaultResolver(path, {
...options,
packageFilter: (pkg) => {
if (pkg.name === 'uuid') {
delete pkg['exports']
delete pkg['module']
}
return pkg
},
})
}
1 change: 1 addition & 0 deletions packages/testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"babel-jest": "28.0.3",
"babel-plugin-inline-react-svg": "2.0.1",
"jest": "28.0.3",
"jest-environment-jsdom": "28.1.3",
"jest-watch-typeahead": "1.1.0",
"msw": "0.39.2",
"ts-toolbelt": "9.6.0",
Expand Down
123 changes: 62 additions & 61 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3790,15 +3790,15 @@ __metadata:
languageName: node
linkType: hard

"@jest/environment@npm:^28.0.2":
version: 28.0.2
resolution: "@jest/environment@npm:28.0.2"
"@jest/environment@npm:^28.0.2, @jest/environment@npm:^28.1.3":
version: 28.1.3
resolution: "@jest/environment@npm:28.1.3"
dependencies:
"@jest/fake-timers": ^28.0.2
"@jest/types": ^28.0.2
"@jest/fake-timers": ^28.1.3
"@jest/types": ^28.1.3
"@types/node": "*"
jest-mock: ^28.0.2
checksum: 7f9aadf6f9586165ab10ba77c7ed393e29fef8d90ad6409df668ba3dc3d4c4ed7b0d6829e598b60b82a9fe0862b4ae61e43d1baa6bb47c6dce288cac41ab3095
jest-mock: ^28.1.3
checksum: 910b8863f300e0627c8f7bf6280fe51da25060e72ac1179d959cce74907b048e64042ad192800259a037dc52faa2e361e778a94df223cf1b17a315e5eec5471e
languageName: node
linkType: hard

Expand All @@ -3821,17 +3821,17 @@ __metadata:
languageName: node
linkType: hard

"@jest/fake-timers@npm:^28.0.2":
version: 28.0.2
resolution: "@jest/fake-timers@npm:28.0.2"
"@jest/fake-timers@npm:^28.0.2, @jest/fake-timers@npm:^28.1.3":
version: 28.1.3
resolution: "@jest/fake-timers@npm:28.1.3"
dependencies:
"@jest/types": ^28.0.2
"@sinonjs/fake-timers": ^9.1.1
"@jest/types": ^28.1.3
"@sinonjs/fake-timers": ^9.1.2
"@types/node": "*"
jest-message-util: ^28.0.2
jest-mock: ^28.0.2
jest-util: ^28.0.2
checksum: 4b0d8d6ec2e7955d9e2289e489a1ffa7679774980517d84ed0b7ffd779c6f58517699956e20a3cd02ffd04aa94c60d33049f6957b842f5e71ac9b73b50b960bf
jest-message-util: ^28.1.3
jest-mock: ^28.1.3
jest-util: ^28.1.3
checksum: 70ca341df62bf51a9bed653743dfc17011df58995520b51730ee7f5aef26a0295a5f5b58e838e6dbace998de417aa1c3a77d6de1590b53065475a195601552c6
languageName: node
linkType: hard

Expand Down Expand Up @@ -3882,12 +3882,12 @@ __metadata:
languageName: node
linkType: hard

"@jest/schemas@npm:^28.0.2":
version: 28.0.2
resolution: "@jest/schemas@npm:28.0.2"
"@jest/schemas@npm:^28.1.3":
version: 28.1.3
resolution: "@jest/schemas@npm:28.1.3"
dependencies:
"@sinclair/typebox": ^0.23.3
checksum: c8f88543d50318a78b9916b4f1015658abd247d48c43fcb40c5075a0c2246b79f6466488e0f641b5ff54d7d43e22c33d4ac275d4f0b7fa6debfe24023d2c7bec
"@sinclair/typebox": ^0.24.1
checksum: 8c325918f3e1b83e687987b05c2e5143d171f372b091f891fe17835f06fadd864ddae3c7e221a704bdd7e2ea28c4b337124c02023d8affcbdd51eca2879162ac
languageName: node
linkType: hard

Expand Down Expand Up @@ -3998,17 +3998,17 @@ __metadata:
languageName: node
linkType: hard

"@jest/types@npm:^28.0.2":
version: 28.0.2
resolution: "@jest/types@npm:28.0.2"
"@jest/types@npm:^28.0.2, @jest/types@npm:^28.1.3":
version: 28.1.3
resolution: "@jest/types@npm:28.1.3"
dependencies:
"@jest/schemas": ^28.0.2
"@jest/schemas": ^28.1.3
"@types/istanbul-lib-coverage": ^2.0.0
"@types/istanbul-reports": ^3.0.0
"@types/node": "*"
"@types/yargs": ^17.0.8
chalk: ^4.0.0
checksum: 2b62642a3f2dab2b9a05cc8d40402da68c3e9305a4b933b143ab375837cd32a5cee335f7a98c20fd21c1701688d69d6401dd001cb1ae8d7fe320e7d92980377e
checksum: 3cffae7d1133aa7952a6b5c4806f89ed78cb0dfe3ec4e8c5a6e704d7bab3cff86c714abb5f0f637540da22776900a33b3bad79c5ed5fc5b5535fb24e3006e3cb
languageName: node
linkType: hard

Expand Down Expand Up @@ -6419,6 +6419,7 @@ __metadata:
babel-jest: 28.0.3
babel-plugin-inline-react-svg: 2.0.1
jest: 28.0.3
jest-environment-jsdom: 28.1.3
jest-watch-typeahead: 1.1.0
msw: 0.39.2
ts-toolbelt: 9.6.0
Expand Down Expand Up @@ -6490,10 +6491,10 @@ __metadata:
languageName: node
linkType: hard

"@sinclair/typebox@npm:^0.23.3":
version: 0.23.4
resolution: "@sinclair/typebox@npm:0.23.4"
checksum: 5a3b01fe6409bfbd1ee9343ab3034c9c8f4d005eb7e58572052c4c66e36abcecb44a50ee4e3b38764ba66bd4b34511d0290e0e7023752e6f391da063d02a1993
"@sinclair/typebox@npm:^0.24.1":
version: 0.24.27
resolution: "@sinclair/typebox@npm:0.24.27"
checksum: 3f218bcb30b09c3bfe27900ece84ce19c8afe4558c6e9f118634cb793fc2a939ae4588dfa866c7e3f1c6a2ff235def4d0dbc9eb0b70b2e82eb97a317bc5dd501
languageName: node
linkType: hard

Expand All @@ -6520,7 +6521,7 @@ __metadata:
languageName: node
linkType: hard

"@sinonjs/fake-timers@npm:^9.1.1":
"@sinonjs/fake-timers@npm:^9.1.2":
version: 9.1.2
resolution: "@sinonjs/fake-timers@npm:9.1.2"
dependencies:
Expand Down Expand Up @@ -19851,19 +19852,19 @@ __metadata:
languageName: node
linkType: hard

"jest-environment-jsdom@npm:^28.0.2":
version: 28.0.2
resolution: "jest-environment-jsdom@npm:28.0.2"
"jest-environment-jsdom@npm:28.1.3, jest-environment-jsdom@npm:^28.0.2":
version: 28.1.3
resolution: "jest-environment-jsdom@npm:28.1.3"
dependencies:
"@jest/environment": ^28.0.2
"@jest/fake-timers": ^28.0.2
"@jest/types": ^28.0.2
"@jest/environment": ^28.1.3
"@jest/fake-timers": ^28.1.3
"@jest/types": ^28.1.3
"@types/jsdom": ^16.2.4
"@types/node": "*"
jest-mock: ^28.0.2
jest-util: ^28.0.2
jest-mock: ^28.1.3
jest-util: ^28.1.3
jsdom: ^19.0.0
checksum: 6173c389b357d2a4697f1a84256329074b1d388af494630207f2114cb008a498a42adc3121227036671584e6085e84e6d23f3a0f2b6698914c269fc2a43247a3
checksum: f3239dc01f33ae613eff6f3bad61b5c7709385085a85904e44d6457c38aa5e4500792da475bfd7918b1aaff7a6c1febbb5b6e9974f7e08bcc273b7f5242ac95d
languageName: node
linkType: hard

Expand Down Expand Up @@ -20006,30 +20007,30 @@ __metadata:
languageName: node
linkType: hard

"jest-message-util@npm:^28.0.2":
version: 28.0.2
resolution: "jest-message-util@npm:28.0.2"
"jest-message-util@npm:^28.0.2, jest-message-util@npm:^28.1.3":
version: 28.1.3
resolution: "jest-message-util@npm:28.1.3"
dependencies:
"@babel/code-frame": ^7.12.13
"@jest/types": ^28.0.2
"@jest/types": ^28.1.3
"@types/stack-utils": ^2.0.0
chalk: ^4.0.0
graceful-fs: ^4.2.9
micromatch: ^4.0.4
pretty-format: ^28.0.2
pretty-format: ^28.1.3
slash: ^3.0.0
stack-utils: ^2.0.3
checksum: d976b28a1b6df1f956c952eac191453387237173469ecee1739492c232bf8bae32894e541200922b82de63969949e2a4dcf1d933da8d8955627bf956d9dbf352
checksum: 9f56a11b4171e43e2375446e624eec86f82820d9a35de3cd8b065b5ce2d7f65d2bbbdfc0ffe5fa358ff866693a68ec4f6b0cb8ad953fd6f35f9895eb370c6ed7
languageName: node
linkType: hard

"jest-mock@npm:^28.0.2":
version: 28.0.2
resolution: "jest-mock@npm:28.0.2"
"jest-mock@npm:^28.0.2, jest-mock@npm:^28.1.3":
version: 28.1.3
resolution: "jest-mock@npm:28.1.3"
dependencies:
"@jest/types": ^28.0.2
"@jest/types": ^28.1.3
"@types/node": "*"
checksum: 5e8648060d10c4c6c7a67e8f2f1e4d0973c4481e701751948b06739a49813571b8dd4a2749c8556308351384c631305ff2b322e26883286437365271b79859a2
checksum: 1d936755925863bd896bfc9c0ed733faf9ff13ab51cdcb4c53bd07e6857e464bb5c0723f9d157837c47dbf880a3a4b9cff2805051207a37caec04d65e6c509fb
languageName: node
linkType: hard

Expand Down Expand Up @@ -20207,17 +20208,17 @@ __metadata:
languageName: node
linkType: hard

"jest-util@npm:^28.0.2":
version: 28.0.2
resolution: "jest-util@npm:28.0.2"
"jest-util@npm:^28.0.2, jest-util@npm:^28.1.3":
version: 28.1.3
resolution: "jest-util@npm:28.1.3"
dependencies:
"@jest/types": ^28.0.2
"@jest/types": ^28.1.3
"@types/node": "*"
chalk: ^4.0.0
ci-info: ^3.2.0
graceful-fs: ^4.2.9
picomatch: ^2.2.3
checksum: cf83728654376ab460ce0a7e3d48b1c421614e3a1facba3bbcb28652630555d8a26145861a495d3525137206cc61eb949c81614265db007a8a08903fa5412297
checksum: 7d4946424032a2ccb2ad669905debb44b0bf040dff7a1fe82d283c679ae4638a86ca48d6a276d65a76451252338ad84e76ef2cfde03f577f091fe2b3102aedc9
languageName: node
linkType: hard

Expand Down Expand Up @@ -25125,15 +25126,15 @@ __metadata:
languageName: node
linkType: hard

"pretty-format@npm:^28.0.2":
version: 28.0.2
resolution: "pretty-format@npm:28.0.2"
"pretty-format@npm:^28.0.2, pretty-format@npm:^28.1.3":
version: 28.1.3
resolution: "pretty-format@npm:28.1.3"
dependencies:
"@jest/schemas": ^28.0.2
"@jest/schemas": ^28.1.3
ansi-regex: ^5.0.1
ansi-styles: ^5.0.0
react-is: ^18.0.0
checksum: 8e3d25f1b9bd59dfbb83732785b7ef399ffeeaa8043738b34b5a08fc86773e657d147f910bb2a13b0e7a05db0011cf9d6631137267a13ecbb612a499136086d8
checksum: 596d8b459b6fdac7dcbd70d40169191e889939c17ffbcc73eebe2a9a6f82cdbb57faffe190274e0a507d9ecdf3affadf8a9b43442a625eecfbd2813b9319660f
languageName: node
linkType: hard

Expand Down

0 comments on commit a54eaef

Please sign in to comment.