Skip to content

Commit

Permalink
update test (#1846)
Browse files Browse the repository at this point in the history
* chore: fix test

* chore: update vite version

* chore: update test snapshots

* chore: remove pnpm-lock.yaml

* chore: update workflows

---------

Co-authored-by: Aaron <[email protected]>
  • Loading branch information
wang1212 and Aarebecca authored Nov 25, 2024
1 parent a2b137e commit 93c69fa
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 14,630 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/test.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,27 @@ jobs:
with:
python-version: '3.10'

- uses: pnpm/action-setup@v2
with:
version: 9

- name: Use Node.js 20
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'pnpm'

- uses: pnpm/action-setup@v4
with:
version: 9

- name: Install dependencies
run: pnpm install
run: pnpm install --no-frozen-lockfile

- name: Install Playwright browsers
run: npx playwright install --with-deps

- name: Build
run: pnpm build

- name: Lint
run: pnpm lint

- name: Test
run: pnpm test

Expand Down
32 changes: 0 additions & 32 deletions .github/workflows/lint.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pids
*.seed
*.pid.lock
yarn.lock
pnpm-lock.yaml
.dumi

# Directory for instrumented libs generated by jscoverage/JSCover
Expand Down
7 changes: 5 additions & 2 deletions __tests__/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>G: Preview</title>
<style>
/* html {
html {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
width: 100vw;
height: 100vh;
margin: 0;
padding: 8px;
} */
}

.lil-gui.root {
position: absolute;
Expand Down
2 changes: 1 addition & 1 deletion __tests__/integration/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function generateCanvasTestCase(

// Chart already rendered, capture into buffer.
const buffer = await page
.locator(renderer === 'svg' ? 'svg' : 'canvas')
.locator(`#container ${renderer === 'svg' ? 'svg' : 'canvas'}`)
.screenshot();

const dir = `${__dirname}/snapshots/${namespace}/${renderer}`;
Expand Down
Binary file modified __tests__/integration/snapshots/2d/canvas/text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified __tests__/integration/snapshots/2d/svg/text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified __tests__/integration/snapshots/2d/webgl/text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions __tests__/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,11 @@ plot();
async function plot() {
if (currentContainer) {
currentContainer.remove();
if (canvas) canvas.destroy(false, true);
if (canvas) canvas.destroy();
if (prevAfter) prevAfter();
}
currentContainer = document.createElement('div');
currentContainer.id = 'container';
app.append(currentContainer);
const render = tests[selectChart.value];
render?.(currentContainer);
Expand Down Expand Up @@ -233,7 +234,7 @@ function createSpecRender(object) {
$stats.style.position = 'fixed';
$stats.style.left = '2px';
$stats.style.top = '2px';
// document.body.appendChild($stats);
document.body.appendChild($stats);

// GUI
const gui = new lil.GUI({ autoPlace: false });
Expand Down
1 change: 1 addition & 0 deletions __tests__/unit/abstract-renderer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ describe('Abstract renderer', () => {
enableRenderingOptimization: false,

Check warning

Code scanning / CodeQL

Duplicate property Warning test

This property is duplicated
in a later property
.
enableDirtyRectangleRendering: true,
enableDirtyRectangleRenderingDebug: false,
enableRenderingOptimization: false,
enableSizeAttenuation: true,
});

Expand Down
10 changes: 5 additions & 5 deletions __tests__/unit/display-objects/display-object.node.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,11 @@ describe('DisplayObject Node API', () => {
return group.get('name') === 'group5';
}),
).toBeNull();
// expect(
// group1.find(() => {
// return true;
// }),
// ).toBe(group4);
expect(
group1.find(() => {
return true;
}),
).toBe(group2);

expect(
group1.findAll(() => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"tinybench": "^3.0.3",
"ts-jest": "^29.1.1",
"typescript": "^5.6.2",
"vite": "^3.2.7",
"vite": "^4.5.5",
"webfontloader": "^1.6.28"
},
"limit-size": [
Expand Down
Loading

0 comments on commit 93c69fa

Please sign in to comment.