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 metro tests to run with high parallelism #1410

Closed
wants to merge 1 commit into from
Closed
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
26 changes: 10 additions & 16 deletions packages/metro-symbolicate/src/__tests__/symbolicate-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

const symbolicate = require('../symbolicate');
const fs = require('fs');
const os = require('os');
const path = require('path');
const {PassThrough} = require('stream');

Expand Down Expand Up @@ -53,9 +54,11 @@ const execute = async (
return stdout.join('');
};

const TEMP_DIR = fs.mkdtempSync(path.join(os.tmpdir(), 'symbolicate-'));
const TEMP_FILE = path.resolve(TEMP_DIR, 'testfile.temp.cpuprofile');
afterAll(() => {
try {
fs.unlinkSync(resolve('testfile.temp.cpuprofile'));
fs.rmdirSync(TEMP_DIR);
} catch (e) {}
});

Expand Down Expand Up @@ -400,32 +403,23 @@ describe('symbolicating an attribution file specifying unmapped offsets', () =>
});

test('symbolicating with a cpuprofile', async () => {
fs.copyFileSync(
resolve('testfile.cpuprofile'),
resolve('testfile.temp.cpuprofile'),
);
fs.copyFileSync(resolve('testfile.cpuprofile'), TEMP_FILE);

await execute([
resolve('testfile.cpuprofile.map'),
resolve('testfile.temp.cpuprofile'),
]);
await execute([resolve('testfile.cpuprofile.map'), TEMP_FILE]);

expect(JSON.parse(read('testfile.temp.cpuprofile'))).toMatchSnapshot();
expect(JSON.parse(read(TEMP_FILE))).toMatchSnapshot();
});

test('symbolicating with a cpuprofile ignoring a function map', async () => {
fs.copyFileSync(
resolve('testfile.cpuprofile'),
resolve('testfile.temp.cpuprofile'),
);
fs.copyFileSync(resolve('testfile.cpuprofile'), TEMP_FILE);

await execute([
'--no-function-names',
resolve('testfile.cpuprofile.map'),
resolve('testfile.temp.cpuprofile'),
TEMP_FILE,
]);

expect(JSON.parse(read('testfile.temp.cpuprofile'))).toMatchSnapshot();
expect(JSON.parse(read(TEMP_FILE))).toMatchSnapshot();
});

test('symbolicating a stack trace with a function map', async () =>
Expand Down
Loading