* Remove CircleCI and codecov
* Add GitHub Actions workflow
* Add Browserstack credentials
* Skip tests if ci skip or skip ci is in commit messages
* Update and rename test.yml to ci.yml
* Postfix artifacts name with browser
* Disable proxy on chrome
* Update dockers/screenshotter/screenshotter.js
* Add status badge
* Set directory option in codecov action
* Run Browserstack on forked repo via label
* Print Docker logs
* Disable GPU on ChromeDriver
* Add comments
* Add comments
* Support Browserstack in screenshotter
* Support Browserstack in CircleCI
* Test screenshots on Safari 13.1
* Don't run Safari screenshotter on forked PRs
* Update a screenshot
* Ignore *.log in .gitignore
* Bump flow version
* Bump jest version
* Bump eslint version
* Bump rollup version
* Bump webpack version
* Bump misc dependencies and update lockfile
* Update lockfile
* Bump commander version
* Bump misc dependencies
* Bump istanbul version
* Bump docusaurus version
* Update lockfile
* Explicitly declare dependencies
* Bump caniuse-lite version
* Update lockfile
* Bump commander version
* Bump webpack and css-loader version
* Bump flow version
* Use babel-plugin-preval instead of own unicodeMake for unicodeSymbols
* Fix circular dependency transpiling issue
* Flow type unicodeSymbols.js
Co-authored-by: Erik Demaine <edemaine@mit.edu>
* Allow screenshotter on IE, Edge, and Safari
* Set Firefox options only on Firefox
* Add --selenium-capabilities option to support setting capabilities
* Quit web driver after test finishes
* Upgrade to style-loader 0.22.1 for IE compatability
* Collect code coverage in screenshotter tests
* Using instanbul, no additional dependencies required as they are part
of jest
* Collect in CircleCI builds and upload to Codecov
* Remove clover report
* screenshotter: replace promisify(fs) and mkdirp with fs-extra
* screenshotter: replace selenium.promise with builtin Promise
* Lint all JavaScript files in the root
* unicodeMake: replace console.log with writeFile(string)
* unicodeMake: check timestamp, do not build if up-to-date
* Replace check-dependencies with yarn check
* Exclude src/unicodeMake.js from coverage
* Add (missing) dependencies
* Skip CircleCI if only unrelated has been changed
* Fix commit range
* Use fs-extra in update-sri
* Do not compile contrib when running screenshotter
* Add test job to CircleCI
* Update config.yml
* Fail if PR exists but running on the forked repo
* Update Screenshotter README.md
* Store artifact at the root
* Add CircleCI badge
* Add `codecov` to CircleCI
* Change build directory to `dist`
* Screenshotter chdir to KaTeX root directory
Fix#1501. This seems to be required for webpack, specifically
`babel-plugin-version-inline`, to run correctly.
* lint fix
* Switch from nomnom to commander
* Fix#1489
* --macro repeatable option replaced with single --macros option with ";"
separator (until https://github.com/tj/commander.js/issues/674)
* Add missing --max-expand option
* Replace expired --unicode-text-in-math-mode option with --strict
(https://github.com/Khan/KaTeX/issues/1483#issuecomment-405108291)
* Add instructions for how to run in the opening comments
* Clean up option doc strings
* Implement @ylemkimon's comments
* Fix try/const bug
* Fix use of --selenium-ip
It was a quirk that --seleniumIP worked. --help lists --selenium-ip.
* Implement comments, restore --macro repeatable argument
* Cleanup
* Restore 0 default for maxExpand
* Fix more comments from @ylemkimon
* npm run dist -> npm run build
In preparation for #1500
* Fix line length error
* Add regenerate option to the screenshotter
Save new screenshot when match fails
* Ignore Chrome debug log file
* CircleCI: Generate only failed screenshots
* CircleCI Test
* Revert "CircleCI Test"
This reverts commit 5d3afb2602f32470eeba7767748faba177ba933e.
* Rename `regenerate` to `new`
* Add ` /test/screenshotter/new/` to .gitignore
* Update texcmp
I found that the existing docker rules for texcmp did not make a working
installation of LaTeX; in particular, it was missing a lot of the recently
added packages. I updated to Ubuntu 17.10 and tweaked the package listings
until things compiled again. Now I can run texcmp again.
* texlive-font-utils not necessary
* Add CircleCI config for online screenshot verification/generation
* Remove `Checkout unicode fonts` step
Unicode-fonts are now a submodule, which is checked out in `Checkout submodule` step.
* Always generate new screenshots
* Group more test npm scripts into `test:`
* Update documentations on the development workflow
* Update .travis.yml to match updated NPM scripts
* Run npm install in Travis
* Create a separate entry point for webpack
Created a webpack entry point for KaTeX, which imports katex.less. As
flow[1] and jest[2] doesn't support CSS modules natively, a separate
entry point is used and it is not flowtyped.
[1] https://gist.github.com/lambdahands/d19e0da96285b749f0ef
[2] https://facebook.github.io/jest/docs/en/webpack.html
* Use webpack to build files
* Made webpack.config.js export valid webpack configuration
* Use:
browserify -> webpack
babelify -> babel-loader
UglifyJS CLI -> UglifyJsPlugin
Less CLI -> less-loader
cleancss -> cssnano in css-loader
build/fonts -> file-loader
* Inline CSS(Less) using style-loader and export them using
ExtractTextPlugin
* Add `watch` npm script calling `webpack --watch`
* Improve local testing(webpack-dev-server)
* Made webpackDevServer export a valid webpack configuration
* Compile Less and inline CSS using less-loader and style-loader
* Instead of copying files serve files from /static and use file-loader
* Remove old server.js and its dependencies
* Use webpack-dev-server in Screenshotter
* Include contrib in webpack-dev-server
+ Moved common configurations to webpack.common.js
* Rename webpackDevServer.js to webpack.dev...
to be consistent, avoid confusion with webpack-dev-server and follow
webpack configuration naming convention.
* Remove unnecessary conditional output.path
* Use map instead of reduce
+ Add comments regarding function arguments
* Remove unnecessary mkdir and clean build/* before build
* Use katex as external dependency instead of global variable in contrib
Fixes#692.
* Unblock codes as they are built as a module
* Update package-lock.json
* Add comments regarding devServer option
* Lint renamed webpack.dev.js
a0d8b33
* Export ES6 module and expose its default export
* Revert "Browserify hotfix (#1057)"
This reverts commit f6b509123b.
* Enables colors on the console when running the dev server in Screenshotter
* Add context to webpack configuration
Allows webpack to be run from other directories
* Move `rm -rf build/*` to npm scripts
* Check dependencies before build
* Move UglifyJsPlugin into config creation
* Let webpack handle ES6 modules
Do not transform modules to commonjs in Babel. However Jest doesn't not
support ES6 modules, so transfrom modules to commonjs when NODE_ENV is
`test`.
* Add documentation on testing in IE 9 and 10 using webpack-dev-server
Changed version range to include IE-compatible version
* Modernize font creation
* Automate the build process, instead of writing a complicated manual
* Update sources used by the docker image away from google code
* Exclude MathJax-dev checkout from docker image, to allow image reuse
* Try to keep the individual image layers small by combining RUN commands
and removing temporary files used only during each individual step
* Allow creating fonts from local directory
Also use hash of Dockerfile to compute image tag, in order to ensure
creation of a new image if the Dockerfile changes.
* make glob syntax work on MacOS
* Make KaTeX work in Quirks mode
Summary: In issue #601, it was noticed that the KaTeX bug with the fraction
bars overlapping the text was occuring with an XHTML doctype. This indicated
that the bug we were seeing was caused by both quirks mode and limited-quirks
mode (which is a version of quirks mode with fewer quirks and is enabled for
various doctypes including some XHTML ones).
Based on the [quirks spec](https://quirks.spec.whatwg.org/), it appears that
there are only two quirks in limited-quirks mode, both having to do with a
line-height calculation. @gagern figured out that if we added some zero-width
spaces in our elements, we would stop triggering the quirk, which would make
our fractions render correctly in limited-quirks mode.
I implemented that change, and ran the screenshotter in limited-quirks mode.
There were several other places that suffered from the same quirk, but were
also easily fixed via adding zero-width spaces. I then ran the screenshotter in
quirks mode, and discovered that (once an appropriate meta charset was added),
everything looked correct still.
So, this diff fixes all of the places that the limited-quirks mode quirks
affect our rendering, and removes the warning about rendering in quirks mode.
I also added support to our screenshotter to render things in both no-quirks
and quirks mode, to ensure that things don't break in the future. I copied the
non-quirks images to the quirks images, and ran the screenshotter with
`--verify` to make sure that they look the same.
I have some thoughts that I'd like to hear opinions about:
- I'm not super happy with how the screenshot tests work. Ideally we'd test
both quirks mode and non-quirks mode against the same images, since we'd
like them to be the same. I'm not sure how to make that work well, though,
since then people wouldn't be able to tell if it's a quirks-mode problem or
not.
- I removed the doctype in the testing page file, so all testing would now be
done in quirks-mode. Not sure if we really want that.
- I need to test this in IE, but it looks like the trailing commas change we
made with eslinting is causing problems (cause IE doesn't like trailing
commas).
Test Plan:
- `./dockers/Screenshotter/screenshotter.sh --verify`
* Compare quirks mode against same screenshot files
Now the screenshotter itself can run more than one mode. It does serve the
HTML file from its own JavaScript code now, so that it can include different
doctype headers without needing distinct files for each. There is a
provision to mark specific tests as quirky in case they produce different
results depending on the mode.
* Some cleaning up and comments
* Restore access to the babelified version of the HTML page for screenshots
* Reference unicode fonts using absolute path names
This avoids issues caused by the fact that the dynamically generated
ss-render.html is mounted to a different location than the test.html from
which it is derived.
* do chrome screenshots first
* remove commented out code, simplify hadle_search_string call
Previously, we added a `oneDone` promise *every time a test attempt
failed*. This decremented the count of remaining tests once per
failed attempt. As a result, Chrome tests didn't run to the end.
The slowest part of screenshotter tests is the page load, probably
because so many assets must be loaded over the slow docker
connection. On my laptop this takes ~4s per test. The new default
avoids this cost by rendering new TeX on the existing
page. For second and subsequent tests, use `executeAsyncScript`
to call KaTeX, rather than performing a full page + asset load.
(If too many errors happen in `--verify` mode, we fall back to
full loads.) The `--reload` flag will enable the previous behavior.
On my laptop, a full verify (chrome + FF) used to take 12m20s+.
It now takes 2m23s, a speed up of 6x.
* Add babel transform-class-properties to have static class properties
* Upgrade Lexer and Parser files to use ES6 classes
* Update eslint max line length to 90 character (more indent because of using ES6 classes)
* Upgrade eslint and jasmin to support ES stage-2 features
* Use static properties to place constants near their functions
* Migrate all remaining sources to ES6 syntax
* Increase eslint max line length to 84
* Remove non-babelified endpoint in dev server.js
* Clean up server.js functions after removing browserified
* Make screenshotter not to use babel endpoint as we babelify everything now
* Update texcmp to ubuntu 17.04 and avoid mounted host directory
Switch to linux 17.04 in order to have a version of nodejs which understands
ES6 syntax, for the sake of a consistent codebase.
Avoid mounting the host directory, but use “docker cp” instead to transfer
files between host and container. This should avoid ownership and
permission issues.
Support macros with positional arguments.
Fix one overline example which caused LaTeX failure due to missing braces.
* Extract texcmp results as current user
This allows running the texcmp.sh script using sudo on afs.
* Change texcmp conversion to gray
As per #708, this should increase compatibility with older versions of
imagemagick, and might also do a better job of preserving the original sRGB
color space.
* Abandon tar and use plain docker cp instead
Thanks to Erik Demaine for suggesting this.
* Move npm install into creation of texcmp docker image
As babelify is slow, it may be desriable to not run it during development.
This is OK if the browser is recent enough to understand ES6 natively.
(This does not include current Firefox due to it having problems with
for(const … in …), https://bugzilla.mozilla.org/show_bug.cgi?id=1094995.)
For older browsers, or to check issues possibly introduced by babelify,
adding /babel as the first component of the path will switch to a version
which has been processed by babelify. This is also used for screenshots.
This reverts commit 4d2e46e7f6.
Having trailing commans makes diffs easier to read as it avoids modifying a
line just to add a trailing comma if there is another item to add at the end
of a list. There are plans to switch to ES6 notation and to translate that
to ES5 as part of the build process. Since that translation would remove
trailing commas, the IE9 problems that originally motivated the commit
should vanish soon.
All these version ranges include the latest version at the time of this
commit, except for the selenium webdriver. There version 3 is incompatible
with version 2, and switching to a version 3 library appears to require
switching to version 3 docker images as well, which would entail using
different browser versions which in turn would lead to differences for a
large number of screenshots. That doesn't appear warranted at this time.
Summary: IE 9 doesn't like trailing commas. When we introduced eslint, we added
a bunch of trailing commas, which makes IE 9 sad.
Test Plan:
- `make lint`
- Visit http://localhost:7936/ using IE 9 on browserstack.
- See that the math loads, and there are no errors in the F12 developer tools.
@kevinb
Experimenting with selenium-webdriver@3.0.1 and Firefox 50.1.0 I observed
screenshots having a height of merely 8 pixels. Presumably the margin or
padding of an otherwise empty document. So in order to get the actual size
of the document area, the screenshotter now loads a document which fills the
entire viewport.
* Exit cleanly after invalid screenshot test name
This avoids waiting forever.
* Auto-detect host IP in Docker for Mac environment
This checks all available network addresses to find one which the Selenium
container can connect to. That way we don't have to analyze network
settings or similar to figure out the main public IP address of the machine.
* Make server less sensitive to current working directory
That way it becomes possible to run screenshotter.js from within the
Screenshotter directory, and still server all files as intended.