Skip to content

Commit 19c763b

Browse files
authored
test: use 120s timeout globally (#1820)
1 parent 5e001f6 commit 19c763b

File tree

3 files changed

+28
-37
lines changed

3 files changed

+28
-37
lines changed

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,6 @@
9797
"bundler",
9898
"app"
9999
],
100-
"ava": {
101-
"timeout": "120s"
102-
},
103100
"funding": {
104101
"url": "https://github.com/electron/packager?sponsor=1"
105102
},

test/packager.spec.ts

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -125,37 +125,33 @@ describe('packager', () => {
125125
);
126126
});
127127

128-
it(
129-
'can overwrite older packages',
130-
{ timeout: 30_000 }, // double the timeout because we have two full packager runs
131-
async ({ baseOpts }) => {
132-
const opts: Options = {
133-
...baseOpts,
134-
};
128+
it('can overwrite older packages', async ({ baseOpts }) => {
129+
const opts: Options = {
130+
...baseOpts,
131+
};
135132

136-
const paths = await packager(opts);
137-
expect(paths).toHaveLength(1);
138-
expect(paths[0]).toEqual(
139-
path.join(
140-
opts.out!,
141-
generateFinalBasename({
142-
name: opts.name,
143-
platform: process.platform,
144-
arch: getHostArch(),
145-
}),
146-
),
147-
);
148-
// Create a dummy file to detect whether the output directory is replaced in subsequent runs
149-
const testPath = path.join(paths[0], 'test.txt');
150-
await fs.writeFile(testPath, 'test');
151-
// Second run without overwrite should be skipped
152-
await packager(opts);
153-
expect(fs.existsSync(testPath)).toBe(true);
154-
// Third run with overwrite should replace the output directory
155-
await packager({ ...opts, overwrite: true });
156-
expect(fs.existsSync(testPath)).toBe(false);
157-
},
158-
);
133+
const paths = await packager(opts);
134+
expect(paths).toHaveLength(1);
135+
expect(paths[0]).toEqual(
136+
path.join(
137+
opts.out!,
138+
generateFinalBasename({
139+
name: opts.name,
140+
platform: process.platform,
141+
arch: getHostArch(),
142+
}),
143+
),
144+
);
145+
// Create a dummy file to detect whether the output directory is replaced in subsequent runs
146+
const testPath = path.join(paths[0], 'test.txt');
147+
await fs.writeFile(testPath, 'test');
148+
// Second run without overwrite should be skipped
149+
await packager(opts);
150+
expect(fs.existsSync(testPath)).toBe(true);
151+
// Third run with overwrite should replace the output directory
152+
await packager({ ...opts, overwrite: true });
153+
expect(fs.existsSync(testPath)).toBe(false);
154+
});
159155

160156
it('defaults the out directory to the current working directory', async ({
161157
baseOpts,
@@ -235,7 +231,6 @@ describe('packager', () => {
235231
// FIXME: This flakes with ENOTEMPTY: directory not empty
236232
it.runIf(process.platform === 'darwin').skip(
237233
'can package for all target platforms at once',
238-
{ timeout: 120_000 },
239234
async ({ baseOpts }) => {
240235
const opts: Options = {
241236
...baseOpts,
@@ -264,7 +259,6 @@ describe('packager', () => {
264259

265260
it.runIf(process.platform !== 'darwin')(
266261
'can package for all target platforms at once (no universal on non-darwin)',
267-
{ timeout: 120_000 },
268262
async ({ baseOpts }) => {
269263
const opts: Options = {
270264
...baseOpts,
@@ -1368,7 +1362,7 @@ describe('packager', () => {
13681362
});
13691363

13701364
describe('codesign', () => {
1371-
it('can sign the app', { timeout: 60_000 }, async ({ baseOpts }) => {
1365+
it('can sign the app', async ({ baseOpts }) => {
13721366
const opts: Options = {
13731367
...baseOpts,
13741368
osxSign: { identity: 'codesign.electronjs.org' },

vitest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default defineConfig({
55
setupFiles: ['./test/vitest.setup.ts'],
66
include: ['./test/**/*.spec.ts'],
77
clearMocks: true,
8-
testTimeout: 15_000,
8+
testTimeout: 120_000,
99
typecheck: {
1010
tsconfig: './tsconfig.json',
1111
},

0 commit comments

Comments
 (0)