From d63caa54cef1ba618cc0e4b0943a06b4f29bdb6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Szabo?= Date: Sat, 27 May 2023 00:38:15 -0300 Subject: [PATCH] Appending pulsar.api service --- src/initialize-application-window.js | 2 +- src/initialize-new-test-window.js | 10 +++++----- src/initialize-test-window.js | 4 +--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/initialize-application-window.js b/src/initialize-application-window.js index 80e266653..c7278c0c8 100644 --- a/src/initialize-application-window.js +++ b/src/initialize-application-window.js @@ -32,7 +32,7 @@ module.exports = function({ blobStore }) { const { ipcRenderer } = require('electron'); const { resourcePath, devMode } = getWindowLoadSettings(); require('./electron-shims'); - addAtomExport(); + addAtomExport(global.atom); // Make React faster if (!devMode && process.env.NODE_ENV == null) { diff --git a/src/initialize-new-test-window.js b/src/initialize-new-test-window.js index 30189c974..7bb8ccf42 100644 --- a/src/initialize-new-test-window.js +++ b/src/initialize-new-test-window.js @@ -9,8 +9,6 @@ module.exports = async function({ blobStore, globalAtom }) { const { remote } = require('electron'); const getWindowLoadSettings = require('./get-window-load-settings'); - console.log("WATTT????") - const exitWithStatusCode = function(status) { remote.app.emit('will-quit'); remote.process.exit(status); @@ -84,9 +82,6 @@ module.exports = async function({ blobStore, globalAtom }) { window.addEventListener('keydown', handleKeydown, { capture: true }); - addAtomExport(); - updateProcessEnv(env); - // Set up optional transpilation for packages under test if any const FindParentDir = require('find-parent-dir'); const packageRoot = FindParentDir.sync(testPaths[0], 'package.json'); @@ -134,6 +129,11 @@ module.exports = async function({ blobStore, globalAtom }) { applicationDelegate, window, document, configDirPath: process.env.ATOM_HOME }) + addAtomExport(window.atom); + updateProcessEnv(env); + atom.packages.serviceHub.provide('pulsar.api', '0.1.0', { + moduleName: '@pulsar/test', exports: require('./mocha-test-runner/helpers') + }) // Set load paths for the package's test runner let loadPaths = vm.runInThisContext('module.paths') diff --git a/src/initialize-test-window.js b/src/initialize-test-window.js index 01f65ac60..c1c2e008f 100644 --- a/src/initialize-test-window.js +++ b/src/initialize-test-window.js @@ -87,9 +87,7 @@ module.exports = async function({ blobStore }) { window.addEventListener('keydown', handleKeydown, { capture: true }); - // Add 'exports' to module search path. - addAtomExport(); - + addAtomExport(atom); updateProcessEnv(env); // Set up optional transpilation for packages under test if any