Skip to content

Commit

Permalink
remove $FlowFixMe Missing ESM export (#4096)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronabramov authored and cpojer committed Jul 20, 2017
1 parent cfcbdb3 commit 00ea3ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
14 changes: 5 additions & 9 deletions packages/jest-cli/src/generate_empty_coverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
import type {GlobalConfig, ProjectConfig, Path} from 'types/Config';

import {createInstrumenter} from 'istanbul-lib-instrument';
// $FlowFixMe: Missing ESM export
import {ScriptTransformer, shouldInstrument} from 'jest-runtime';
import Runtime from 'jest-runtime';

module.exports = function(
source: string,
Expand All @@ -26,15 +25,12 @@ module.exports = function(
collectCoverageOnlyFrom: globalConfig.collectCoverageOnlyFrom,
mapCoverage: globalConfig.mapCoverage,
};
if (shouldInstrument(filename, coverageOptions, config)) {
if (Runtime.shouldInstrument(filename, coverageOptions, config)) {
// Transform file without instrumentation first, to make sure produced
// source code is ES6 (no flowtypes etc.) and can be instrumented
const transformResult = new ScriptTransformer(config).transformSource(
filename,
source,
false,
globalConfig.mapCoverage,
);
const transformResult = new Runtime.ScriptTransformer(
config,
).transformSource(filename, source, false, globalConfig.mapCoverage);
const instrumenter = createInstrumenter();
instrumenter.instrumentSync(transformResult.code, filename);
return {
Expand Down
5 changes: 2 additions & 3 deletions packages/jest-runtime/src/script_transformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ import fs from 'graceful-fs';
import {transform as babelTransform} from 'babel-core';
import babelPluginIstanbul from 'babel-plugin-istanbul';
import convertSourceMap from 'convert-source-map';
// $FlowFixMe: Missing ESM export
import {getCacheFilePath} from 'jest-haste-map';
import HasteMap from 'jest-haste-map';
import stableStringify from 'json-stable-stringify';
import slash from 'slash';
import {version as VERSION} from '../package.json';
Expand Down Expand Up @@ -88,7 +87,7 @@ class ScriptTransformer {
instrument: boolean,
mapCoverage: boolean,
): Path {
const baseCacheDir = getCacheFilePath(
const baseCacheDir = HasteMap.getCacheFilePath(
this._config.cacheDirectory,
'jest-transform-cache-' + this._config.name,
VERSION,
Expand Down

0 comments on commit 00ea3ac

Please sign in to comment.