chore: remove jest; using playwright over whole project

This commit is contained in:
alt0 2023-01-09 11:18:47 +08:00
parent 462e86b9a0
commit cc5c16623a
7 changed files with 13 additions and 1244 deletions

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,
},
],
},
};

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"
@ -25,7 +26,6 @@
"*.{ts,tsx,js,jsx}": "npx eslint --cache --fix"
},
"devDependencies": {
"@jest/globals": "^29.3.1",
"@playwright/test": "^1.29.1",
"@typescript-eslint/eslint-plugin": "^5.47.0",
"@typescript-eslint/parser": "^5.47.0",
@ -36,9 +36,7 @@
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"got": "^12.5.3",
"jest": "^29.3.1",
"prettier": "^2.7.1",
"ts-jest": "^29.0.3",
"typescript": "^4.9.3",
"lint-staged": "^13.1.0",
"husky": "^8.0.2",

View File

@ -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')

View File

@ -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(

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": "",

View File

@ -1,7 +1,10 @@
/**
* For unit tests.
*/
import type { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
testDir: './tests',
testDir: './packages/',
timeout: 30 * 1000,
expect: {
/**

File diff suppressed because it is too large Load Diff