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

Update Jest #1622

Merged
merged 2 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions jest-disable-built-in-fetch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = function () {
// This is required for tests to work with "cross-fetch" on newer node versions,
// otherwise "cross-fetch" won't replace the builtin `fetch`
globalThis.fetch = undefined
}
4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// @TODO Remove this once merged with eslint updates
// eslint-disable-next-line tsdoc/syntax
/** @type {import('jest').Config} */
const config = {
rootDir: '.',
testMatch: ['<rootDir>/tests/**/*.ts?(x)'],
Expand All @@ -15,6 +18,7 @@ const config = {
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
],
globalSetup: './jest-disable-built-in-fetch.js',
projects: [
{
preset: 'ts-jest',
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"@rollup/plugin-commonjs": "25.0.2",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "15.1.0",
"@types/jest": "^27.5.0",
"@types/jest": "^29.5.11",
"@types/prettier": "^2.2.3",
"@typescript-eslint/eslint-plugin": "2.34.0",
"@typescript-eslint/parser": "2.34.0",
Expand All @@ -88,16 +88,17 @@
"eslint-config-prettier": "^8.1.0",
"eslint-config-standard-with-typescript": "^17.0.0",
"eslint-plugin-import": "2",
"eslint-plugin-jest": "^24.1.8",
"eslint-plugin-jest": "^27.6.1",
"eslint-plugin-node": "11",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-promise": "4",
"eslint-plugin-standard": "5",
"eslint-plugin-tsdoc": "^0.2.17",
"gzip-size": "^6.0.0",
"jest": "^26.6.3",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-fetch-mock": "^3.0.3",
"jest-watch-typeahead": "^0.6.3",
"jest-watch-typeahead": "^2.2.2",
"kleur": "^4.1.5",
"lint-staged": "11.1.2",
"nodemon": "^2.0.16",
Expand All @@ -108,7 +109,7 @@
"rollup-plugin-terser": "^7.0.0",
"rollup-plugin-typescript2": "^0.35.0",
"shx": "^0.3.2",
"ts-jest": "^26.5.6",
"ts-jest": "^29.1.1",
"typescript": "^4.9.5"
}
}
96 changes: 48 additions & 48 deletions tests/__snapshots__/facet_search.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Test on POST search Admin key: basic facet value search 1`] = `
Object {
"facetHits": Array [
Object {
{
"facetHits": [
{
"count": 1,
"value": "action",
},
Object {
{
"count": 2,
"value": "adventure",
},
Expand All @@ -18,9 +18,9 @@ Object {
`;

exports[`Test on POST search Admin key: facet value search with filter 1`] = `
Object {
"facetHits": Array [
Object {
{
"facetHits": [
{
"count": 1,
"value": "action",
},
Expand All @@ -31,21 +31,21 @@ Object {
`;

exports[`Test on POST search Admin key: facet value search with no facet query 1`] = `
Object {
"facetHits": Array [
Object {
{
"facetHits": [
{
"count": 1,
"value": "action",
},
Object {
{
"count": 2,
"value": "adventure",
},
Object {
{
"count": 1,
"value": "comedy",
},
Object {
{
"count": 2,
"value": "romance",
},
Expand All @@ -56,9 +56,9 @@ Object {
`;

exports[`Test on POST search Admin key: facet value search with search query 1`] = `
Object {
"facetHits": Array [
Object {
{
"facetHits": [
{
"count": 1,
"value": "adventure",
},
Expand All @@ -69,13 +69,13 @@ Object {
`;

exports[`Test on POST search Master key: basic facet value search 1`] = `
Object {
"facetHits": Array [
Object {
{
"facetHits": [
{
"count": 1,
"value": "action",
},
Object {
{
"count": 2,
"value": "adventure",
},
Expand All @@ -86,9 +86,9 @@ Object {
`;

exports[`Test on POST search Master key: facet value search with filter 1`] = `
Object {
"facetHits": Array [
Object {
{
"facetHits": [
{
"count": 1,
"value": "action",
},
Expand All @@ -99,21 +99,21 @@ Object {
`;

exports[`Test on POST search Master key: facet value search with no facet query 1`] = `
Object {
"facetHits": Array [
Object {
{
"facetHits": [
{
"count": 1,
"value": "action",
},
Object {
{
"count": 2,
"value": "adventure",
},
Object {
{
"count": 1,
"value": "comedy",
},
Object {
{
"count": 2,
"value": "romance",
},
Expand All @@ -124,9 +124,9 @@ Object {
`;

exports[`Test on POST search Master key: facet value search with search query 1`] = `
Object {
"facetHits": Array [
Object {
{
"facetHits": [
{
"count": 1,
"value": "adventure",
},
Expand All @@ -137,13 +137,13 @@ Object {
`;

exports[`Test on POST search Search key: basic facet value search 1`] = `
Object {
"facetHits": Array [
Object {
{
"facetHits": [
{
"count": 1,
"value": "action",
},
Object {
{
"count": 2,
"value": "adventure",
},
Expand All @@ -154,9 +154,9 @@ Object {
`;

exports[`Test on POST search Search key: facet value search with filter 1`] = `
Object {
"facetHits": Array [
Object {
{
"facetHits": [
{
"count": 1,
"value": "action",
},
Expand All @@ -167,21 +167,21 @@ Object {
`;

exports[`Test on POST search Search key: facet value search with no facet query 1`] = `
Object {
"facetHits": Array [
Object {
{
"facetHits": [
{
"count": 1,
"value": "action",
},
Object {
{
"count": 2,
"value": "adventure",
},
Object {
{
"count": 1,
"value": "comedy",
},
Object {
{
"count": 2,
"value": "romance",
},
Expand All @@ -192,9 +192,9 @@ Object {
`;

exports[`Test on POST search Search key: facet value search with search query 1`] = `
Object {
"facetHits": Array [
Object {
{
"facetHits": [
{
"count": 1,
"value": "adventure",
},
Expand Down
32 changes: 16 additions & 16 deletions tests/__snapshots__/faceting.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,73 +1,73 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Test on faceting Admin key: Get default faceting object 1`] = `
Object {
{
"maxValuesPerFacet": 100,
"sortFacetValuesBy": Object {
"sortFacetValuesBy": {
"*": "alpha",
},
}
`;

exports[`Test on faceting Admin key: Reset faceting 1`] = `
Object {
{
"maxValuesPerFacet": 100,
"sortFacetValuesBy": Object {
"sortFacetValuesBy": {
"*": "alpha",
},
}
`;

exports[`Test on faceting Admin key: Update faceting at null 1`] = `
Object {
{
"maxValuesPerFacet": 100,
"sortFacetValuesBy": Object {
"sortFacetValuesBy": {
"*": "alpha",
},
}
`;

exports[`Test on faceting Admin key: Update faceting settings 1`] = `
Object {
{
"maxValuesPerFacet": 12,
"sortFacetValuesBy": Object {
"sortFacetValuesBy": {
"*": "alpha",
"test": "count",
},
}
`;

exports[`Test on faceting Master key: Get default faceting object 1`] = `
Object {
{
"maxValuesPerFacet": 100,
"sortFacetValuesBy": Object {
"sortFacetValuesBy": {
"*": "alpha",
},
}
`;

exports[`Test on faceting Master key: Reset faceting 1`] = `
Object {
{
"maxValuesPerFacet": 100,
"sortFacetValuesBy": Object {
"sortFacetValuesBy": {
"*": "alpha",
},
}
`;

exports[`Test on faceting Master key: Update faceting at null 1`] = `
Object {
{
"maxValuesPerFacet": 100,
"sortFacetValuesBy": Object {
"sortFacetValuesBy": {
"*": "alpha",
},
}
`;

exports[`Test on faceting Master key: Update faceting settings 1`] = `
Object {
{
"maxValuesPerFacet": 12,
"sortFacetValuesBy": Object {
"sortFacetValuesBy": {
"*": "alpha",
"test": "count",
},
Expand Down
Loading
Loading