Skip to content

Commit

Permalink
remove dependency on mocha from memory tests (#12320)
Browse files Browse the repository at this point in the history
  • Loading branch information
phryneas authored Jan 29, 2025
1 parent b69d07b commit 2a62324
Show file tree
Hide file tree
Showing 4 changed files with 179 additions and 6 deletions.
162 changes: 162 additions & 0 deletions scripts/memory/package-lock.json

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

5 changes: 1 addition & 4 deletions scripts/memory/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@
"name": "apollo-client-memory-tests",
"private": true,
"scripts": {
"test": "mocha --exit -n expose-gc tests.js"
"test": "node --expose-gc --test tests.cts"
},
"dependencies": {
"@apollo/client": "file:../../dist",
"graphql": "^16.0.0"
},
"devDependencies": {
"mocha": "11.0.1"
}
}
6 changes: 4 additions & 2 deletions scripts/memory/tests.js → scripts/memory/tests.cts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const assert = require("assert");
const assert = require("node:assert");
const { describe, it } = require("node:test");

const {
ApolloClient,
InMemoryCache,
Expand Down Expand Up @@ -318,7 +320,7 @@ describe("garbage collection", () => {
assert.strictEqual(typeof getDataFromTree, "function");

const expectedKeys = new Set(["cache", "queryInfo1"]);
const renderPromisesSet = new Set();
const renderPromisesSet = new Set<any>();
const registry = makeRegistry((key) => {
// By retaining the RenderPromises object in a Set in the scope of
// this callback function, we artificially ensure the RenderPromises
Expand Down
12 changes: 12 additions & 0 deletions scripts/memory/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"target": "esnext",
"module": "nodenext",
"allowJs": true,
"noEmit": true,
"allowImportingTsExtensions": true,
"rewriteRelativeImportExtensions": true,
"verbatimModuleSyntax": true,
"resolveJsonModule": true
}
}

0 comments on commit 2a62324

Please sign in to comment.