refactor: use node scheme imports in spec (#38487)

Co-authored-by: Milan Burda <miburda@microsoft.com>
This commit is contained in:
Milan Burda 2023-06-15 16:42:27 +02:00 committed by GitHub
parent bf1ba4a857
commit d78f37ec8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
105 changed files with 533 additions and 352 deletions

View file

@ -3,7 +3,7 @@
* with events in async/await manner.
*/
import { on } from 'events';
import { on } from 'node:events';
export const emittedNTimes = async (emitter: NodeJS.EventEmitter, eventName: string, times: number, trigger?: () => void) => {
const events: any[][] = [];

View file

@ -1,5 +1,5 @@
import * as path from 'path';
import * as fs from 'fs';
import * as path from 'node:path';
import * as fs from 'node:fs';
import { screen, desktopCapturer, NativeImage } from 'electron';
const fixtures = path.resolve(__dirname, '..', 'fixtures');

View file

@ -1,10 +1,10 @@
import * as childProcess from 'child_process';
import * as path from 'path';
import * as http from 'http';
import * as https from 'https';
import * as net from 'net';
import * as v8 from 'v8';
import * as url from 'url';
import * as childProcess from 'node:child_process';
import * as path from 'node:path';
import * as http from 'node:http';
import * as https from 'node:https';
import * as net from 'node:net';
import * as v8 from 'node:v8';
import * as url from 'node:url';
import { SuiteFunction, TestFunction } from 'mocha';
import { BrowserWindow } from 'electron/main';
import { AssertionError } from 'chai';
@ -181,7 +181,7 @@ export async function itremote (name: string, fn: Function, args?: any[]) {
const { ok, message } = await w.webContents.executeJavaScript(`(async () => {
try {
const chai_1 = require('chai')
const promises_1 = require('timers/promises')
const promises_1 = require('node:timers/promises')
chai_1.use(require('chai-as-promised'))
chai_1.use(require('dirty-chai'))
await (${fn})(...${JSON.stringify(args ?? [])})

View file

@ -1,6 +1,6 @@
import { expect } from 'chai';
import { BrowserWindow } from 'electron/main';
import { once } from 'events';
import { once } from 'node:events';
async function ensureWindowIsClosed (window: BrowserWindow | null) {
if (window && !window.isDestroyed()) {