Skip to content

Commit

Permalink
no more jest globals
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitropoulos committed Oct 24, 2024
1 parent c85cf2c commit 02749b3
Show file tree
Hide file tree
Showing 81 changed files with 450 additions and 410 deletions.
2 changes: 1 addition & 1 deletion examples/kitchen-sink/apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
"morgan": "^1.10.0"
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@repo/eslint-config": "workspace:*",
"@repo/jest-presets": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@types/body-parser": "^1.19.5",
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/jest": "^29.5.13",
"@types/morgan": "^1.9.9",
"@types/node": "^20.11.24",
"@types/supertest": "^6.0.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import supertest from "supertest";
import { describe, it, expect } from "@jest/globals";
import { createServer } from "../server";

describe("Server", () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/kitchen-sink/packages/logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"preset": "@repo/jest-presets/node"
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@repo/eslint-config": "workspace:*",
"@repo/jest-presets": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@types/jest": "^29.5.13",
"@types/node": "^20.11.24",
"jest": "^29.7.0",
"tsup": "^8.0.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it, expect, jest } from "@jest/globals";
import { log } from "..";

jest.spyOn(global.console, "log");
Expand Down
2 changes: 1 addition & 1 deletion examples/kitchen-sink/packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
"preset": "@repo/jest-presets/browser"
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@repo/eslint-config": "workspace:*",
"@repo/jest-presets": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@types/jest": "^29.5.13",
"@types/node": "^20.11.24",
"@types/react": "^18.2.62",
"@types/react-dom": "^18.2.19",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it } from "@jest/globals";
import { createRoot } from "react-dom/client";
import { CounterButton } from ".";

Expand Down
1 change: 1 addition & 0 deletions examples/kitchen-sink/packages/ui/src/link/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it } from "@jest/globals";
import { createRoot } from "react-dom/client";
import { Link } from ".";

Expand Down
25 changes: 9 additions & 16 deletions examples/kitchen-sink/pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion examples/with-docker/apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
"morgan": "^1.10.0"
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@repo/eslint-config": "*",
"@repo/jest-presets": "*",
"@repo/typescript-config": "*",
"@types/body-parser": "^1.19.5",
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/jest": "^29.5.13",
"@types/morgan": "^1.9.9",
"@types/node": "^20.11.24",
"@types/supertest": "^6.0.2",
Expand Down
1 change: 1 addition & 0 deletions examples/with-docker/apps/api/src/__tests__/server.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import supertest from "supertest";
import { describe, it, expect } from "@jest/globals";
import { createServer } from "../server";

describe("server", () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/with-docker/packages/logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"preset": "@repo/jest-presets/node"
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@repo/eslint-config": "*",
"@repo/jest-presets": "*",
"@repo/typescript-config": "*",
"@types/jest": "^29.5.13",
"@types/node": "^20.11.24",
"eslint": "^8.57.0",
"jest": "^29.7.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it, expect, jest } from "@jest/globals";
import { log } from "..";

jest.spyOn(global.console, "log");
Expand Down
12 changes: 2 additions & 10 deletions examples/with-docker/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -988,14 +988,6 @@
dependencies:
"@types/istanbul-lib-report" "*"

"@types/jest@^29.5.13":
version "29.5.13"
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.13.tgz#8bc571659f401e6a719a7bf0dbcb8b78c71a8adc"
integrity sha512-wd+MVEZCHt23V0/L642O5APvspWply/rGY5BcW4SUETo2UzPU3Z26qr8jC2qxpimI2jjx9h7+2cj2FwIr01bXg==
dependencies:
expect "^29.0.0"
pretty-format "^29.0.0"

"@types/json-schema@^7.0.12", "@types/json-schema@^7.0.9":
version "7.0.15"
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841"
Expand Down Expand Up @@ -2654,7 +2646,7 @@ exit@^0.1.2:
resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c"
integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==

expect@^29.0.0, expect@^29.7.0:
expect@^29.7.0:
version "29.7.0"
resolved "https://registry.yarnpkg.com/expect/-/expect-29.7.0.tgz#578874590dcb3214514084c08115d8aee61e11bc"
integrity sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==
Expand Down Expand Up @@ -4512,7 +4504,7 @@ prettier@^3.2.5:
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.5.tgz#e52bc3090586e824964a8813b09aba6233b28368"
integrity sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==

pretty-format@^29.0.0, pretty-format@^29.7.0:
pretty-format@^29.7.0:
version "29.7.0"
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812"
integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==
Expand Down
2 changes: 1 addition & 1 deletion examples/with-nestjs/apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
"rxjs": "^7.8.1"
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@nestjs/cli": "^10.0.0",
"@nestjs/schematics": "^10.0.0",
"@nestjs/testing": "^10.0.0",
"@repo/eslint-config": "workspace:*",
"@repo/jest-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@types/express": "^4.17.17",
"@types/jest": "^29.5.13",
"@types/node": "^20.3.1",
"@types/supertest": "^6.0.0",
"jest": "^29.7.0",
Expand Down
1 change: 1 addition & 0 deletions examples/with-nestjs/apps/api/src/app.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Test, TestingModule } from '@nestjs/testing';
import { describe, it, expect, beforeEach } from '@jest/globals';
import { AppController } from './app.controller';
import { AppService } from './app.service';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Test, TestingModule } from '@nestjs/testing';
import { describe, it, expect, beforeEach } from '@jest/globals';

import { LinksController } from './links.controller';
import { LinksService } from './links.service';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Test, TestingModule } from '@nestjs/testing';
import { describe, it, expect, beforeEach } from '@jest/globals';
import { LinksService } from './links.service';

describe('LinksService', () => {
Expand Down
1 change: 1 addition & 0 deletions examples/with-nestjs/apps/api/test/app.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import { describe, it, beforeEach } from '@jest/globals';
import request from 'supertest';
import { AppModule } from './../src/app.module';

Expand Down
2 changes: 1 addition & 1 deletion examples/with-nestjs/apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@next/eslint-plugin-next": "^14.1.1",
"@playwright/test": "^1.44.0",
"@repo/api": "workspace:*",
Expand All @@ -26,7 +27,6 @@
"@repo/typescript-config": "workspace:*",
"@testing-library/jest-dom": "^6.4.5",
"@testing-library/react": "^15.0.7",
"@types/jest": "^29.5.13",
"@types/node": "^20.11.24",
"@types/react": "^18.2.61",
"@types/react-dom": "^18.2.19",
Expand Down
1 change: 1 addition & 0 deletions examples/with-nestjs/apps/web/test/layout.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { metadata } from '../app/layout';
import { describe, it, expect } from '@jest/globals';

describe('Root layout', () => {
describe('metadata', () => {
Expand Down
5 changes: 3 additions & 2 deletions examples/with-nestjs/apps/web/test/page.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { render } from '@testing-library/react';
import { describe, it, expect, jest, afterAll } from '@jest/globals';

import RootPage from '../app/page';

window.fetch = jest.fn().mockImplementation(() =>
Promise.resolve({
ok: true,
json: () => [],
}),
})
);

describe('Root page', () => {
const { container, unmount } = render(
<RootPage params={{ forTest: true }} />,
<RootPage params={{ forTest: true }} />
);

it('should match the snapshot', () => {
Expand Down
25 changes: 9 additions & 16 deletions examples/with-nestjs/pnpm-lock.yaml

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

Loading

0 comments on commit 02749b3

Please sign in to comment.