Skip to content

Commit

Permalink
chore(flow): Added flow suppress comments for expected flow typecheck…
Browse files Browse the repository at this point in the history
… errors in tests
  • Loading branch information
rpl committed Jul 13, 2020
1 parent 1ee5d06 commit 5badee6
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 17 deletions.
10 changes: 5 additions & 5 deletions tests/unit/test-cmd/test.lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ describe('lint', () => {
createLinter,
runLinter,
lint: (params = {}, options = {}) => {
return defaultLintCommand({
sourceDir: '/fake/source/dir',
...params,
}, {
const mergedArgs = {sourceDir: '/fake/source/dir', ...params};
const mergedOpts = {
createLinter,
createFileFilter,
...options,
});
};
// $FlowIgnore: allow use of inexact object literal for testing purpose.
return defaultLintCommand(mergedArgs, mergedOpts);
},
};
}
Expand Down
9 changes: 5 additions & 4 deletions tests/unit/test-cmd/test.run.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,9 @@ function prepareRun(fakeInstallResult) {
return {
argv,
options,
run: (customArgv = {}, customOpt = {}) => run(
{...argv, ...customArgv},
{...options, ...customOpt}
),
run: (customArgv = {}, customOpt = {}) =>
// $FlowIgnore: allow use of inexact object literal for testing purpose.
run({...argv, ...customArgv}, {...options, ...customOpt}),
};
}

Expand Down Expand Up @@ -129,7 +128,9 @@ describe('run', () => {
firefoxBinary: runOptions.firefox,
customPrefs: runOptions.pref,
};
// $FlowIgnore: Allow deleting properties for testing purpose.
delete expectedRunnerParams.firefox;
// $FlowIgnore: Allow deleting properties for testing purpose.
delete expectedRunnerParams.pref;

assert.deepEqual({
Expand Down
8 changes: 5 additions & 3 deletions tests/unit/test-extension-runners/test.extension-runners.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ describe('util/extension-runners', () => {
return {
config,
createWatcher: (customConfig = {}) => {
// $FlowIgnore: allow use of inexact object literal for testing purpose.
return defaultWatcherCreator({...config, ...customConfig});
},
};
Expand Down Expand Up @@ -403,9 +404,10 @@ describe('util/extension-runners', () => {
watcher,
extensionRunner,
reloadStrategy: async (argOverride = {}, optOverride = {}) => {
return defaultReloadStrategy(
{...args, ...argOverride},
{...options, ...optOverride});
const mergedArgs = {...args, ...argOverride};
const mergedOpts = {...options, ...optOverride};
// $FlowIgnore: allow use of inexact object literal for testing purpose.
return defaultReloadStrategy(mergedArgs, mergedOpts);
},
};
}
Expand Down
9 changes: 4 additions & 5 deletions tests/unit/test-extension-runners/test.firefox-android.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ function prepareExtensionRunnerParams({
return Promise.resolve(remoteFirefox);
}),
desktopNotifications: sinon.spy(() => {}),
// $FlowIgnore: Allow to mock stdin with an EventEmitter for testing purpose.
stdin: new EventEmitter(),
...(params || {}),
};
Expand Down Expand Up @@ -930,11 +931,9 @@ describe('util/extension-runners/firefox-android', () => {
];

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

assert.match(
consoleStream.capturedMessages[0],
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test-firefox/test.firefox.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ describe('firefox', () => {
...args
}: RunFirefoxOptions = {},
) {
// $FlowIgnore: allow use of inexact object literal for testing purpose.
return firefox.run(profile, {
fxRunner: createFakeFxRunner(),
findRemotePort: () => Promise.resolve(6000),
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/test-firefox/test.remote.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ describe('firefox.remote', () => {
sinon.spy(() => Promise.resolve(fakeFirefoxClient())),
...options,
};
// $FlowIgnore: allow use of inexact object literal for testing purpose.
const connect = defaultConnector(port, options);
return {options, connect};
}
Expand Down Expand Up @@ -398,6 +399,7 @@ describe('firefox.remote', () => {
describe('connectWithMaxRetries', () => {

function firefoxClient(opt = {}, deps) {
// $FlowIgnore: allow use of inexact object literal for testing purpose.
return connectWithMaxRetries({
maxRetries: 0, retryInterval: 1, port: 6005, ...opt,
}, deps);
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test-util/test.file-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {FileFilter, isSubPath} from '../../../src/util/file-filter';
describe('util/file-filter', () => {

const newFileFilter = (params = {}) => {
// $FlowIgnore: allow use of inexact object literal for testing purpose.
return new FileFilter({
sourceDir: '.',
...params,
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,7 @@ describe('config', () => {

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

0 comments on commit 5badee6

Please sign in to comment.