Migrate tests goog module#5440
Conversation
|
OK, this looks really promising as far as mocking goes. As far as the issues you noted in chat:
The only way around is through: all the test files that depend on the helpers need to become
But I think that #2 and #3 are probably only procrastinating from doing #1. |
cpcallen
left a comment
There was a problem hiding this comment.
Looks good, but for some small stylistic issues.
I have commits in my local branch to apply the name changes (and convert a few more files to goog.module) that I can push to this PR if you like.
|
Happy to have you push whatever changes you have so far, and then I can finish up converting the rest of the files and applying any other comments you have on top of that. |
|
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
|
@googlebot I consent. |
cpcallen
left a comment
There was a problem hiding this comment.
I think "Fix imports and workspace tests" might be a little under-descriptive of the changes actually contained in that commit: I was fairly confused about why you were moving most of the contents of workspace_test.js to workspace_helpers.js until I saw that testAWorkspace is now also being called from workspace_svg_test.js!
This is to be more consistent with how non-test modules are named. Also remove top-level goog.require of TestHelpers (now Blockly.test.helpers) since requiring a side-effect-less module does nothing.
4f57f53 to
f10532e
Compare
Proposed Changes
mocha_deps.jsfile that contains everything in core, generators, blocks, and mocha/tests.test_helpers.jsto be a goog.module.test_helpers.jscauses other tests to fail, so I updated a few as an example for how to fix the other ones.We were uncertain if stubbing something like
Blockly.utilx.genUidwould work when we require it through `const utils = goog.require('Blockly.utils'). I tried the below and it seemed to work, but I'm not sure it is a comparable situation.I also tried
Additional Information
I factored out
testAWorkspacefunction into its ownworkspace_helpers.jsfile. It was being used in bothworkspace_test.jsandworkspace_svg_test.jsso it made sense to me to create a workspace helper file same as we have procedure and toolbox helpers.