-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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(build): build/test on windows #6431
fix(build): build/test on windows #6431
Conversation
* chore(deps): bump @hyperjump/json-schema from 0.18.4 to 0.18.5 * chore(deps): add gulp-gzip 1.4.2 * build: migrate test scripts to gulp task (test_tasks.js) * build: not to use the grep command * build: normalize path
e9aeb12
to
a4cf041
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello Yutaka,
Thank you for sending us this substantial and very important PR. We definitely want to make it easier for Windows-using developers to be able to contribute to Blockly, and we know that their experience at the moment is not great. We really appreciate your efforts to help improve it.
Overall this PR looks very good, but there are some changes that will be needed before we can merge it. Most are minor (see below), but there are few slightly higher-level ones too:
- Our current
run_all-_tests
script will plow ahead even when some of the tests fail. That's actually not great, because ifbuild-debug
fails we don't want to runmetadata
,mocha
,generators
,package
, ornode
, but on the other hand your changes mean that an eslint failure will prevent any subsequent tests from running, which is too harsh. We want to run as many tests as we sensible can even if some of them fail—while making sure that GitHub CI still knows that there were failures. - It would be better to maintain the same nice formatting of test output as previously. See detailed comment below about this, but note also that it would be nice if we could suppress the "Starting" and "Finished" messages generated by Gulp.
- There are quite a few functions in
test_tasks.js
that could probably be written more concisely asasync function
s.
Finally:
There is also the question of whether we want to be converting shell scripts to Gulp tasks. I put this question to the team, and the main observations were:
- there is a general preference for node scripts over bash scripts, but
- we're probably going to try to remove Gulp from our build system before too long.
To that end: your test_tasks.js
is a good step on the road from bash to plain JS, and I'm happy to accept it with only minor fixes as noted—but please feel free also to modify it to NOT to use gulp features (and async features generally) where it doesn't need to: making it more like a plain, synchronous node script like tests/migration/validate-renamings.js
could make it simpler and will probably be more helpful to us in the long run.
scripts/gulpfiles/test_tasks.js
Outdated
if (failed === 0) { | ||
done(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The callback should always be (eventually) called, but it can be passed an Error if the task fails. Try something like:
if (failed === 0) { | |
done(); | |
} | |
done(failed > 0 ? new Error(/* useful message */) : undefined); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the implementation to no callbacks.
scripts/gulpfiles/test_tasks.js
Outdated
function generators(done) { | ||
fs.mkdirSync(TMP_DIR); | ||
|
||
execSync('node tests/generators/run_generators_in_browser.js'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this just be a require('../../tests/generators/run_generators_in_browser.js
)`?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed as suggested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the execution of run_mocha_tests_in_browser.js
as well.
scripts/gulpfiles/test_tasks.js
Outdated
if (failed === 0) { | ||
console.log(`${BOLD_GREEN}All generator tests passed.${ANSI_RESET}`); | ||
done(); | ||
} else { | ||
console.log(`${BOLD_RED}Failures in ${failed} generator tests.${ANSI_RESET}`); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above: done
should always be called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the implementation to no callbacks.
Thank you for reviewing my PR. |
de7a728
to
0090d4b
Compare
Hello @cpcallen , I changed it based on your comments, so please check it.
|
* Add JSDoc comment * Line length <= 80 characters. * Formatting test output as previously. * Always continue even if a test unit fails. * Suppress the gulp messages. * Fix test_tasks.js to pass eslint.
0090d4b
to
0b42d80
Compare
* Change generator test output directory. * Formatting test output as previously.
I also fixed the overlooked content, so please check it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry it's taken me so long to re-review this PR. With your updates everything is looking great. Thanks for taking the time to do this work, and then additionally to respond so positively to all of my nit-picking. A big thank-you from all of us.
entry: posixPath((argv.compileTs) ? | ||
path.join(TSC_OUTPUT_DIR, CORE_DIR, 'main.js') : | ||
path.join(CORE_DIR, 'main.js')), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that you are trying to helpfully merge in code from getChunkOptions
that I should have deleted that code in PR #6220. Ooops! Since it obviously hasn't been causing any problems until now I'm not going to block this PR because of my own mistake.
I believe that if I had removed that code as I intended to then the you would have written this instead, and I will apply this fix in another PR I am preparing that touches all of this again anyway:
entry: posixPath((argv.compileTs) ? | |
path.join(TSC_OUTPUT_DIR, CORE_DIR, 'main.js') : | |
path.join(CORE_DIR, 'main.js')), | |
entry: posixPath(path.join(CORE_DIR, 'main.js')), |
if (argv.compileTs) { | ||
chunks[0].entry = path.join(TSC_OUTPUT_DIR, chunks[0].entry); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I should have deleted this bit a long time ago.
Hi @yamadayutaka: @rachel-fenichel ran in to a small problem with |
Hi @cpcallen and @rachel-fenichel, Sorry for the lack of confirmation. Thank you for your fix. |
Thanks for the confirmation! |
The bash script tests/run_all_tests.js was deleted in PR google#6431, where it was replaced by `scripts/gulpfiles/test_tasks.js`, but it was inadvertently resurrected by PR google#6475, apparently due to an error when manually resolving conflicts for merge commit 00676ed. Begone, undead script!
The basics
npm run format
andnpm run lint
The details
Resolves
Proposed Changes
Behavior Before Change
The following commands are failing.
npm run build
npm run test
Behavior After Change
The following commands are successful.
npm run build
npm run test
Reason for Changes
For development on Windows environment.
Test Coverage
Confirmed in the following environments.
https://github.com/yamadayutaka/blockly/actions/runs/3060923144