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

Update test harness #7523

Merged
merged 7 commits into from
Jan 1, 2023
Merged

Update test harness #7523

merged 7 commits into from
Jan 1, 2023

Conversation

Pessimistress
Copy link
Collaborator

With this PR:

  • We are able to write TypeScript tests
  • Tests are compiled with ts-node instead of @babel/register, which gives us type check and behavior more consistent with the TS spec
  • Browser tests are now served with vite instead of webpack. It is much faster and again better with type checks. The eventual goal is to move away from the outdated webpack 4 dependency.

There is a lot happening here, see a summary below.

Change List

  • Bump dev dependency: ocular-dev-tools, react, probe.gl
  • Remove all ES5 require() calls from source and tests.
  • Remove reference to node-only modules in tests (vite does not polyfill the browser environment as aggressively as webpack)
  • A few dependencies d3 and tiny-sdf are of type: 'module' and cannot be imported from commonjs under Node. ts-node has experimental support for esm modules, however module aliasing does not work yet. For now I'm patching these packages locally to add a cjs entry point.
  • Fix bench tests

@Pessimistress
Copy link
Collaborator Author

Render tests are failing due to Chrome version update. Some of the visual differences are not trivial; I need more time to investigate.

Copy link
Collaborator

@ibgreen ibgreen left a comment

Choose a reason for hiding this comment

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

Impressive effort!

However, two things stand out as particularly problematic

  • the patches, this doesn't seem like something we should be dealing with if at all possible
  • the extensive changes to the jupyter module, which I really would like to see as a separate PR. Given the low amount of maintainer bandwidth that component has, I would prefer for work there to be isolated and carefully reviewed rather than shoehorned in via a monster infrastructure PR.

const deck = globalThis.deck || {};

// Check if peer dependencies are included
if (!deck.LineLayer) {
throw new Error('@deck.gl/layers is not found');
}

module.exports = Object.assign(deck, deckGLLayers);
export default Object.assign(deck, deckglAggregationLayers);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe this comment is best resolved at a later stage by creating two separate bundle.ts scripts, but...

I think we should aim to build scripts that support the new dynamic import script syntax. And if so a default export is not what one would expect from such a "type: module" script. That module should only export its actual symbols.

Also splitting the side effect (Object.assign) from the export would be a little clearer as they are quite different.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can test it. The bundles are not currently used via require() anyways, but via the global window.deck object.

@@ -27,7 +27,7 @@
],
"sideEffects": false,
"scripts": {
"build-debugger": "webpack ./bundle/debug.js -p -o ./debug.min.js --config ../../scripts/bundle.config.js",
"build-debugger": "webpack ./bundle/debug.ts -p -o ./debug.min.js --config ../../scripts/bundle.config.js",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Interesting, what does build-debugger do?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@@ -25,17 +25,19 @@ import log from '../utils/log';
import {register} from '../debug';
import jsonLoader from '../utils/json-loader';

const _global: any = globalThis;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This does not look right. You should be able to declare global or just use globalThis['DECK_VERSION'].

modules/google-maps/src/google-maps-overlay.ts Outdated Show resolved Hide resolved
modules/jupyter-widget/src/lib/jupyter-transport-view.js Outdated Show resolved Hide resolved
patches/@mapbox+tiny-sdf+2.0.5.patch Outdated Show resolved Hide resolved
test/modules/jupyter-widget/dummy-jupyter-widgets-base.js Outdated Show resolved Hide resolved
test/node.ts Outdated Show resolved Hide resolved
@Pessimistress Pessimistress force-pushed the x/dev-tools branch 2 times, most recently from 43393bb to 79f4271 Compare December 20, 2022 19:58
@coveralls
Copy link

coveralls commented Dec 29, 2022

Coverage Status

Coverage: 89.021% (+7.4%) from 81.669% when pulling 55e733c on x/dev-tools into 79d6ef9 on master.


let failed = false;
// @ts-expect-error browserTestDriver_finish injected by BrowserTestDriver
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit for later: Might be nice to get rid of the ts-expect-errors here?

declare global {
  var browserTestDriver_fail: any; // Or maybe better function type.
  ...
}

@Pessimistress Pessimistress merged commit 59c2651 into master Jan 1, 2023
@Pessimistress Pessimistress deleted the x/dev-tools branch January 1, 2023 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants