build: update to standard 14 (#24479)

This commit is contained in:
Samuel Attard
2020-07-09 10:18:49 -07:00
committed by GitHub
parent 9bd0fc5348
commit eb6616e4e9
37 changed files with 495 additions and 665 deletions

View File

@@ -1007,7 +1007,7 @@ describe('BrowserWindow module', () => {
});
});
ifdescribe(process.platform === 'win32')(`Fullscreen state`, () => {
ifdescribe(process.platform === 'win32')('Fullscreen state', () => {
it('with properties', () => {
it('can be set with the fullscreen constructor option', () => {
w = new BrowserWindow({ fullscreen: true });
@@ -1021,7 +1021,7 @@ describe('BrowserWindow module', () => {
expect(w.fullScreen).to.be.true();
});
it(`checks normal bounds when fullscreen'ed`, async () => {
it('checks normal bounds when fullscreen\'ed', async () => {
const bounds = w.getBounds();
const enterFullScreen = emittedOnce(w, 'enter-full-screen');
w.show();
@@ -1030,7 +1030,7 @@ describe('BrowserWindow module', () => {
expectBoundsEqual(w.getNormalBounds(), bounds);
});
it(`checks normal bounds when unfullscreen'ed`, async () => {
it('checks normal bounds when unfullscreen\'ed', async () => {
const bounds = w.getBounds();
w.once('enter-full-screen', () => {
w.fullScreen = false;
@@ -1056,7 +1056,7 @@ describe('BrowserWindow module', () => {
expect(w.isFullScreen()).to.be.true();
});
it(`checks normal bounds when fullscreen'ed`, async () => {
it('checks normal bounds when fullscreen\'ed', async () => {
const bounds = w.getBounds();
w.show();
@@ -1067,7 +1067,7 @@ describe('BrowserWindow module', () => {
expectBoundsEqual(w.getNormalBounds(), bounds);
});
it(`checks normal bounds when unfullscreen'ed`, async () => {
it('checks normal bounds when unfullscreen\'ed', async () => {
const bounds = w.getBounds();
w.show();

View File

@@ -203,7 +203,7 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.env.DISABLE_CRASH_REPORTER_
require('electron').crashReporter.start({
submitURL: `http://127.0.0.1:${port}`,
ignoreSystemCrashHandler: true,
extra: { 'longParam': 'a'.repeat(130) }
extra: { longParam: 'a'.repeat(130) }
});
setTimeout(() => process.crash());
}, port);
@@ -381,7 +381,7 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.env.DISABLE_CRASH_REPORTER_
await remotely(() => {
require('electron').crashReporter.start({
submitURL: 'http://127.0.0.1',
extra: { 'extra1': 'hi' }
extra: { extra1: 'hi' }
});
});
const parameters = await remotely(() => require('electron').crashReporter.getParameters());
@@ -414,8 +414,8 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.env.DISABLE_CRASH_REPORTER_
crashReporter.start({ submitURL: 'http://' });
const bw = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true } });
bw.loadURL('about:blank');
await bw.webContents.executeJavaScript(`require('electron').crashReporter.addExtraParameter('hello', 'world')`);
return bw.webContents.executeJavaScript(`require('electron').crashReporter.getParameters()`);
await bw.webContents.executeJavaScript('require(\'electron\').crashReporter.addExtraParameter(\'hello\', \'world\')');
return bw.webContents.executeJavaScript('require(\'electron\').crashReporter.getParameters()');
});
if (process.platform === 'linux') {
// On Linux, 'getParameters' will also include the global parameters,

View File

@@ -523,7 +523,7 @@ describe('net module', () => {
session: sess
});
const response = await getResponse(urlRequest);
expect(response.headers['x-cookie']).to.equal(`undefined`);
expect(response.headers['x-cookie']).to.equal('undefined');
});
it('should be able to use the sessions cookie store', async () => {

View File

@@ -105,7 +105,7 @@ describe('session module', () => {
});
}
it(`fails to set cookies with samesite=garbage`, async () => {
it('fails to set cookies with samesite=garbage', async () => {
const { cookies } = session.defaultSession;
const value = 'hithere';
await expect(cookies.set({ url, value, sameSite: 'garbage' as any })).to.eventually.be.rejectedWith('Failed to convert \'garbage\' to an appropriate cookie same site value');

View File

@@ -1905,7 +1905,7 @@ describe('webContents module', () => {
wasCalled = true;
});
await w.loadURL('about:blank');
await w.webContents.executeJavaScript(`window.open('about:blank')`);
await w.webContents.executeJavaScript('window.open(\'about:blank\')');
await new Promise((resolve) => { process.nextTick(resolve); });
expect(wasCalled).to.equal(false);
await closeAllWindows();

View File

@@ -274,7 +274,7 @@ describe('chrome extensions', () => {
await customSession.loadExtension(path.join(fixtures, 'extensions', 'persistent-background-page'));
const w = new BrowserWindow({ show: false, webPreferences: { session: customSession } });
const promise = emittedOnce(app, 'web-contents-created');
await w.loadURL(`about:blank`);
await w.loadURL('about:blank');
const [, bgPageContents] = await promise;
expect(bgPageContents.session).to.not.equal(undefined);
});

View File

@@ -31,7 +31,7 @@ class GitFake {
// find the newest shared commit between branches a and b
mergeBase (a: string, b:string): string {
for (const commit of [ ...this.branches[a].reverse() ]) {
for (const commit of [...this.branches[a].reverse()]) {
if (this.branches[b].map((commit: Commit) => commit.sha1).includes(commit.sha1)) {
return commit.sha1;
}
@@ -57,7 +57,7 @@ class GitFake {
stdout = this.branches[branch].map((commit: Commit) => commit.sha1).join('\n');
} else if (args.length > 1 && args[0] === 'log' && args.includes('--format=%H,%s')) {
// expected form: `git log --format=%H,%s sha1..branchName
const [ start, branch ] = args[args.length - 1].split('..');
const [start, branch] = args[args.length - 1].split('..');
const lines : string[] = [];
let started = false;
for (const commit of this.branches[branch]) {
@@ -108,7 +108,7 @@ describe('release notes', () => {
const wrapper = (args: string[], path: string, options?: IGitExecutionOptions | undefined) => gitFake.exec(args, path, options);
sandbox.replace(GitProcess, 'exec', wrapper);
gitFake.setBranch(oldBranch, [ ...sharedHistory, oldFix ]);
gitFake.setBranch(oldBranch, [...sharedHistory, oldFix]);
});
afterEach(() => {
@@ -120,8 +120,8 @@ describe('release notes', () => {
// while oldBranch was the latest stable release
it('are skipped if the target version is a new major line (x.0.0)', async function () {
const version = 'v9.0.0';
gitFake.setBranch(oldBranch, [ ...sharedHistory, oldTropFix ]);
gitFake.setBranch(newBranch, [ ...sharedHistory, newTropFix ]);
gitFake.setBranch(oldBranch, [...sharedHistory, oldTropFix]);
gitFake.setBranch(newBranch, [...sharedHistory, newTropFix]);
const results: any = await notes.get(oldBranch, newBranch, version);
expect(results.fix).to.have.lengthOf(0);
});
@@ -130,8 +130,8 @@ describe('release notes', () => {
// multiple stable branches at once, including newBranch.
it('are included if the target version is a minor or patch bump', async function () {
const version = 'v9.0.1';
gitFake.setBranch(oldBranch, [ ...sharedHistory, oldTropFix ]);
gitFake.setBranch(newBranch, [ ...sharedHistory, newTropFix ]);
gitFake.setBranch(oldBranch, [...sharedHistory, oldTropFix]);
gitFake.setBranch(newBranch, [...sharedHistory, newTropFix]);
const results: any = await notes.get(oldBranch, newBranch, version);
expect(results.fix).to.have.lengthOf(1);
});
@@ -146,7 +146,7 @@ describe('release notes', () => {
const testCommit = new Commit('89eb309d0b22bd4aec058ffaf983e81e56a5c378', 'feat: lole u got troled hard (#21891)');
const version = 'v9.0.0';
gitFake.setBranch(newBranch, [ ...sharedHistory, testCommit ]);
gitFake.setBranch(newBranch, [...sharedHistory, testCommit]);
const results: any = await notes.get(oldBranch, newBranch, version);
expect(results.feat).to.have.lengthOf(1);
expect(results.feat[0].hash).to.equal(testCommit.sha1);
@@ -160,7 +160,7 @@ describe('release notes', () => {
it("honors 'feat' type", async function () {
const testCommit = newFeat;
gitFake.setBranch(newBranch, [ ...sharedHistory, testCommit ]);
gitFake.setBranch(newBranch, [...sharedHistory, testCommit]);
const results: any = await notes.get(oldBranch, newBranch, version);
expect(results.feat).to.have.lengthOf(1);
expect(results.feat[0].hash).to.equal(testCommit.sha1);
@@ -168,7 +168,7 @@ describe('release notes', () => {
it("honors 'fix' type", async function () {
const testCommit = newFix;
gitFake.setBranch(newBranch, [ ...sharedHistory, testCommit ]);
gitFake.setBranch(newBranch, [...sharedHistory, testCommit]);
const results: any = await notes.get(oldBranch, newBranch, version);
expect(results.fix).to.have.lengthOf(1);
expect(results.fix[0].hash).to.equal(testCommit.sha1);
@@ -176,7 +176,7 @@ describe('release notes', () => {
it("honors 'BREAKING CHANGE' message", async function () {
const testCommit = newBreaking;
gitFake.setBranch(newBranch, [ ...sharedHistory, testCommit ]);
gitFake.setBranch(newBranch, [...sharedHistory, testCommit]);
const results: any = await notes.get(oldBranch, newBranch, version);
expect(results.breaking).to.have.lengthOf(1);
expect(results.breaking[0].hash).to.equal(testCommit.sha1);

View File

@@ -38,106 +38,106 @@ function ToWebM (frames, outputAsArray) {
const EBML = [
{
'id': 0x1a45dfa3, // EBML
'data': [
id: 0x1a45dfa3, // EBML
data: [
{
'data': 1,
'id': 0x4286 // EBMLVersion
data: 1,
id: 0x4286 // EBMLVersion
},
{
'data': 1,
'id': 0x42f7 // EBMLReadVersion
data: 1,
id: 0x42f7 // EBMLReadVersion
},
{
'data': 4,
'id': 0x42f2 // EBMLMaxIDLength
data: 4,
id: 0x42f2 // EBMLMaxIDLength
},
{
'data': 8,
'id': 0x42f3 // EBMLMaxSizeLength
data: 8,
id: 0x42f3 // EBMLMaxSizeLength
},
{
'data': 'webm',
'id': 0x4282 // DocType
data: 'webm',
id: 0x4282 // DocType
},
{
'data': 2,
'id': 0x4287 // DocTypeVersion
data: 2,
id: 0x4287 // DocTypeVersion
},
{
'data': 2,
'id': 0x4285 // DocTypeReadVersion
data: 2,
id: 0x4285 // DocTypeReadVersion
}
]
},
{
'id': 0x18538067, // Segment
'data': [
id: 0x18538067, // Segment
data: [
{
'id': 0x1549a966, // Info
'data': [
id: 0x1549a966, // Info
data: [
{
'data': 1e6, // do things in millisecs (num of nanosecs for duration scale)
'id': 0x2ad7b1 // TimecodeScale
data: 1e6, // do things in millisecs (num of nanosecs for duration scale)
id: 0x2ad7b1 // TimecodeScale
},
{
'data': 'whammy',
'id': 0x4d80 // MuxingApp
data: 'whammy',
id: 0x4d80 // MuxingApp
},
{
'data': 'whammy',
'id': 0x5741 // WritingApp
data: 'whammy',
id: 0x5741 // WritingApp
},
{
'data': doubleToString(info.duration),
'id': 0x4489 // Duration
data: doubleToString(info.duration),
id: 0x4489 // Duration
}
]
},
{
'id': 0x1654ae6b, // Tracks
'data': [
id: 0x1654ae6b, // Tracks
data: [
{
'id': 0xae, // TrackEntry
'data': [
id: 0xae, // TrackEntry
data: [
{
'data': 1,
'id': 0xd7 // TrackNumber
data: 1,
id: 0xd7 // TrackNumber
},
{
'data': 1,
'id': 0x73c5 // TrackUID
data: 1,
id: 0x73c5 // TrackUID
},
{
'data': 0,
'id': 0x9c // FlagLacing
data: 0,
id: 0x9c // FlagLacing
},
{
'data': 'und',
'id': 0x22b59c // Language
data: 'und',
id: 0x22b59c // Language
},
{
'data': 'V_VP8',
'id': 0x86 // CodecID
data: 'V_VP8',
id: 0x86 // CodecID
},
{
'data': 'VP8',
'id': 0x258688 // CodecName
data: 'VP8',
id: 0x258688 // CodecName
},
{
'data': 1,
'id': 0x83 // TrackType
data: 1,
id: 0x83 // TrackType
},
{
'id': 0xe0, // Video
'data': [
id: 0xe0, // Video
data: [
{
'data': info.width,
'id': 0xb0 // PixelWidth
data: info.width,
id: 0xb0 // PixelWidth
},
{
'data': info.height,
'id': 0xba // PixelHeight
data: info.height,
id: 0xba // PixelHeight
}
]
}
@@ -146,8 +146,8 @@ function ToWebM (frames, outputAsArray) {
]
},
{
'id': 0x1c53bb6b, // Cues
'data': [
id: 0x1c53bb6b, // Cues
data: [
// cue insertion point
]
}
@@ -165,23 +165,23 @@ function ToWebM (frames, outputAsArray) {
let clusterTimecode = 0;
while (frameNumber < frames.length) {
const cuePoint = {
'id': 0xbb, // CuePoint
'data': [
id: 0xbb, // CuePoint
data: [
{
'data': Math.round(clusterTimecode),
'id': 0xb3 // CueTime
data: Math.round(clusterTimecode),
id: 0xb3 // CueTime
},
{
'id': 0xb7, // CueTrackPositions
'data': [
id: 0xb7, // CueTrackPositions
data: [
{
'data': 1,
'id': 0xf7 // CueTrack
data: 1,
id: 0xf7 // CueTrack
},
{
'data': 0, // to be filled in when we know it
'size': 8,
'id': 0xf1 // CueClusterPosition
data: 0, // to be filled in when we know it
size: 8,
id: 0xf1 // CueClusterPosition
}
]
}
@@ -200,11 +200,11 @@ function ToWebM (frames, outputAsArray) {
let clusterCounter = 0;
const cluster = {
'id': 0x1f43b675, // Cluster
'data': [
id: 0x1f43b675, // Cluster
data: [
{
'data': Math.round(clusterTimecode),
'id': 0xe7 // Timecode
data: Math.round(clusterTimecode),
id: 0xe7 // Timecode
}
].concat(clusterFrames.map(function (webp) {
const block = makeSimpleBlock({