Merge pull request #692 from toeverything/chore/remove-jest

chore: remove jest; using playwright over whole project
This commit is contained in:
DarkSky
2023-01-09 14:01:57 +08:00
committed by GitHub
35 changed files with 71 additions and 1349 deletions
-1
View File
@@ -1,5 +1,4 @@
**/webpack.config.js
**/jest.config.js
**/scripts/*.js
**/node_modules/**
.github/**
+1 -1
View File
@@ -36,7 +36,7 @@ jobs:
scope: '@toeverything'
cache: 'pnpm'
- run: node scripts/module-resolve/ci.js
- run: node scripts/module-resolve/ci.cjs
- name: Restore cache
uses: actions/cache@v3
+1 -1
View File
@@ -244,7 +244,7 @@ jobs:
scope: '@toeverything'
cache: 'pnpm'
- run: node scripts/module-resolve/ci.js
- run: node scripts/module-resolve/ci.cjs
- name: Restore cache
uses: actions/cache@v3
+1 -1
View File
@@ -23,7 +23,7 @@ jobs:
scope: '@toeverything'
cache: 'pnpm'
- run: node scripts/module-resolve/ci.js
- run: node scripts/module-resolve/ci.cjs
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
+1
View File
@@ -48,6 +48,7 @@ Thumbs.db
out/
module-resolve.js
module-resolve.cjs
/test-results/
/playwright-report/
/playwright/.cache/
+2 -2
View File
@@ -1,11 +1,11 @@
const fs = require('fs');
function getCustomize() {
const customed = fs.existsSync('./module-resolve.js');
const customed = fs.existsSync('./module-resolve.cjs');
if (!customed) {
return null;
}
const script = require('./module-resolve.js');
const script = require('./module-resolve.cjs');
return script && script.resolve;
}
-19
View File
@@ -1,19 +0,0 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
projects: ['<rootDir>/packages/app'],
preset: 'ts-jest',
testEnvironment: 'node',
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
transform: {
// '^.+\\.[tj]sx?$' to process js/ts with `ts-jest`
// '^.+\\.m?[tj]sx?$' to process js/ts/mjs/mts with `ts-jest`
'^.+\\.tsx?$': [
'ts-jest',
{
useESM: true,
},
],
},
};
+2 -4
View File
@@ -4,6 +4,7 @@
"private": true,
"author": "toeverything",
"license": "MPL-2.0",
"type": "module",
"scripts": {
"dev": "pnpm --filter=!@affine/app build && pnpm --filter @affine/app dev",
"dev:ac": "pnpm --filter=!@affine/app build && NODE_API_SERVER=ac pnpm --filter @affine/app dev",
@@ -15,7 +16,7 @@
"test": "playwright test",
"test:dc": "pnpm --filter @affine/datacenter test",
"test:e2e:codegen": "npx playwright codegen http://localhost:8080",
"test:unit": "jest",
"test:unit": "playwright test --config=playwright.config.unit.ts",
"postinstall": "husky install",
"notify": "node --experimental-modules scripts/notify.mjs",
"check:ci": "pnpm lint & pnpm test"
@@ -26,7 +27,6 @@
},
"devDependencies": {
"@changesets/cli": "^2.26.0",
"@jest/globals": "^29.3.1",
"@playwright/test": "^1.29.1",
"@types/eslint": "^8.4.10",
"@types/node": "^18.11.17",
@@ -38,10 +38,8 @@
"eslint-plugin-prettier": "^4.2.1",
"got": "^12.5.3",
"husky": "^8.0.2",
"jest": "^29.3.1",
"lint-staged": "^13.1.0",
"prettier": "^2.7.1",
"ts-jest": "^29.0.3",
"typescript": "^4.9.3"
},
"eslintConfig": {
-5
View File
@@ -1,5 +0,0 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
@@ -1,7 +1,7 @@
import { describe, test, expect } from '@jest/globals';
import { test, expect } from '@playwright/test';
import { printer } from './../printer';
const chalk = require('chalk');
describe('printer', () => {
test.describe('printer', () => {
test('test debug', () => {
expect(printer.debug('test debug')).toBe(
chalk.green`debug` + chalk.white(' - test debug')
@@ -1,7 +1,7 @@
import { describe, test, expect } from '@jest/globals';
import { test, expect } from '@playwright/test';
import { isMobile } from '../get-is-mobile';
describe('get-is-mobile', () => {
test.describe('get-is-mobile', () => {
test('get-is-mobile', () => {
expect(
isMobile(
+8 -4
View File
@@ -10,8 +10,8 @@
".": "./dist/src/index.js"
},
"scripts": {
"build": "tsc --project ./tsconfig.json",
"test": "playwright test"
"dev": "tsc --project ./tsconfig.json -w",
"build": "tsc --project ./tsconfig.json"
},
"keywords": [],
"author": "",
@@ -26,8 +26,8 @@
"typescript": "^4.8.4"
},
"dependencies": {
"@blocksuite/blocks": "=0.3.1-20230106060050-1aad55d",
"@blocksuite/store": "=0.3.1-20230106060050-1aad55d",
"@blocksuite/blocks": "^0.3.1-20230109032243-37ad3ba",
"@blocksuite/store": "^0.3.1-20230109032243-37ad3ba",
"debug": "^4.3.4",
"encoding": "^0.1.13",
"firebase": "^9.15.0",
@@ -38,5 +38,9 @@
"swr": "^2.0.0",
"yjs": "^13.5.44",
"y-protocols": "^1.0.5"
},
"peerDependencies": {
"@blocksuite/blocks": "0.3.1-*",
"@blocksuite/store": "0.3.1-*"
}
}
@@ -1,7 +1,10 @@
/**
* For unit tests.
*/
import type { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
testDir: './tests',
testDir: './packages/',
timeout: 30 * 1000,
expect: {
/**
+5 -1267
View File
File diff suppressed because it is too large Load Diff
@@ -2,12 +2,9 @@ const fs = require('fs');
const path = require('path');
const templatePath = path.resolve(__dirname, 'module-resolve.tmpl.js');
const destinationPath = path.resolve(__dirname, '../../module-resolve.js');
const destinationPath = path.resolve(__dirname, '../../module-resolve.cjs');
console.log('template path', templatePath);
console.log('destination path', destinationPath);
fs.copyFileSync(
templatePath,
destinationPath
);
fs.copyFileSync(templatePath, destinationPath);
+2 -2
View File
@@ -1,6 +1,6 @@
import { test, expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { clickPageMoreActions } from './libs/page-logic';
import { loadPage } from './libs/load-page.js';
import { clickPageMoreActions } from './libs/page-logic.js';
loadPage();
test.describe('Change page mode(Paper or Edgeless)', () => {
+9 -3
View File
@@ -1,11 +1,17 @@
import { test, expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import pkg from './../packages/app/package.json';
import { loadPage } from './libs/load-page.js';
loadPage();
test.describe('web console', () => {
test('editor version', async ({ page }) => {
// TODO: playwright need to support json import in esm
test.skip('editor version', async ({ page }) => {
// TODO: playwright need to support json import in esm
// const pkg = await import('./../packages/app/package.json', {
// assert: { type: 'json' },
// });
const pkg = {} as any;
// https://playwright.dev/docs/evaluating
// https://github.com/microsoft/playwright/issues/13059
// Get the handle to a specific function.
+1 -1
View File
@@ -1,5 +1,5 @@
import { test, expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { loadPage } from './libs/load-page.js';
loadPage();
+1 -1
View File
@@ -1,5 +1,5 @@
import { test, expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { loadPage } from './libs/load-page.js';
loadPage();
+1 -1
View File
@@ -1,5 +1,5 @@
import { test, expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { loadPage } from './libs/load-page.js';
loadPage();
+1 -1
View File
@@ -1,5 +1,5 @@
import { test, expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { loadPage } from './libs/load-page.js';
loadPage();
+2 -2
View File
@@ -1,6 +1,6 @@
import { test, expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { newPage } from './libs/page-logic';
import { loadPage } from './libs/load-page.js';
import { newPage } from './libs/page-logic.js';
loadPage();
+2 -2
View File
@@ -1,6 +1,6 @@
import { test, expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { newPage, clickPageMoreActions } from './libs/page-logic';
import { loadPage } from './libs/load-page.js';
import { newPage, clickPageMoreActions } from './libs/page-logic.js';
loadPage();
test.describe('Local first export page', () => {
+2 -2
View File
@@ -1,6 +1,6 @@
import { test, expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { newPage, clickPageMoreActions } from './libs/page-logic';
import { loadPage } from './libs/load-page.js';
import { newPage, clickPageMoreActions } from './libs/page-logic.js';
loadPage();
test.describe('Local first favorite and cancel favorite page', () => {
+2 -2
View File
@@ -1,6 +1,6 @@
import { test, expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { newPage, clickPageMoreActions } from './libs/page-logic';
import { loadPage } from './libs/load-page.js';
import { newPage, clickPageMoreActions } from './libs/page-logic.js';
loadPage();
test.describe('Local first favorite items ui', () => {
+2 -2
View File
@@ -1,6 +1,6 @@
import { test, expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { newPage } from './libs/page-logic';
import { loadPage } from './libs/load-page.js';
import { newPage } from './libs/page-logic.js';
loadPage();
test.describe('local first new page', () => {
+2 -2
View File
@@ -1,6 +1,6 @@
import { test, expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { newPage } from './libs/page-logic';
import { loadPage } from './libs/load-page.js';
import { newPage } from './libs/page-logic.js';
loadPage();
test.describe('local first new page', () => {
+2 -2
View File
@@ -1,6 +1,6 @@
import { test, expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { newPage } from './libs/page-logic';
import { loadPage } from './libs/load-page.js';
import { newPage } from './libs/page-logic.js';
loadPage();
test.describe('Local first delete page', () => {
+2 -2
View File
@@ -1,6 +1,6 @@
import { test, expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { newPage, clickPageMoreActions } from './libs/page-logic';
import { loadPage } from './libs/load-page.js';
import { newPage, clickPageMoreActions } from './libs/page-logic.js';
loadPage();
test.describe('Local first delete page', () => {
+2 -2
View File
@@ -1,6 +1,6 @@
import { test, expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { newPage } from './libs/page-logic';
import { loadPage } from './libs/load-page.js';
import { newPage } from './libs/page-logic.js';
loadPage();
test.describe('Local first trash page', () => {
+1 -1
View File
@@ -1,5 +1,5 @@
import { test, expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { loadPage } from './libs/load-page.js';
loadPage();
+1 -1
View File
@@ -1,5 +1,5 @@
import { test, expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { loadPage } from './libs/load-page.js';
loadPage();
+3 -3
View File
@@ -1,7 +1,7 @@
import { test, expect, type Page } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { withCtrlOrMeta } from './libs/keyboard';
import { newPage } from './libs/page-logic';
import { loadPage } from './libs/load-page.js';
import { withCtrlOrMeta } from './libs/keyboard.js';
import { newPage } from './libs/page-logic.js';
loadPage();
const openQuickSearchByShortcut = async (page: Page) =>
+1 -1
View File
@@ -1,5 +1,5 @@
import { test, expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { loadPage } from './libs/load-page.js';
loadPage();
+1 -1
View File
@@ -1,5 +1,5 @@
import { test, expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { loadPage } from './libs/load-page.js';
loadPage();