-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: - closes #3272 sibelius, here is a PR addressing this long-standing issue. This is a follow-up to your [comment](#3272 (comment)). Pull Request resolved: #4544 Reviewed By: captbaritone, tyao1 Differential Revision: D52567994 Pulled By: alunyov fbshipit-source-id: b5be2c7d70107ba6dca2daf538e94281a1eac826
- Loading branch information
1 parent
921f2a8
commit 9f135b8
Showing
3 changed files
with
76 additions
and
5 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
packages/babel-plugin-relay/__tests__/BabelPluginRelay-path-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @format | ||
* @oncall relay | ||
*/ | ||
|
||
'use strict'; | ||
|
||
describe('`development` option', () => { | ||
function transformOnPlatform(platform: string) { | ||
jest.resetModules(); | ||
|
||
Object.defineProperty(process, 'platform', { | ||
value: platform, | ||
}); | ||
|
||
jest.doMock('path', () => { | ||
if (platform === 'win32') { | ||
return jest.requireActual('path').win32; | ||
} else { | ||
return jest.requireActual('path').posix; | ||
} | ||
}); | ||
|
||
const transformerWithOptions = require('./transformerWithOptions'); | ||
|
||
return transformerWithOptions( | ||
{ | ||
artifactDirectory: '/test/artifacts', | ||
}, | ||
'development', | ||
)('graphql`fragment TestFrag on Node { id }`'); | ||
} | ||
|
||
it('tests the handling of file path', () => { | ||
const codeOnPosix = transformOnPlatform('linux'); | ||
const codeOnNonPosix = transformOnPlatform('win32'); | ||
|
||
expect(codeOnNonPosix).toEqual(codeOnPosix); | ||
expect(codeOnPosix).toMatchSnapshot(); | ||
}); | ||
}); |
15 changes: 15 additions & 0 deletions
15
packages/babel-plugin-relay/__tests__/__snapshots__/BabelPluginRelay-path-test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`\`development\` option tests the handling of file path 1`] = ` | ||
"var _TestFrag; | ||
_TestFrag !== void 0 | ||
? _TestFrag | ||
: ((_TestFrag = require('./test/artifacts/TestFrag.graphql')), | ||
_TestFrag.hash && | ||
_TestFrag.hash !== '0bb6b7b29bc3e910921551c4ff5b6757' && | ||
console.error( | ||
\\"The definition of 'TestFrag' appears to have changed. Run \`relay-compiler\` to update the generated files to receive the expected data.\\", | ||
), | ||
_TestFrag); | ||
" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters