silverstripe / gha-run-tests

GitHub Action - CI test runner
BSD 3-Clause "New" or "Revised" License
0 stars 4 forks source link

Javascipt diff #11

Open GuySartorelli opened 1 year ago

GuySartorelli commented 1 year ago

We've had a few PRs and merge-ups fail CI because the js step found difference between its built dist file and the one in the PR or merge-up. It takes a few tries of running yarn install && yarn build to get the same result as CI.

It's not clear what's causing this - it seems like CI is doing things correctly, because we do end up with the same result as it in the end. My current guess is that yarn install is using some slightly-outdated cache locally, which doesn't exist in CI... but the yarn.lock file being there should mean we always have the same versions of dependencies.

In either case, we need to change something either in our CI or in our local build processes because this keeps happening and is slowly becoming a barrier for getting changes through.

PR

emteknetnz commented 1 year ago

Quite possibly some difference in whitespace that git is detected

Another possibility is that yarn build includes inline comments on the local of whoever last ran yarn build but the CI doesn't do this - or vice versa. Maybe also be line-break related, specifically if there's an line-break on the very last line of the file.

emteknetnz commented 2 months ago

I think this only affects 4.13 line, specifically silvestripe-admin

I replicated this locally, all I did was run yarn build subsequent times. I took the generated client/dist/js/bundle-default.js and string replaced ; with ;\n and then look for text differences

Perhaps the older version of webpack is just a bit random with how it puts things together?

Around line 440 I found this - note that SearchBox.js changes to Search.js

emptyResultClassName:"popover-option-set__no-results",buttonClassName:"popover-option-set__button"},t.default=v},"./client/src/components/Search/SearchBox.js":function(e,t,n){"use strict";
function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");

js

emptyResultClassName:"popover-option-set__no-results",buttonClassName:"popover-option-set__button"},t.default=v},"./client/src/components/Search/Search.js":function(e,t,n){"use strict";
function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};
for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);
return n}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");