Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Runtime-sourcemap test #4744

Merged
merged 2 commits into from
Oct 23, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @emails oncall+jsinfra
*/
Expand All @@ -17,9 +16,10 @@ describe('Runtime', () => {
});

describe('requireModule', () => {
it('installs source maps if available', () =>
createRuntime(__filename).then(runtime => {
let hasThrown = false;
it('installs source maps if available', () => {
expect.assertions(1);

return createRuntime(__filename).then(runtime => {
const sum = runtime.requireModule(
runtime.__mockRootPath,
'./sourcemaps/out/throwing-mapped-fn.js',
Expand All @@ -28,20 +28,17 @@ describe('Runtime', () => {
try {
sum();
} catch (err) {
hasThrown = true;
/* eslint-disable max-len */
if (process.platform === 'win32') {
expect(err.stack).toMatch(
/^Error: throwing fn\s+at sum.+\\__tests__\\test_root\\sourcemaps\\throwing-mapped-fn.js:10:9/,
/^Error: throwing fn\s+at sum.+\\__tests__\\test_root\\sourcemaps\\(out\\)?throwing-mapped-fn.js:\d+:\d+/,
);
} else {
expect(err.stack).toMatch(
/^Error: throwing fn\s+at sum.+\/__tests__\/test_root\/sourcemaps\/throwing-mapped-fn.js:10:9/,
/^Error: throwing fn\s+at sum.+\/__tests__\/test_root\/sourcemaps\/(out\/)?throwing-mapped-fn.js:\d+:\d+/,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node 8 was correct, but node 4 and 6 access out. Is that supposed to happen? Feels like it wasn't passed through sourcemap support, then...

);
}
/* eslint-enable max-len */
}
expect(hasThrown).toBe(true);
}));
});
});
});
});