Skip to content

Commit 771266d

Browse files
committed
test: type defs
1 parent 491dbe8 commit 771266d

File tree

6 files changed

+7
-40
lines changed

6 files changed

+7
-40
lines changed

packages/compass-web/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"depcheck": "depcheck",
5757
"check": "npm run typecheck && npm run lint && npm run depcheck",
5858
"check-ci": "npm run check",
59+
"pretest": "npm run test-types",
5960
"test": "mocha",
6061
"test-cov": "nyc --compact=false --produce-source-map=false -x \"**/*.spec.*\" --reporter=lcov --reporter=text --reporter=html npm run test",
6162
"test-watch": "npm run test -- --watch",

packages/compass-web/test/types/index.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/compass-web/test/types/index.test-d.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { expectType, expectError } from 'tsd';
1+
import { expectError } from 'tsd';
22
import { CompassWeb } from '@mongodb-js/compass-web';
33

44
// Test basic props structure
@@ -21,7 +21,7 @@ void CompassWeb({
2121
},
2222
});
2323

24-
// This should cause an error - optInDataExplorerGenAIFeatures is internal only
24+
// This should cause an error - optInDataExplorerGenAIFeatures is an old name
2525
expectError(
2626
CompassWeb({
2727
...basicProps,
@@ -30,9 +30,3 @@ expectError(
3030
},
3131
})
3232
);
33-
34-
// Test that built-in types are properly accessible (URL should be global)
35-
expectType<URL>(new URL('https://example.com'));
36-
37-
// Basic smoke test - if we can get here, the main types are working
38-
expectType<string>('test-success');

packages/compass-web/test/types/package.json

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
"private": true,
55
"description": "Test package to verify compass-web types work correctly for external consumers",
66
"scripts": {
7-
"test": "tsd",
8-
"install-compass-web": "npm pack ../../ && npm install *.tgz --save && rm *.tgz",
9-
"pretest": "npm run install-compass-web"
7+
"test": "tsd --typings ./node_modules/@mongodb-js/compass-web/dist/compass-web.d.ts --files ./*.test-d.ts"
108
},
119
"dependencies": {
12-
"@mongodb-js/compass-web": "file:mongodb-js-compass-web-0.20.1.tgz",
10+
"@mongodb-js/compass-web": "file:../../",
1311
"react": "^17.0.2",
1412
"react-dom": "^17.0.2"
1513
},
@@ -18,15 +16,5 @@
1816
"@types/react-dom": "^17.0.2",
1917
"tsd": "^0.31.0",
2018
"typescript": "^5.0.0"
21-
},
22-
"tsd": {
23-
"directory": ".",
24-
"compilerOptions": {
25-
"strict": false,
26-
"target": "esnext",
27-
"module": "commonjs",
28-
"moduleResolution": "node",
29-
"skipLibCheck": true
30-
}
3119
}
3220
}

packages/compass-web/test/types/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"skipLibCheck": true,
1010
"forceConsistentCasingInFileNames": true,
1111
"declaration": false,
12-
"noEmit": true
12+
"noEmit": true,
13+
"typeRoots": ["./node_modules/@types"]
1314
},
1415
"include": ["**/*.test-d.ts"]
1516
}

packages/compass-web/test/types/tsd.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)