From 3054dda39b54666caba268f09cadf801b43ce3a5 Mon Sep 17 00:00:00 2001 From: David Alsh <12656294+alshdavid@users.noreply.github.com> Date: Fri, 13 Dec 2024 07:40:21 +0700 Subject: [PATCH] Reliability: Flow types for tests (part 4) (#279) --- packages/core/integration-tests/test/image.js | 41 +++++++++++-------- .../core/integration-tests/test/kotlin.js | 1 + packages/core/integration-tests/test/less.js | 1 + .../core/integration-tests/test/markdown.js | 1 + .../core/integration-tests/test/monorepos.js | 15 +++++++ .../core/integration-tests/test/parser.js | 1 + packages/core/integration-tests/test/pnp.js | 16 +++++++- .../core/integration-tests/test/postcss.js | 5 +++ .../core/integration-tests/test/posthtml.js | 3 ++ .../core/integration-tests/test/reason.js | 3 ++ .../test/symbol-propagation.js | 1 + .../integration-tests/test/tailwind-tests.js | 9 ++-- packages/core/integration-tests/test/toml.js | 1 + packages/core/integration-tests/test/wasm.js | 5 +++ .../integration-tests/test/webextension.js | 17 ++++---- .../core/integration-tests/test/worklets.js | 5 ++- packages/core/integration-tests/test/yaml.js | 1 + .../core/markdown-ansi/test/markdown-ansi.js | 3 +- packages/core/profiler/test/Tracer.test.js | 5 +++ packages/core/test-utils/src/stubs.js | 21 ++++++++++ packages/core/test-utils/src/utils.js | 3 +- 21 files changed, 124 insertions(+), 34 deletions(-) create mode 100644 packages/core/test-utils/src/stubs.js diff --git a/packages/core/integration-tests/test/image.js b/packages/core/integration-tests/test/image.js index 6e69e1a9b..46481abd8 100644 --- a/packages/core/integration-tests/test/image.js +++ b/packages/core/integration-tests/test/image.js @@ -1,3 +1,4 @@ +// @flow import assert from 'assert'; import {extname, join} from 'path'; @@ -103,14 +104,15 @@ describe('images', function () { }, }); - let {filePath} = b + let jpgBundle = b .getBundles() .find((b) => ['jpg', 'jpeg'].includes(b.type)); + if (!jpgBundle) return assert.fail(); let input = await inputFS.readFile(img); let inputRaw = await sharp(input).toFormat('raw').toBuffer(); - let output = await outputFS.readFile(filePath); + let output = await outputFS.readFile(jpgBundle.filePath); let outputRaw = await sharp(output).toFormat('raw').toBuffer(); assert(outputRaw.equals(inputRaw)); @@ -126,9 +128,10 @@ describe('images', function () { logLevel: 'verbose', }); - let {filePath} = b + let jpgBundle = b .getBundles() .find((b) => ['jpg', 'jpeg'].includes(b.type)); + if (!jpgBundle) return assert.fail(); // let input = await inputFS.readFile(img); // let inputRaw = await sharp(input) @@ -136,7 +139,7 @@ describe('images', function () { // .toBuffer(); // Check validity of image - let output = await outputFS.readFile(filePath); + let output = await outputFS.readFile(jpgBundle.filePath); await sharp(output).toFormat('raw').toBuffer(); // assert(outputRaw.equals(inputRaw)); @@ -151,12 +154,13 @@ describe('images', function () { }, }); - let {filePath} = b.getBundles().find((b) => b.type === 'png'); + let pngBundle = b.getBundles().find((b) => b.type === 'png'); + if (!pngBundle) return assert.fail(); let input = await inputFS.readFile(img); let inputRaw = await sharp(input).toFormat('raw').toBuffer(); - let output = await outputFS.readFile(filePath); + let output = await outputFS.readFile(pngBundle.filePath); let outputRaw = await sharp(output).toFormat('raw').toBuffer(); assert(outputRaw.equals(inputRaw)); @@ -166,11 +170,12 @@ describe('images', function () { it.v2('retain EXIF data when resized with a query string', async () => { let b = await bundle(join(__dirname, '/integration/image-exif/resized.js')); - let {filePath} = b + let jpgBundle = b .getBundles() .find((b) => ['jpg', 'jpeg'].includes(b.type)); + if (!jpgBundle) return assert.fail(); - let buffer = await outputFS.readFile(filePath); + let buffer = await outputFS.readFile(jpgBundle.filePath); let image = await sharp(buffer).metadata(); let {exif} = exifReader(image.exif); @@ -191,11 +196,12 @@ describe('images', function () { }, ); - let {filePath} = b + let jpgBundle = b .getBundles() .find((b) => ['jpg', 'jpeg'].includes(b.type)); + if (!jpgBundle) return assert.fail(); - let buffer = await outputFS.readFile(filePath); + let buffer = await outputFS.readFile(jpgBundle.filePath); let image = await sharp(buffer).metadata(); assert.strictEqual(image.exif, undefined); @@ -204,11 +210,12 @@ describe('images', function () { it.v2('uses the EXIF orientation tag when resizing', async () => { let b = await bundle(join(__dirname, '/integration/image-exif/resized.js')); - let {filePath} = b + let jpgBundle = b .getBundles() .find((b) => ['jpg', 'jpeg'].includes(b.type)); + if (!jpgBundle) return assert.fail(); - let buffer = await outputFS.readFile(filePath); + let buffer = await outputFS.readFile(jpgBundle.filePath); let image = await sharp(buffer).metadata(); assert.strictEqual(image.orientation, 1); @@ -226,9 +233,10 @@ describe('images', function () { }, ); - let {filePath} = b.getBundles().find((b) => b.type === 'jpeg'); + let jpgBundle = b.getBundles().find((b) => b.type === 'jpeg'); + if (!jpgBundle) return assert.fail(); - let buffer = await outputFS.readFile(filePath); + let buffer = await outputFS.readFile(jpgBundle.filePath); let image = await sharp(buffer).metadata(); let originalSize = 549196; @@ -247,9 +255,10 @@ describe('images', function () { }, ); - let {filePath} = b.getBundles().find((b) => b.type === 'png'); + let pngBundle = b.getBundles().find((b) => b.type === 'png'); + if (!pngBundle) return assert.fail(); - let buffer = await outputFS.readFile(filePath); + let buffer = await outputFS.readFile(pngBundle.filePath); let image = await sharp(buffer).metadata(); let originalSize = 84435; diff --git a/packages/core/integration-tests/test/kotlin.js b/packages/core/integration-tests/test/kotlin.js index a9df945f6..fd179e63d 100644 --- a/packages/core/integration-tests/test/kotlin.js +++ b/packages/core/integration-tests/test/kotlin.js @@ -1,3 +1,4 @@ +// @flow import assert from 'assert'; import { assertBundleTree, diff --git a/packages/core/integration-tests/test/less.js b/packages/core/integration-tests/test/less.js index b16fbe835..001542539 100644 --- a/packages/core/integration-tests/test/less.js +++ b/packages/core/integration-tests/test/less.js @@ -1,3 +1,4 @@ +// @flow import assert from 'assert'; import {join} from 'path'; import { diff --git a/packages/core/integration-tests/test/markdown.js b/packages/core/integration-tests/test/markdown.js index ef37cf84a..09f782d87 100644 --- a/packages/core/integration-tests/test/markdown.js +++ b/packages/core/integration-tests/test/markdown.js @@ -1,3 +1,4 @@ +// @flow import assert from 'assert'; import path from 'path'; import { diff --git a/packages/core/integration-tests/test/monorepos.js b/packages/core/integration-tests/test/monorepos.js index ff78a5fe6..131e903b1 100644 --- a/packages/core/integration-tests/test/monorepos.js +++ b/packages/core/integration-tests/test/monorepos.js @@ -1,3 +1,4 @@ +// @flow import assert from 'assert'; import path from 'path'; import { @@ -606,6 +607,7 @@ describe.v2('monorepos', function () { subscription = await b.watch(); let evt = await getNextBuild(b); + if (!evt.bundleGraph) return assert.fail(); assertBundles(evt.bundleGraph, [ { @@ -624,6 +626,8 @@ describe.v2('monorepos', function () { ); evt = await getNextBuild(b); + if (!evt.bundleGraph) return assert.fail(); + assertBundles(evt.bundleGraph, [ { name: 'pkg-a.cjs.js', @@ -668,6 +672,7 @@ describe.v2('monorepos', function () { subscription = await b.watch(); let evt = await getNextBuild(b); + if (!evt.bundleGraph) return assert.fail(); assertBundles(evt.bundleGraph, [ { @@ -689,6 +694,8 @@ describe.v2('monorepos', function () { evt = await getNextBuild(b); assert(evt.type === 'buildSuccess'); + if (!evt.bundleGraph) return assert.fail(); + assertBundles(evt.bundleGraph, [ { name: 'pkg-a.cjs.js', @@ -729,6 +736,7 @@ describe.v2('monorepos', function () { subscription = await b.watch(); let evt = await getNextBuild(b); + if (!evt.bundleGraph) return assert.fail(); assertBundles(evt.bundleGraph, [ { @@ -753,6 +761,8 @@ describe.v2('monorepos', function () { ); evt = await getNextBuild(b); + if (!evt.bundleGraph) return assert.fail(); + assertBundles(evt.bundleGraph, [ { name: 'alt.js', @@ -1008,6 +1018,7 @@ describe.v2('monorepos', function () { for (let bundle of b.getBundles()) { let res = await runBundle(b, bundle); + // $FlowFixMe res is an unknown type assert.equal(res.default, bundle.name[0]); } }); @@ -1064,6 +1075,7 @@ describe.v2('monorepos', function () { for (let bundle of b.getBundles()) { let res = await runBundle(b, bundle); + // $FlowFixMe res is an unknown type assert.equal(res.default, bundle.name[0]); } }); @@ -1097,6 +1109,7 @@ describe.v2('monorepos', function () { subscription = await b.watch(); let evt = await getNextBuild(b); + if (!evt.bundleGraph) return assert.fail(); assertBundles(evt.bundleGraph, [ { @@ -1110,6 +1123,8 @@ describe.v2('monorepos', function () { `; evt = await getNextBuild(b); + if (!evt.bundleGraph) return assert.fail(); + assertBundles(evt.bundleGraph, [ { assets: ['a.js'], diff --git a/packages/core/integration-tests/test/parser.js b/packages/core/integration-tests/test/parser.js index 7e25c2b5f..abd272d74 100644 --- a/packages/core/integration-tests/test/parser.js +++ b/packages/core/integration-tests/test/parser.js @@ -1,3 +1,4 @@ +// @flow import assert from 'assert'; import path from 'path'; import { diff --git a/packages/core/integration-tests/test/pnp.js b/packages/core/integration-tests/test/pnp.js index 3f57beb78..2393a34e4 100644 --- a/packages/core/integration-tests/test/pnp.js +++ b/packages/core/integration-tests/test/pnp.js @@ -1,3 +1,4 @@ +// @flow import assert from 'assert'; import Module from 'module'; import path from 'path'; @@ -18,16 +19,21 @@ describe.v2('pnp', function () { let dir = path.join(__dirname, 'integration/pnp-require'); let origPnpVersion = process.versions.pnp; - process.versions.pnp = 42; + process.versions.pnp = '42'; + // $FlowFixMe patching let origModuleResolveFilename = Module._resolveFilename; + // $FlowFixMe patching Module.findPnpApi = () => require(path.join(dir, '.pnp.js')); + // $FlowFixMe patching Module._resolveFilename = (name, ...args) => name === 'pnpapi' ? path.join(dir, '.pnp.js') : origModuleResolveFilename(name, ...args); + // $FlowFixMe patching let origReadFileSync = inputFS.readFileSync; + // $FlowFixMe patching inputFS.readFileSync = (p, ...args) => { return origReadFileSync.call(inputFS, p.replace(ZIPFS, ''), ...args); }; @@ -56,7 +62,9 @@ describe.v2('pnp', function () { assert.equal(output(), 3); } finally { process.versions.pnp = origPnpVersion; + // $FlowFixMe patching Module._resolveFilename = origModuleResolveFilename; + // $FlowFixMe patching inputFS.readFileSync = origReadFileSync; inputFS.statSync = origStatSync; inputFS.realpathSync = origRealpathSync; @@ -67,10 +75,13 @@ describe.v2('pnp', function () { let dir = path.join(__dirname, 'integration/pnp-builtin'); let origPnpVersion = process.versions.pnp; - process.versions.pnp = 42; + process.versions.pnp = '42'; + // $FlowFixMe patching let origModuleResolveFilename = Module._resolveFilename; + // $FlowFixMe patching Module.findPnpApi = () => require(path.join(dir, '.pnp.js')); + // $FlowFixMe patching Module._resolveFilename = (name, ...args) => name === 'pnpapi' ? path.join(dir, '.pnp.js') @@ -90,6 +101,7 @@ describe.v2('pnp', function () { assert.equal(output(), 3); } finally { process.versions.pnp = origPnpVersion; + // $FlowFixMe patching Module._resolveFilename = origModuleResolveFilename; } }); diff --git a/packages/core/integration-tests/test/postcss.js b/packages/core/integration-tests/test/postcss.js index ebda65542..cd63c6159 100644 --- a/packages/core/integration-tests/test/postcss.js +++ b/packages/core/integration-tests/test/postcss.js @@ -1,3 +1,4 @@ +// @flow import assert from 'assert'; import path from 'path'; import { @@ -234,6 +235,7 @@ describe.v2('postcss', () => { let subscription = await b.watch(); let buildEvent = await getNextBuild(b); assert.equal(buildEvent.type, 'buildSuccess'); + if (!buildEvent.bundleGraph) return assert.fail(); let contents = await outputFS.readFile( buildEvent.bundleGraph.getBundles()[0].filePath, @@ -253,6 +255,7 @@ describe.v2('postcss', () => { buildEvent = await getNextBuild(b); assert.equal(buildEvent.type, 'buildSuccess'); + if (!buildEvent.bundleGraph) return assert.fail(); contents = await outputFS.readFile( buildEvent.bundleGraph.getBundles()[0].filePath, @@ -272,6 +275,7 @@ describe.v2('postcss', () => { buildEvent = await getNextBuild(b); assert.equal(buildEvent.type, 'buildSuccess'); + if (!buildEvent.bundleGraph) return assert.fail(); contents = await outputFS.readFile( buildEvent.bundleGraph.getBundles()[0].filePath, @@ -288,6 +292,7 @@ describe.v2('postcss', () => { buildEvent = await getNextBuild(b); assert.equal(buildEvent.type, 'buildSuccess'); + if (!buildEvent.bundleGraph) return assert.fail(); contents = await outputFS.readFile( buildEvent.bundleGraph.getBundles()[0].filePath, diff --git a/packages/core/integration-tests/test/posthtml.js b/packages/core/integration-tests/test/posthtml.js index 762907da7..eb5e7c5f4 100644 --- a/packages/core/integration-tests/test/posthtml.js +++ b/packages/core/integration-tests/test/posthtml.js @@ -1,3 +1,4 @@ +// @flow import assert from 'assert'; import { bundle, @@ -83,6 +84,7 @@ describe.v2('posthtml', function () { const b = await bundle( path.join(__dirname, '/integration/posthtml-assets/index.html'), ); + // $FlowFixMe assets missing const asset = b.assets.values().next().value; const other = path.join( __dirname, @@ -96,6 +98,7 @@ describe.v2('posthtml', function () { const b = await bundle( path.join(__dirname, '/integration/posthtml-plugin-deps/index.html'), ); + // $FlowFixMe assets missing const asset = b.assets.values().next().value; const other = path.join( __dirname, diff --git a/packages/core/integration-tests/test/reason.js b/packages/core/integration-tests/test/reason.js index 5bfe4c794..064db190b 100644 --- a/packages/core/integration-tests/test/reason.js +++ b/packages/core/integration-tests/test/reason.js @@ -1,3 +1,4 @@ +// @flow import assert from 'assert'; import path from 'path'; import {bundle, run} from '@atlaspack/test-utils'; @@ -6,7 +7,9 @@ describe.skip('reason', function () { it('should produce a bundle', async function () { let b = await bundle(path.join(__dirname, '/integration/reason/index.js')); + // $FlowFixMe missing assets assert.equal(b.assets.size, 2); + // $FlowFixMe missing assets assert.equal(b.childBundles.size, 1); let output = await run(b); diff --git a/packages/core/integration-tests/test/symbol-propagation.js b/packages/core/integration-tests/test/symbol-propagation.js index b4f61d04b..c2bd3f5aa 100644 --- a/packages/core/integration-tests/test/symbol-propagation.js +++ b/packages/core/integration-tests/test/symbol-propagation.js @@ -1,3 +1,4 @@ +// @flow import assert from 'assert'; import path from 'path'; import { diff --git a/packages/core/integration-tests/test/tailwind-tests.js b/packages/core/integration-tests/test/tailwind-tests.js index af0998abb..edd9fb001 100644 --- a/packages/core/integration-tests/test/tailwind-tests.js +++ b/packages/core/integration-tests/test/tailwind-tests.js @@ -1,3 +1,4 @@ +// @flow import assert from 'assert'; import path from 'path'; import {bundle, describe, it, outputFS} from '@atlaspack/test-utils'; @@ -7,10 +8,10 @@ describe.v2('tailwind', function () { let fixture = path.join(__dirname, '/integration/tailwind-scss'); let b = await bundle(path.join(fixture, 'index.html')); - let css = await outputFS.readFile( - b.getBundles().find((b) => b.type === 'css').filePath, - 'utf8', - ); + let cssBundle = b.getBundles().find((b) => b.type === 'css'); + if (!cssBundle) return assert.fail(); + + let css = await outputFS.readFile(cssBundle.filePath, 'utf8'); assert(css.includes('.p-2')); assert(!css.includes('.m-2')); }); diff --git a/packages/core/integration-tests/test/toml.js b/packages/core/integration-tests/test/toml.js index 2c3042f5c..bd49b75ab 100644 --- a/packages/core/integration-tests/test/toml.js +++ b/packages/core/integration-tests/test/toml.js @@ -1,3 +1,4 @@ +// @flow import assert from 'assert'; import {join} from 'path'; import { diff --git a/packages/core/integration-tests/test/wasm.js b/packages/core/integration-tests/test/wasm.js index 8fe51073a..8963e0cad 100644 --- a/packages/core/integration-tests/test/wasm.js +++ b/packages/core/integration-tests/test/wasm.js @@ -1,3 +1,4 @@ +// @flow import assert from 'assert'; import path from 'path'; import { @@ -9,6 +10,7 @@ import { run, } from '@atlaspack/test-utils'; +// Type errors commented out because test is skipped describe.skip('wasm', function () { if (typeof WebAssembly === 'undefined') { return; @@ -19,6 +21,7 @@ describe.skip('wasm', function () { it('should preload a wasm file for a sync require', async function () { let b = await bundle( path.join(__dirname, '/integration/wasm-sync/index.js'), + // $FlowFixMe target is missing from InitialOptions { target, }, @@ -53,6 +56,7 @@ describe.skip('wasm', function () { it('should load a wasm file asynchronously with dynamic import', async function () { let b = await bundle( path.join(__dirname, '/integration/wasm-async/index.js'), + // $FlowFixMe target is missing from InitialOptions { target, }, @@ -86,6 +90,7 @@ describe.skip('wasm', function () { it('should load a wasm file in parallel with a dynamic JS import', async function () { let b = await bundle( path.join(__dirname, '/integration/wasm-dynamic/index.js'), + // $FlowFixMe target is missing from InitialOptions { target, }, diff --git a/packages/core/integration-tests/test/webextension.js b/packages/core/integration-tests/test/webextension.js index 50397d570..b9d15fe36 100644 --- a/packages/core/integration-tests/test/webextension.js +++ b/packages/core/integration-tests/test/webextension.js @@ -1,3 +1,4 @@ +// @flow import assert from 'assert'; import path from 'path'; import { @@ -51,11 +52,10 @@ describe.v2('webextension', function () { path.join(distDir, '_locales', 'en_US', 'messages.json'), ), ); + let manifestBundle = b.getBundles().find((b) => b.name == 'manifest.json'); + if (!manifestBundle) return assert.fail(); const manifest = JSON.parse( - await outputFS.readFile( - b.getBundles().find((b) => b.name == 'manifest.json').filePath, - 'utf8', - ), + await outputFS.readFile(manifestBundle.filePath, 'utf8'), ); const scripts = manifest.background.scripts; assert.equal(scripts.length, 1); @@ -99,11 +99,12 @@ describe.v2('webextension', function () { }, {assets: ['single.js', 'esmodule-helpers.js']}, ]); + + let manifestBundle = b.getBundles().find((b) => b.name == 'manifest.json'); + if (!manifestBundle) return assert.fail(); + const manifest = JSON.parse( - await outputFS.readFile( - b.getBundles().find((b) => b.name == 'manifest.json').filePath, - 'utf8', - ), + await outputFS.readFile(manifestBundle.filePath, 'utf8'), ); const war = manifest.web_accessible_resources; assert.equal(war.length, 4); diff --git a/packages/core/integration-tests/test/worklets.js b/packages/core/integration-tests/test/worklets.js index 4a5d49a97..54834b635 100644 --- a/packages/core/integration-tests/test/worklets.js +++ b/packages/core/integration-tests/test/worklets.js @@ -1,3 +1,4 @@ +// @flow import assert from 'assert'; import path from 'path'; import { @@ -59,7 +60,7 @@ describe('atlaspack', function () { }, ]); - let url; + let url = ''; await run(b, { CSS: { paintWorklet: { @@ -110,7 +111,7 @@ describe('atlaspack', function () { }, ]); - let url; + let url = ''; await run(b, { CSS: { paintWorklet: { diff --git a/packages/core/integration-tests/test/yaml.js b/packages/core/integration-tests/test/yaml.js index 2c7dfbce9..61e4c2b20 100644 --- a/packages/core/integration-tests/test/yaml.js +++ b/packages/core/integration-tests/test/yaml.js @@ -1,3 +1,4 @@ +// @flow import assert from 'assert'; import {join} from 'path'; import { diff --git a/packages/core/markdown-ansi/test/markdown-ansi.js b/packages/core/markdown-ansi/test/markdown-ansi.js index b871b7346..7ca27344d 100644 --- a/packages/core/markdown-ansi/test/markdown-ansi.js +++ b/packages/core/markdown-ansi/test/markdown-ansi.js @@ -1,9 +1,10 @@ +// @flow import assert from 'assert'; import chalk from 'chalk'; import mdAnsi from '../src/markdown-ansi'; -process.env.FORCE_COLOR = 3; +process.env.FORCE_COLOR = '3'; describe('markdown-ansi', () => { if (!chalk.supportsColor) return; diff --git a/packages/core/profiler/test/Tracer.test.js b/packages/core/profiler/test/Tracer.test.js index 3dd68fcfc..ccdbb95fe 100644 --- a/packages/core/profiler/test/Tracer.test.js +++ b/packages/core/profiler/test/Tracer.test.js @@ -1,3 +1,4 @@ +// @flow import {tracer, PluginTracer} from '../src/Tracer'; import sinon from 'sinon'; import assert from 'assert'; @@ -22,6 +23,7 @@ describe('Tracer', () => { }); it('emits a basic trace event', () => { const measurement = tracer.createMeasurement('test'); + if (!measurement) return assert.fail(); measurement.end(); sinon.assert.calledWith( onTrace, @@ -37,6 +39,7 @@ describe('Tracer', () => { const measurement = tracer.createMeasurement('test', 'myPlugin', 'aaargh', { extra: 'data', }); + if (!measurement) return assert.fail(); measurement.end(); sinon.assert.calledWith( onTrace, @@ -51,6 +54,7 @@ describe('Tracer', () => { }); it('calling end twice on measurment should be a no-op', () => { const measurement = tracer.createMeasurement('test'); + if (!measurement) return assert.fail(); measurement.end(); measurement.end(); sinon.assert.calledOnce(onTrace); @@ -63,6 +67,7 @@ describe('Tracer', () => { category: 'cat', }); const measurement = pluginTracer.createMeasurement('test', 'customCat'); + if (!measurement) return assert.fail(); measurement.end(); sinon.assert.calledWith( onTrace, diff --git a/packages/core/test-utils/src/stubs.js b/packages/core/test-utils/src/stubs.js new file mode 100644 index 000000000..62c0412f6 --- /dev/null +++ b/packages/core/test-utils/src/stubs.js @@ -0,0 +1,21 @@ +// @flow + +/** @deprecated For passing the type checks in the skipped tests */ +// eslint-disable-next-line no-unused-vars +export function nextBundle(...args: any[]): any { + throw new Error('stub'); +} + +/** @deprecated For passing the type checks in the skipped tests */ +// eslint-disable-next-line no-unused-vars +export function assertBundleTree(...args: any[]): any { + throw new Error('stub'); +} + +/** @deprecated For passing the type checks in the skipped tests */ +export function deferred(): {| + resolve: (c: any) => void, + reject: (v: any) => void, +|} { + throw new Error('stub'); +} diff --git a/packages/core/test-utils/src/utils.js b/packages/core/test-utils/src/utils.js index 53d380592..7ba54e5df 100644 --- a/packages/core/test-utils/src/utils.js +++ b/packages/core/test-utils/src/utils.js @@ -38,6 +38,7 @@ import _chalk from 'chalk'; import resolve from 'resolve'; export {fsFixture} from './fsFixture'; +export * from './stubs'; export const workerFarm = (createWorkerFarm(): WorkerFarm); export const inputFS: NodeFS = new NodeFS(); @@ -539,7 +540,7 @@ export function expectBundles( export type AssertBundle = {| name?: string | RegExp, type?: string, - assets: Array, + assets?: Array, childBundles?: Array, |};