Skip to content

Commit 5badee6

Browse files
committedJul 13, 2020
chore(flow): Added flow suppress comments for expected flow typecheck errors in tests
1 parent 1ee5d06 commit 5badee6

File tree

8 files changed

+24
-17
lines changed

8 files changed

+24
-17
lines changed
 

‎tests/unit/test-cmd/test.lint.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ describe('lint', () => {
2525
createLinter,
2626
runLinter,
2727
lint: (params = {}, options = {}) => {
28-
return defaultLintCommand({
29-
sourceDir: '/fake/source/dir',
30-
...params,
31-
}, {
28+
const mergedArgs = {sourceDir: '/fake/source/dir', ...params};
29+
const mergedOpts = {
3230
createLinter,
3331
createFileFilter,
3432
...options,
35-
});
33+
};
34+
// $FlowIgnore: allow use of inexact object literal for testing purpose.
35+
return defaultLintCommand(mergedArgs, mergedOpts);
3636
},
3737
};
3838
}

‎tests/unit/test-cmd/test.run.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,9 @@ function prepareRun(fakeInstallResult) {
5151
return {
5252
argv,
5353
options,
54-
run: (customArgv = {}, customOpt = {}) => run(
55-
{...argv, ...customArgv},
56-
{...options, ...customOpt}
57-
),
54+
run: (customArgv = {}, customOpt = {}) =>
55+
// $FlowIgnore: allow use of inexact object literal for testing purpose.
56+
run({...argv, ...customArgv}, {...options, ...customOpt}),
5857
};
5958
}
6059

@@ -129,7 +128,9 @@ describe('run', () => {
129128
firefoxBinary: runOptions.firefox,
130129
customPrefs: runOptions.pref,
131130
};
131+
// $FlowIgnore: Allow deleting properties for testing purpose.
132132
delete expectedRunnerParams.firefox;
133+
// $FlowIgnore: Allow deleting properties for testing purpose.
133134
delete expectedRunnerParams.pref;
134135

135136
assert.deepEqual({

‎tests/unit/test-extension-runners/test.extension-runners.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ describe('util/extension-runners', () => {
306306
return {
307307
config,
308308
createWatcher: (customConfig = {}) => {
309+
// $FlowIgnore: allow use of inexact object literal for testing purpose.
309310
return defaultWatcherCreator({...config, ...customConfig});
310311
},
311312
};
@@ -403,9 +404,10 @@ describe('util/extension-runners', () => {
403404
watcher,
404405
extensionRunner,
405406
reloadStrategy: async (argOverride = {}, optOverride = {}) => {
406-
return defaultReloadStrategy(
407-
{...args, ...argOverride},
408-
{...options, ...optOverride});
407+
const mergedArgs = {...args, ...argOverride};
408+
const mergedOpts = {...options, ...optOverride};
409+
// $FlowIgnore: allow use of inexact object literal for testing purpose.
410+
return defaultReloadStrategy(mergedArgs, mergedOpts);
409411
},
410412
};
411413
}

‎tests/unit/test-extension-runners/test.firefox-android.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ function prepareExtensionRunnerParams({
9595
return Promise.resolve(remoteFirefox);
9696
}),
9797
desktopNotifications: sinon.spy(() => {}),
98+
// $FlowIgnore: Allow to mock stdin with an EventEmitter for testing purpose.
9899
stdin: new EventEmitter(),
99100
...(params || {}),
100101
};
@@ -930,11 +931,9 @@ describe('util/extension-runners/firefox-android', () => {
930931
];
931932

932933
for (const testCase of optionsWarningTestCases) {
933-
// $FlowIgnore: allow overriden params for testing purpose.
934-
new FirefoxAndroidExtensionRunner({ // eslint-disable-line no-new
935-
...params,
936-
...(testCase.params),
937-
});
934+
const runnerOptions = {...params, ...(testCase.params)};
935+
// $FlowIgnore: allow use of inexact object literal for testing purpose.
936+
new FirefoxAndroidExtensionRunner(runnerOptions); // eslint-disable-line no-new
938937

939938
assert.match(
940939
consoleStream.capturedMessages[0],

‎tests/unit/test-firefox/test.firefox.js

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ describe('firefox', () => {
103103
...args
104104
}: RunFirefoxOptions = {},
105105
) {
106+
// $FlowIgnore: allow use of inexact object literal for testing purpose.
106107
return firefox.run(profile, {
107108
fxRunner: createFakeFxRunner(),
108109
findRemotePort: () => Promise.resolve(6000),

‎tests/unit/test-firefox/test.remote.js

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ describe('firefox.remote', () => {
3434
sinon.spy(() => Promise.resolve(fakeFirefoxClient())),
3535
...options,
3636
};
37+
// $FlowIgnore: allow use of inexact object literal for testing purpose.
3738
const connect = defaultConnector(port, options);
3839
return {options, connect};
3940
}
@@ -398,6 +399,7 @@ describe('firefox.remote', () => {
398399
describe('connectWithMaxRetries', () => {
399400

400401
function firefoxClient(opt = {}, deps) {
402+
// $FlowIgnore: allow use of inexact object literal for testing purpose.
401403
return connectWithMaxRetries({
402404
maxRetries: 0, retryInterval: 1, port: 6005, ...opt,
403405
}, deps);

‎tests/unit/test-util/test.file-filter.js

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {FileFilter, isSubPath} from '../../../src/util/file-filter';
77
describe('util/file-filter', () => {
88

99
const newFileFilter = (params = {}) => {
10+
// $FlowIgnore: allow use of inexact object literal for testing purpose.
1011
return new FileFilter({
1112
sourceDir: '.',
1213
...params,

‎tests/unit/test.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,7 @@ describe('config', () => {
955955

956956
describe('discoverConfigFiles', () => {
957957
function _discoverConfigFiles(params = {}) {
958+
// $FlowIgnore: allow use of inexact object literal for testing purpose.
958959
return discoverConfigFiles({
959960
// By default, do not look in the real home directory.
960961
getHomeDir: () => '/not-a-directory',

0 commit comments

Comments
 (0)
Please sign in to comment.