Back out stack D7846453..D7858549

Differential Revision: D7888839

fbshipit-source-id: 872969ab2f92abae0a8bb5472779a46ffe85e2a7
This commit is contained in:
David Aurelio 2018-05-05 13:36:35 -07:00 committed by Facebook Github Bot
parent 2af0396ffe
commit 5f6ada9e8b
4 changed files with 15 additions and 8 deletions

View File

@ -30,7 +30,7 @@ describe('code transformation worker:', () => {
'arbitrary/file.js',
`local/file.js`,
'someReallyArbitrary(code)',
require.resolve('metro/src/transformer.js'),
path.join(__dirname, '../../../transformer.js'),
true,
{
dev: true,
@ -59,7 +59,7 @@ describe('code transformation worker:', () => {
'arbitrary/file.js',
`local/file.js`,
'arbitrary(code)',
require.resolve('metro/src/transformer.js'),
path.join(__dirname, '../../../transformer.js'),
false,
{
dev: true,
@ -94,7 +94,7 @@ describe('code transformation worker:', () => {
'const b = require("b");',
'import c from "./c";',
].join('\n'),
require.resolve('metro/src/transformer.js'),
path.join(__dirname, '../../../transformer.js'),
false,
{
dev: true,

View File

@ -16,6 +16,7 @@ jest.mock('../../../package.json', () => ({
}));
const getTransformCacheKeyFn = require('../getTransformCacheKeyFn');
const path = require('path');
describe('getTransformCacheKeyFn', () => {
it('Should return always the same key for the same params', async () => {
@ -25,7 +26,10 @@ describe('getTransformCacheKeyFn', () => {
cacheVersion: '1.0',
dynamicDepsInPackages: 'arbitrary',
projectRoots: [__dirname],
transformModulePath: require.resolve('metro/src/defaultTransform.js'),
transformModulePath: path.resolve(
__dirname,
'../../defaultTransform.js',
),
})(),
).toMatchSnapshot();
});
@ -36,7 +40,7 @@ describe('getTransformCacheKeyFn', () => {
cacheVersion: '1.0',
dynamicDepsInPackages: 'arbitrary',
projectRoots: [__dirname],
transformModulePath: require.resolve('metro/src/defaultTransform.js'),
transformModulePath: path.resolve(__dirname, '../../defaultTransform.js'),
};
const changedParams = [
@ -50,7 +54,10 @@ describe('getTransformCacheKeyFn', () => {
},
{
...baseParams,
transformModulePath: require.resolve('metro/src/transformer.js'),
transformModulePath: path.resolve(
__dirname,
'../../../src/transformer.js',
),
},
];

View File

@ -29,7 +29,7 @@ function getPreludeCode({
}
function formatExtraVars(extraVars) {
const assignments = [];
let assignments = [];
for (const key in extraVars) {
assignments.push(`${key}=${JSON.stringify(extraVars[key])}`);
}

View File

@ -60,7 +60,7 @@ const getBabelRC = (function() {
// use the Babel config provided with react-native.
if (!projectBabelRCPath || !fs.existsSync(projectBabelRCPath)) {
babelRC = json5.parse(
fs.readFileSync(require.resolve('metro/rn-babelrc.json')),
fs.readFileSync(path.resolve(__dirname, '..', 'rn-babelrc.json')),
);
// Require the babel-preset's listed in the default babel config