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

pass fixture files through the postHTML transformer code #30681

Merged

Conversation

erwinmombay
Copy link
Member

@erwinmombay erwinmombay commented Oct 15, 2020

we want our example and fixture files to be "valid html" files by default on disk, meaning the url's need to point to the cdn and it passes the validator.

For these files to be usable for tests we then need to pass them through our html transformers to change the url's and do modifications such as:

  • "esm mode" to insert the script pairing of module/nomodule.
  • changing the script src urls to localhost rtv's
  • css insertion

test/integration/test-extensions-loading.js Show resolved Hide resolved
test/integration/test-amp-ad-3p.js Outdated Show resolved Hide resolved
test/fixtures/e2e/amp-viewer-integration/viewer.html Outdated Show resolved Hide resolved
}
}

async function integration() {
buildNewServer();
htmlTransform = require('../server/new-server/transforms/dist/transform')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where does this come from? Is it something that buildNewServer() builds?

Copy link
Contributor

Choose a reason for hiding this comment

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

buildNewServer() generates this file from the TypeScript transforms.

Copy link
Contributor

@rsimha rsimha Feb 26, 2021

Choose a reason for hiding this comment

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

@erwinmombay I just saw this old review comment thread in relation to #32865 (comment). I think this should be moved to server.js. The integration test runner shouldn't have to worry about server startup logic.

@erwinmombay erwinmombay force-pushed the fix-posthtml-transformers-backup branch from b043349 to bb0f659 Compare October 19, 2020 22:16
erwinmombay and others added 24 commits October 19, 2020 22:37
…cript-transform.ts

each module should do 1 thing and 1 thing only. currently the module
transformer also did a src/url transformation. this caused weird
mismatches when they are ran together.

- added looseScriptSrcCheck to allow for non cdn domains. This will
  allow us to transition from the bad fixture files to having all html
  files be valid AMP HTML by default.
@erwinmombay erwinmombay force-pushed the fix-posthtml-transformers-backup branch from bb0f659 to 61e77f5 Compare October 20, 2020 05:37
@erwinmombay erwinmombay force-pushed the fix-posthtml-transformers-backup branch from 61e77f5 to 474c6cb Compare October 20, 2020 06:21
@erwinmombay
Copy link
Member Author

@estherkim PTAL

}
}

async function integration() {
buildNewServer();
htmlTransform = require('../server/new-server/transforms/dist/transform')
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Use SERVER_TRANSFORM_PATH from typescript-compile.js

Copy link
Member Author

Choose a reason for hiding this comment

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

hope you don't mind ill follow it up in #28336

Copy link
Contributor

@rsimha rsimha Feb 26, 2021

Choose a reason for hiding this comment

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

@erwinmombay Can we also fix this as part of #32865 (comment)?

@erwinmombay erwinmombay merged commit a9834d6 into ampproject:master Oct 20, 2020
ed-bird pushed a commit to ed-bird/amphtml that referenced this pull request Dec 10, 2020
…30681)

* make it so that src transformation only happens strictly in scripts/script-transform.ts

each module should do 1 thing and 1 thing only. currently the module
transformer also did a src/url transformation. this caused weird
mismatches when they are ran together.

- added looseScriptSrcCheck to allow for non cdn domains. This will
  allow us to transition from the bad fixture files to having all html
  files be valid AMP HTML by default.

* temp

* temp

* add transform back to integration

* fix html

* fix integration

* temp

* temp

* make transformers have a loose mode to be more forgiving on script src

* add more tests and fix bug for extention retention

* allow for mjs files to be served by the test server

* add glob to load mjs files in karma server

* lint fixes

* lint html

* break up this PR

* fix bad error formatting

* apply recs

* Update build-system/server/new-server/transforms/transform.ts

Co-authored-by: Caroline Liu <[email protected]>

* Update build-system/server/new-server/transforms/utilities/option-set.ts

Co-authored-by: Caroline Liu <[email protected]>

* fix other locations of "FORTESTING"

* fix esm and non esm tests to be green

* use writeFileSync instead of async method. seems to be a race

* guarantee directory exists first

* skip failing IE test temporarily

* applied recs

* temp "only"

* dont reroute to max json files

* change error to warning

* fix max builds and integration tests against max files

* revert bad rebase

* fix all urls to be valid for js resources

* removing debugger

* re-run broken IE test

Co-authored-by: Caroline Liu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants