@@ -57,9 +57,17 @@ export async function copyFileToTempDir(fileToCopyPath) {
5757 return copyFileToDir ( fileToCopyPath , tempFixtureDir )
5858}
5959
60- async function getNotification ( expectedMessage ) {
61- return new Promise ( ( resolve ) => {
60+ /**
61+ * @param {string } expectedMessage
62+ * @returns {Promise<import("atom").Notification> }
63+ */
64+ function getNotification ( expectedMessage ) {
65+ return new Promise ( ( resolve , reject ) => {
66+ /** @type {import("atom").Disposable | undefined } */
6267 let notificationSub
68+ /**
69+ * @param {Promise<import("atom").Notification> } notification
70+ */
6371 const newNotification = ( notification ) => {
6472 if ( notification . getMessage ( ) !== expectedMessage ) {
6573 // As the specs execute asynchronously, it's possible a notification
@@ -68,8 +76,12 @@ async function getNotification(expectedMessage) {
6876 return
6977 }
7078 // Dispose of the notification subscription
71- notificationSub . dispose ( )
72- resolve ( notification )
79+ if ( notificationSub !== undefined ) {
80+ notificationSub . dispose ( )
81+ resolve ( notification )
82+ } else {
83+ reject ( )
84+ }
7385 }
7486 // Subscribe to Atom's notifications
7587 notificationSub = atom . notifications . onDidAddNotification ( newNotification )
@@ -81,6 +93,7 @@ async function getNotification(expectedMessage) {
8193 * @returns {Promise<void> }
8294 */
8395async function makeFixes ( textEditor ) {
96+ /** @type {Promise<void> } */
8497 const editorReloadPromise = new Promise ( ( resolve ) => {
8598 // Subscribe to file reload events
8699 const editorReloadSubscription = textEditor . getBuffer ( ) . onDidReload ( ( ) => {
0 commit comments