Commit Graph

21 Commits

Author SHA1 Message Date
Jack Franklin
32300efccd
chore: reduce docusaurus versions that we generate (#7657)
The Docusaurus process has been OOMing on the bots; this is a problem
we'll want to fix properly when we are shipping the new docs fully, as
we want to generate docs for old versions; but for now whilst we're not
fully pushing users to this site, we can just generate one version and
not worry about multiples.

This commit also bumps the version of Docusaurus to the latest beta
version.
2021-10-08 13:39:49 +00:00
TASNEEM KOUSHAR
c5a0d500e4
chore: add documentation to new website 2021-08-04 09:00:48 +00:00
Jack Franklin
6a0eb7841f
fix: wider compat TS types and CI checks to ensure correct type defs (#6855)
* fix: wider compat TS types and CI checks to ensure correct type defs

This PR improves our TS types further to make sure they are usable in a
TS environment where ES Modules are the target output. Our use of
`export =` is problematic this environment as TypeScript does not allow
`export =` to be used and it errors.

The fix for the type issues to avoid `export =` is to instead define the
functions that you gain access to when you import Puppeteer as top level
functions in our `types.d.ts` file. We can do this by declaring them
explicitly in `src/node.ts`. These are then rolled into `lib/types.d.ts`
at build time. The downside to this is that we have to keep those
declarations in sync with the Puppeteer API; should we add a new method
to the `Puppeteer` class, we must add it to the `nodes.ts` declarations.
However, this could easily be automated by a small script that walks the
AST and generates these. I will do that in a follow-up PR, but I
consider this low risk given how rarely the very top level API of
Puppeteer changes. The nice thing about this approach is we no longer
need our script that hacks on changes to `lib/types.d.ts`.

To avoid yet more releases to fix issues in one particular TS
environment, this PR also includes a suite of example setups that we
test on each CI run. Each sample folder contains `good.ts`, which should
have no TS errors, and `bad.ts`, which should have some errors. The test
first packs Puppeteer into a tar, and then installs it from that tar
into each project. This should replicate how the published package
behaves when it is installed. We then check that we get no errors on
`good.ts`, and the expected errors on `bad.ts`.

We have a variety of test projects that cover both TS and JS source
code, and CJS and ESM imports and outputs.
2021-02-10 12:04:36 +00:00
Lars den Bakker
15d1906e7c
feat: add web test runner (#6200) 2020-07-22 13:14:35 +02:00
Jack Franklin
f1a6b8d66d
chore: vendor Mitt & update project structure (#6209)
* chore: vendor Mitt into src/common/third-party

As discussed in #6203 we need to vendor our common dependencies in so
that when we ship an ESM build all imports point to file paths and do
not rely on Node resolution (e.g. a browser does not understand `import
mitt from 'mitt'`).
2020-07-14 16:57:29 +01:00
Jack Franklin
31309b0e20
chore: use devtools-protocol package (#6172)
* chore: Use devtools-protocol package

Rather than maintain our own protocol we can instead use the devtools-protocol package and pin it to the version of Chromium that Puppeteer is shipping with.

The only changes are naming changes between the bespoke protocol that Puppeteer created and the devtools-protocol one.
2020-07-10 11:51:52 +01:00
Jack Franklin
2529ee6508
chore(eslint): add eslint typescript linting (#5635)
This commit adds linting for `*.ts` files and loads up the recommended
list of TS rules from the ESLint TypeScript plugin. We can adjust the
exact rules overtime, but starting with the recommended list seems
sensible.
2020-04-14 12:08:52 +01:00
Jack Franklin
0bcc5a7ad8
chore: migrate remaining tests to Mocha (#5616)
This commit updates all the non-Puppeteer unit tests to run using Mocha and then deletes the custom test runner framework from this repository. The documentation has also been updated.
2020-04-09 20:12:32 +02:00
Jack Franklin
7a2a41f208
chore: move code to src/ and emit with TypeScript (#5568)
This updates our `tsconfig.json` so it emits our JavaScript files as
well as type checking them. We compile into `./lib` which we then ship
in our npm package. The source code has moved from `./lib` into `./src`.

Because the `src/` directory is exclusively JS files, this change is a
no-op in terms of code functionality but is the first step towards being
able to replace `src/X.js` with `src/X.ts` in a way that allows us to
migrate incrementally.

The `lib` directory is gitignored, and the `src` directory is
npmignored. On `npm publish` we will now run `npm run tsc` in order to
generate the outputted code.
2020-04-02 16:25:19 +02:00
Andrey Lushnikov
45ab3e0332
feat: introduce puppeteer-firefox (#3628)
This adds a proof-of-concept of `puppeteer-firefox`.
This consists of two parts:
- `//experimental/juggler` - patches to apply to Firefox.
- `//experimental/puppeteer-firefox` - front-end code to
be merged with Puppeteer.

As things become more stable, we'll gradually move it out of
the experimental folder.
2018-12-06 11:24:00 -08:00
Andrey Lushnikov
6ec3ce6920
chore: make sure Puppeteer bundling works (#3239)
This patch:
- adds "browser" field to the package.json with default
  bundling options.
- introduces "bundle" and "unit-bundle" commands to
  create bundle and test bundle
- starts running bundle tests on Travis Node 8 bots

Fixes #2374.
2018-09-13 20:08:51 +01:00
Andrey Lushnikov
871b204fd1
refactor: simplify EmulationManager (#2816)
EmualationManager used to be injecting touch hooks to properly
support touch emulation.

However, these are no longer necessary, since https://crbug.com/133915
is long fixed.
2018-06-28 18:48:44 -07:00
Andrey Lushnikov
e6725e15af
tests: drop jasmine test runner (#1519)
This patch introduces a tiny test runner to run puppeteer tests.
The test runner is self-container and allows parallel (wrt IO) test execution.
It will also allow us to split tests into multiple files if necessary.

Comparing to the jasmine, the testrunner supports parallel execution, properly
handles "unhandled promise rejection" event and signals.

Comparing to ava/jest, the testrunner doesn't run multiple node processes,
which makes it simpler but sufficient for our goals.
2017-12-07 16:37:22 -08:00
JoelEinbinder
cd81944e66 Test node6 on travis (#551)
This patch starts running all puppeteer tests with node6 on travis-ci.
2017-08-25 19:28:49 -07:00
JoelEinbinder
9212863b92 Node 6 support (#484)
This patch:
- introduces a transpiler which substitutes async/await logic with
generators.
- starts using the transpiler to generate a node6-compatible version of puppeteer
- introduces a runtime-check to decide which version of code to use

Fixes #316.
2017-08-24 12:20:05 -07:00
JoelEinbinder
e6d8fca7cd Lint examples, again #178 (#190) 2017-08-02 15:03:26 -07:00
JoelEinbinder
0218960713 Revert "lint examples #178 (#182)" (#183)
This reverts commit 8c220654e8.
2017-08-02 01:26:02 -07:00
JoelEinbinder
8c220654e8 lint examples #178 (#182)
This patch enables lint in `examples/` folder.
2017-08-02 01:13:44 -07:00
Andrey Lushnikov
75a8d7b0c3 [doclint] Prepare doclint for more checks
This patch refactors doclint so that more checks and more generators
could be added.

This patch:
- Introduces 'Source' class, which holds file content in-memory and
  allows it to be updated.
- Introduces 'Message' class - which is a pair of a text and a type.
  Messages could have either 'error' type or 'warning' type.
2017-07-31 00:10:59 -07:00
Andrey Lushnikov
d99031ba46 [doclint] Move doclint under utils/
This patch:
- moves doclint under utils/ folder
- adds tests to verify doclint basic functionality

This patch also drops the jasmine as a spec runner for the doclint
checks. It turned out it's hard to customize jasmine's behavior,
so instead this patch implements a dummy spec runner.

The dummy spec runner allows us:
- to format messages however we want (the custom jasmine reporter would
  also allow us to do this)
- to avoid `beforeAll` functions which pollute global to pass
  initialized variables over to specs

References #14
2017-07-13 00:28:52 -07:00
Andrey Lushnikov
1f51384918 Introduce Eslint to validate style
This patch introduces eslint and fixes multiple minor code
style issues.
2017-06-11 01:32:59 -07:00