-
Notifications
You must be signed in to change notification settings - Fork 229
feat(smoke-tests): test auto-updating from the version of Compass that was just packaged COMPASS-8536 #6629
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
Conversation
c9c0779
to
de07d7f
Compare
5825ff0
to
ff54824
Compare
ff54824
to
6b2148a
Compare
b920717
to
b0f06a8
Compare
"lib": ["ES2021"], | ||
"module": "NodeNext", | ||
"paths": { | ||
"compass-mongodb-com": ["./src/compass-mongodb-com.d.ts"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed for ts-node https://github.com/TypeStrong/ts-node?tab=readme-ov-file#missing-types
@@ -3,7 +3,11 @@ | |||
"compilerOptions": { | |||
"noEmit": true, | |||
"types": ["node"], | |||
"lib": ["ES2021"] | |||
"lib": ["ES2021"], | |||
"module": "NodeNext", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed so that typescript doesn't compile the dynamic import to a require and then complain that we're require()-ing an ES module.
b0f06a8
to
86eca0d
Compare
} | ||
|
||
// run the app and wait for it to auto-update | ||
console.log('starting compass the first time'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have another branch open where I'm switching from console.log to debug. I don't want to conflict with that now, so will fix all these together in a future PR.
@@ -24,7 +24,7 @@ | |||
"eslint": "eslint", | |||
"prettier": "prettier", | |||
"lint": "npm run eslint . && npm run prettier -- --check .", | |||
"depcheck": "compass-scripts check-peer-deps && depcheck", | |||
"depcheck": "depcheck", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😬 If this doesn't handle optionalDependencies
, we should probably add a ticket tracking a fix for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's for compass plugins, though. Which is probably why it is a separate script and not part of depcheck.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll ask @gribnoysup what he thinks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking this rather than npm link, removing it as a peer dep.
5926b93
try { | ||
return (await import('compass-mongodb-com')).default; | ||
} catch (err: unknown) { | ||
console.log('Remember to npm link compass-mongodb-com'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you really want to ... you could throw a new Error
and pass err
as a cause
in the second argument of the Error
constructor, but ... then we would have to update the logic printing the error to print any cause
as well 😀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful 🦋
5926b93
to
c95a39c
Compare
Replaces #6608
This changes the smoketest script's interface slightly. There is now a
--tests
parameter so you can tell it which smoketest you want to run. Options are currently'time-to-first-query'
and'auto-update-from'
. Soon we'll add'auto-update-to'
. An'install-only'
might be useful too for when you're just working on an installer.The benefit here is that we can control the exception where mac doesn't auto-update (just run a different test) from CI while still testing it locally.
So you can run it like:
We now also use the real compass-mongodb-com update server. In CI it gets checked out next to
compass
. This is likely where you'd have it during development anyway. Wenpm link
it into the codebase (it is an optional peer dependency) and then dynamically import it if you run the auto-update server. The import error is caught, it logs a helpful hint that you need to npm link it and rethrows the error. Since it is a dynamic import you only need this if you're running the'auto-update-from'
test.