diff --git a/spec-main/api-autoupdater-darwin-spec.ts b/spec-main/api-autoupdater-darwin-spec.ts index 9473e8a876db..81c40d9db1ad 100644 --- a/spec-main/api-autoupdater-darwin-spec.ts +++ b/spec-main/api-autoupdater-darwin-spec.ts @@ -9,7 +9,7 @@ import { AddressInfo } from 'net' const features = process.electronBinding('features') -const fixturesPath = path.resolve(__dirname, '../spec/fixtures') +const fixturesPath = path.resolve(__dirname, 'fixtures') // We can only test the auto updater on darwin non-component builds const describeFn = (process.platform === 'darwin' && !process.mas && !features.isComponentBuild() ? describe : describe.skip) diff --git a/spec-main/api-browser-view-spec.ts b/spec-main/api-browser-view-spec.ts index 88de67c4ca2f..50588b8725a0 100644 --- a/spec-main/api-browser-view-spec.ts +++ b/spec-main/api-browser-view-spec.ts @@ -224,7 +224,7 @@ describe('BrowserView module', () => { describe('new BrowserView()', () => { it('does not crash on exit', async () => { - const appPath = path.join(fixtures, 'api', 'leak-exit-browserview.js') + const appPath = path.join(__dirname, 'fixtures', 'api', 'leak-exit-browserview.js') const electronPath = process.execPath const appProcess = ChildProcess.spawn(electronPath, [appPath]) const [code] = await emittedOnce(appProcess, 'close') diff --git a/spec-main/api-browser-window-spec.ts b/spec-main/api-browser-window-spec.ts index 04606cacebb6..aca7c9735f0d 100644 --- a/spec-main/api-browser-window-spec.ts +++ b/spec-main/api-browser-window-spec.ts @@ -3603,7 +3603,7 @@ describe('BrowserWindow module', () => { }) it('throws errors for invalid manifest.json files', () => { - const badManifestExtensionPath = path.join(fixtures, 'devtools-extensions', 'bad-manifest') + const badManifestExtensionPath = path.join(__dirname, 'fixtures', 'devtools-extensions', 'bad-manifest') expect(() => { BrowserWindow.addDevToolsExtension(badManifestExtensionPath) }).to.throw(/Unexpected token }/) @@ -3614,7 +3614,7 @@ describe('BrowserWindow module', () => { const extensionName = 'foo' before(() => { - const extensionPath = path.join(fixtures, 'devtools-extensions', 'foo') + const extensionPath = path.join(__dirname, 'fixtures', 'devtools-extensions', 'foo') BrowserWindow.addDevToolsExtension(extensionPath) expect(BrowserWindow.getDevToolsExtensions()).to.have.property(extensionName) }) @@ -3707,7 +3707,7 @@ describe('BrowserWindow module', () => { } }) - const extensionPath = path.join(fixtures, 'devtools-extensions', 'foo') + const extensionPath = path.join(__dirname, 'fixtures', 'devtools-extensions', 'foo') BrowserWindow.addDevToolsExtension(extensionPath) try { showLastDevToolsPanel(w) @@ -3728,7 +3728,7 @@ describe('BrowserWindow module', () => { it('serializes the registered extensions on quit', () => { const extensionName = 'foo' - const extensionPath = path.join(fixtures, 'devtools-extensions', extensionName) + const extensionPath = path.join(__dirname, 'fixtures', 'devtools-extensions', extensionName) const serializedPath = path.join(app.getPath('userData'), 'DevTools Extensions') BrowserWindow.addDevToolsExtension(extensionPath) @@ -3749,7 +3749,7 @@ describe('BrowserWindow module', () => { it('throws errors for invalid manifest.json files', () => { expect(() => { - BrowserWindow.addExtension(path.join(fixtures, 'devtools-extensions', 'bad-manifest')) + BrowserWindow.addExtension(path.join(__dirname, 'fixtures', 'devtools-extensions', 'bad-manifest')) }).to.throw('Unexpected token }') }) }) diff --git a/spec-main/api-debugger-spec.ts b/spec-main/api-debugger-spec.ts index 2e5afd16e22d..c7f0b5e245d6 100644 --- a/spec-main/api-debugger-spec.ts +++ b/spec-main/api-debugger-spec.ts @@ -32,7 +32,7 @@ describe('debugger module', () => { expect(w.webContents.debugger.isAttached()).to.be.true() done() }) - w.webContents.loadFile(path.join(fixtures, 'pages', 'a.html')) + w.webContents.loadURL('about:blank') }) it('fails when protocol version is not supported', done => { @@ -134,7 +134,7 @@ describe('debugger module', () => { const url = process.platform !== 'win32' ? `file://${path.join(fixtures, 'pages', 'a.html')}` : `file:///${path.join(fixtures, 'pages', 'a.html').replace(/\\/g, '/')}` - w.webContents.loadFile(path.join(fixtures, 'pages', 'a.html')) + w.webContents.loadURL(url) try { w.webContents.debugger.attach() @@ -144,12 +144,16 @@ describe('debugger module', () => { w.webContents.debugger.on('message', (e, method, params) => { if (method === 'Console.messageAdded') { - expect(params.message.level).to.equal('log') - expect(params.message.url).to.equal(url) - expect(params.message.text).to.equal('a') - - w.webContents.debugger.detach() - done() + try { + expect(params.message.level).to.equal('log') + expect(params.message.url).to.equal(url) + expect(params.message.text).to.equal('a') + done() + } catch (e) { + done(e) + } finally { + w.webContents.debugger.detach() + } } }) w.webContents.debugger.sendCommand('Console.enable') diff --git a/spec-main/api-ipc-main-spec.ts b/spec-main/api-ipc-main-spec.ts index cf2265dee4f3..0da154e0c341 100644 --- a/spec-main/api-ipc-main-spec.ts +++ b/spec-main/api-ipc-main-spec.ts @@ -6,7 +6,7 @@ import { emittedOnce } from './events-helpers' import { ipcMain, BrowserWindow } from 'electron' describe('ipc main module', () => { - const fixtures = path.join(__dirname, '..', 'spec', 'fixtures') + const fixtures = path.join(__dirname, 'fixtures') afterEach(closeAllWindows) diff --git a/spec-main/api-protocol-spec.ts b/spec-main/api-protocol-spec.ts index 4ef988039020..46b3b0571d8b 100644 --- a/spec-main/api-protocol-spec.ts +++ b/spec-main/api-protocol-spec.ts @@ -82,7 +82,7 @@ describe('protocol module', () => { // Note that we need to do navigation every time after a protocol is // registered or unregistered, otherwise the new protocol won't be // recognized by current page when NetworkService is used. - await contents.loadFile(path.join(fixturesPath, 'pages', 'jquery.html')) + await contents.loadFile(path.join(__dirname, 'fixtures', 'pages', 'jquery.html')) return contents.executeJavaScript(`ajax("${url}", ${JSON.stringify(options)})`) } diff --git a/spec-main/api-web-request-spec.ts b/spec-main/api-web-request-spec.ts index 6cb29249672f..e17a52c30911 100644 --- a/spec-main/api-web-request-spec.ts +++ b/spec-main/api-web-request-spec.ts @@ -5,7 +5,7 @@ import * as path from 'path' import { session, WebContents, webContents } from 'electron' import { AddressInfo } from 'net' -const fixturesPath = path.resolve(__dirname, '..', 'spec', 'fixtures') +const fixturesPath = path.resolve(__dirname, 'fixtures') describe('webRequest module', () => { const ses = session.defaultSession diff --git a/spec-main/chromium-spec.ts b/spec-main/chromium-spec.ts index e7372ed27054..7c6a115a79b4 100644 --- a/spec-main/chromium-spec.ts +++ b/spec-main/chromium-spec.ts @@ -309,7 +309,7 @@ describe('chromium features', () => { const w = new BrowserWindow({ show: false }) w.webContents.once('did-finish-load', () => { done() }) w.webContents.once('crashed', () => done(new Error('WebContents crashed.'))) - w.loadFile(path.join(fixturesPath, 'pages', 'jquery.html')) + w.loadFile(path.join(__dirname, 'fixtures', 'pages', 'jquery.html')) }) }) diff --git a/spec-main/content-script-spec.ts b/spec-main/content-script-spec.ts index fafd3076d5b5..8e4c2051f97b 100644 --- a/spec-main/content-script-spec.ts +++ b/spec-main/content-script-spec.ts @@ -7,7 +7,7 @@ import { emittedNTimes } from './events-helpers' import { BrowserWindow, ipcMain, WebContents } from 'electron' describe('chrome extension content scripts', () => { - const fixtures = path.resolve(__dirname, '..', 'spec', 'fixtures') + const fixtures = path.resolve(__dirname, 'fixtures') const extensionPath = path.resolve(fixtures, 'extensions') const addExtension = (name: string) => BrowserWindow.addExtension(path.resolve(extensionPath, name)) diff --git a/spec-main/extensions-spec.ts b/spec-main/extensions-spec.ts index b1822fc50538..dcb2f6db8ce8 100644 --- a/spec-main/extensions-spec.ts +++ b/spec-main/extensions-spec.ts @@ -91,7 +91,7 @@ ifdescribe(process.electronBinding('features').isExtensionsEnabled())('chrome ex }) ifdescribe(!process.electronBinding('features').isExtensionsEnabled())('chrome extensions', () => { - const fixtures = path.resolve(__dirname, '..', 'spec', 'fixtures') + const fixtures = path.resolve(__dirname, 'fixtures') let w: BrowserWindow before(() => { diff --git a/spec/fixtures/api/ipc-main-listeners/main.js b/spec-main/fixtures/api/ipc-main-listeners/main.js similarity index 100% rename from spec/fixtures/api/ipc-main-listeners/main.js rename to spec-main/fixtures/api/ipc-main-listeners/main.js diff --git a/spec/fixtures/api/ipc-main-listeners/package.json b/spec-main/fixtures/api/ipc-main-listeners/package.json similarity index 100% rename from spec/fixtures/api/ipc-main-listeners/package.json rename to spec-main/fixtures/api/ipc-main-listeners/package.json diff --git a/spec/fixtures/api/leak-exit-browserview.js b/spec-main/fixtures/api/leak-exit-browserview.js similarity index 100% rename from spec/fixtures/api/leak-exit-browserview.js rename to spec-main/fixtures/api/leak-exit-browserview.js diff --git a/spec/fixtures/api/send-sync-message.html b/spec-main/fixtures/api/send-sync-message.html similarity index 100% rename from spec/fixtures/api/send-sync-message.html rename to spec-main/fixtures/api/send-sync-message.html diff --git a/spec/fixtures/auto-update/check/index.js b/spec-main/fixtures/auto-update/check/index.js similarity index 100% rename from spec/fixtures/auto-update/check/index.js rename to spec-main/fixtures/auto-update/check/index.js diff --git a/spec/fixtures/auto-update/check/package.json b/spec-main/fixtures/auto-update/check/package.json similarity index 100% rename from spec/fixtures/auto-update/check/package.json rename to spec-main/fixtures/auto-update/check/package.json diff --git a/spec/fixtures/auto-update/initial/index.js b/spec-main/fixtures/auto-update/initial/index.js similarity index 100% rename from spec/fixtures/auto-update/initial/index.js rename to spec-main/fixtures/auto-update/initial/index.js diff --git a/spec/fixtures/auto-update/initial/package.json b/spec-main/fixtures/auto-update/initial/package.json similarity index 100% rename from spec/fixtures/auto-update/initial/package.json rename to spec-main/fixtures/auto-update/initial/package.json diff --git a/spec/fixtures/auto-update/update/index.js b/spec-main/fixtures/auto-update/update/index.js similarity index 100% rename from spec/fixtures/auto-update/update/index.js rename to spec-main/fixtures/auto-update/update/index.js diff --git a/spec/fixtures/auto-update/update/package.json b/spec-main/fixtures/auto-update/update/package.json similarity index 100% rename from spec/fixtures/auto-update/update/package.json rename to spec-main/fixtures/auto-update/update/package.json diff --git a/spec/fixtures/devtools-extensions/bad-manifest/manifest.json b/spec-main/fixtures/devtools-extensions/bad-manifest/manifest.json similarity index 100% rename from spec/fixtures/devtools-extensions/bad-manifest/manifest.json rename to spec-main/fixtures/devtools-extensions/bad-manifest/manifest.json diff --git a/spec/fixtures/devtools-extensions/foo/_locales/en/messages.json b/spec-main/fixtures/devtools-extensions/foo/_locales/en/messages.json similarity index 100% rename from spec/fixtures/devtools-extensions/foo/_locales/en/messages.json rename to spec-main/fixtures/devtools-extensions/foo/_locales/en/messages.json diff --git a/spec/fixtures/devtools-extensions/foo/foo.html b/spec-main/fixtures/devtools-extensions/foo/foo.html similarity index 100% rename from spec/fixtures/devtools-extensions/foo/foo.html rename to spec-main/fixtures/devtools-extensions/foo/foo.html diff --git a/spec/fixtures/devtools-extensions/foo/index.html b/spec-main/fixtures/devtools-extensions/foo/index.html similarity index 100% rename from spec/fixtures/devtools-extensions/foo/index.html rename to spec-main/fixtures/devtools-extensions/foo/index.html diff --git a/spec/fixtures/devtools-extensions/foo/manifest.json b/spec-main/fixtures/devtools-extensions/foo/manifest.json similarity index 100% rename from spec/fixtures/devtools-extensions/foo/manifest.json rename to spec-main/fixtures/devtools-extensions/foo/manifest.json diff --git a/spec/fixtures/extensions/chrome-api/background.js b/spec-main/fixtures/extensions/chrome-api/background.js similarity index 100% rename from spec/fixtures/extensions/chrome-api/background.js rename to spec-main/fixtures/extensions/chrome-api/background.js diff --git a/spec/fixtures/extensions/chrome-api/main.js b/spec-main/fixtures/extensions/chrome-api/main.js similarity index 100% rename from spec/fixtures/extensions/chrome-api/main.js rename to spec-main/fixtures/extensions/chrome-api/main.js diff --git a/spec/fixtures/extensions/chrome-api/manifest.json b/spec-main/fixtures/extensions/chrome-api/manifest.json similarity index 100% rename from spec/fixtures/extensions/chrome-api/manifest.json rename to spec-main/fixtures/extensions/chrome-api/manifest.json diff --git a/spec/fixtures/extensions/content-script-document-end/end.js b/spec-main/fixtures/extensions/content-script-document-end/end.js similarity index 100% rename from spec/fixtures/extensions/content-script-document-end/end.js rename to spec-main/fixtures/extensions/content-script-document-end/end.js diff --git a/spec/fixtures/extensions/content-script-document-end/manifest.json b/spec-main/fixtures/extensions/content-script-document-end/manifest.json similarity index 100% rename from spec/fixtures/extensions/content-script-document-end/manifest.json rename to spec-main/fixtures/extensions/content-script-document-end/manifest.json diff --git a/spec/fixtures/extensions/content-script-document-idle/idle.js b/spec-main/fixtures/extensions/content-script-document-idle/idle.js similarity index 100% rename from spec/fixtures/extensions/content-script-document-idle/idle.js rename to spec-main/fixtures/extensions/content-script-document-idle/idle.js diff --git a/spec/fixtures/extensions/content-script-document-idle/manifest.json b/spec-main/fixtures/extensions/content-script-document-idle/manifest.json similarity index 100% rename from spec/fixtures/extensions/content-script-document-idle/manifest.json rename to spec-main/fixtures/extensions/content-script-document-idle/manifest.json diff --git a/spec/fixtures/extensions/content-script-document-start/manifest.json b/spec-main/fixtures/extensions/content-script-document-start/manifest.json similarity index 100% rename from spec/fixtures/extensions/content-script-document-start/manifest.json rename to spec-main/fixtures/extensions/content-script-document-start/manifest.json diff --git a/spec/fixtures/extensions/content-script-document-start/start.js b/spec-main/fixtures/extensions/content-script-document-start/start.js similarity index 100% rename from spec/fixtures/extensions/content-script-document-start/start.js rename to spec-main/fixtures/extensions/content-script-document-start/start.js diff --git a/spec/fixtures/extensions/content-script/all_frames-disabled.css b/spec-main/fixtures/extensions/content-script/all_frames-disabled.css similarity index 100% rename from spec/fixtures/extensions/content-script/all_frames-disabled.css rename to spec-main/fixtures/extensions/content-script/all_frames-disabled.css diff --git a/spec/fixtures/extensions/content-script/all_frames-enabled.css b/spec-main/fixtures/extensions/content-script/all_frames-enabled.css similarity index 100% rename from spec/fixtures/extensions/content-script/all_frames-enabled.css rename to spec-main/fixtures/extensions/content-script/all_frames-enabled.css diff --git a/spec/fixtures/extensions/content-script/all_frames-preload.js b/spec-main/fixtures/extensions/content-script/all_frames-preload.js similarity index 100% rename from spec/fixtures/extensions/content-script/all_frames-preload.js rename to spec-main/fixtures/extensions/content-script/all_frames-preload.js diff --git a/spec/fixtures/extensions/content-script/frame-with-frame.html b/spec-main/fixtures/extensions/content-script/frame-with-frame.html similarity index 100% rename from spec/fixtures/extensions/content-script/frame-with-frame.html rename to spec-main/fixtures/extensions/content-script/frame-with-frame.html diff --git a/spec/fixtures/extensions/content-script/frame.html b/spec-main/fixtures/extensions/content-script/frame.html similarity index 100% rename from spec/fixtures/extensions/content-script/frame.html rename to spec-main/fixtures/extensions/content-script/frame.html diff --git a/spec/fixtures/extensions/content-script/manifest.json b/spec-main/fixtures/extensions/content-script/manifest.json similarity index 100% rename from spec/fixtures/extensions/content-script/manifest.json rename to spec-main/fixtures/extensions/content-script/manifest.json diff --git a/spec/fixtures/pages/jquery.html b/spec-main/fixtures/pages/jquery.html similarity index 87% rename from spec/fixtures/pages/jquery.html rename to spec-main/fixtures/pages/jquery.html index 079522866a1f..6ea176ae0971 100644 --- a/spec/fixtures/pages/jquery.html +++ b/spec-main/fixtures/pages/jquery.html @@ -1,6 +1,6 @@
- +