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

test: verify performance.timerify() works w/ non-Node Contexts #23784

Closed

Conversation

addaleax
Copy link
Member

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Oct 20, 2018
// Check that performance.timerify() works when called from another context,
// for a function created in another context.

const check = runInNewContext(`
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you assign the string to a variable, I find this is a bit tricky to read (probably because of GitHub viewer limitations)

Copy link
Member Author

Choose a reason for hiding this comment

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

I’m not sure what you mean? If you are talking about the template string, why does assigning to a new variable make a difference here?

Copy link
Contributor

Choose a reason for hiding this comment

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

image
It looks awkward, especially the line that starts `, {

IMHO a simple variable makes it clearer:

const code = `
const { performance, assert } = data;
const timerified = performance.timerify(function() { return []; });
assert.strictEqual(timerified().constructor, Array);
'success';
`;
const check = runInNewContext(code, { performance, assert });
assert.strictEqual(check, 'success');

@addaleax addaleax added test Issues and PRs related to the tests. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels Oct 24, 2018
@addaleax
Copy link
Member Author

@addaleax
Copy link
Member Author

Landed in a3cad3e

@addaleax addaleax closed this Oct 25, 2018
@addaleax addaleax deleted the perf-timerify-non-non-context branch October 25, 2018 17:50
addaleax added a commit that referenced this pull request Oct 25, 2018
PR-URL: #23784
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this pull request Oct 26, 2018
PR-URL: #23784
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this pull request Nov 1, 2018
PR-URL: #23784
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins
Copy link
Contributor

This lands cleanly on 10.x but will require a backport to 8.x. Should this land in that release line?

MylesBorins pushed a commit that referenced this pull request Nov 26, 2018
PR-URL: #23784
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@codebytere codebytere mentioned this pull request Nov 27, 2018
rvagg pushed a commit that referenced this pull request Nov 28, 2018
PR-URL: #23784
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Nov 29, 2018
PR-URL: #23784
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@codebytere codebytere mentioned this pull request Nov 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants