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
-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, "private": true,
"author": "toeverything", "author": "toeverything",
"license": "MPL-2.0", "license": "MPL-2.0",
"type": "module",
"scripts": { "scripts": {
"dev": "pnpm --filter=!@affine/app build && pnpm --filter @affine/app dev", "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", "dev:ac": "pnpm --filter=!@affine/app build && NODE_API_SERVER=ac pnpm --filter @affine/app dev",
@@ -15,7 +16,7 @@
"test": "playwright test", "test": "playwright test",
"test:dc": "pnpm --filter @affine/datacenter test", "test:dc": "pnpm --filter @affine/datacenter test",
"test:e2e:codegen": "npx playwright codegen http://localhost:8080", "test:e2e:codegen": "npx playwright codegen http://localhost:8080",
"test:unit": "jest", "test:unit": "playwright test --config=playwright.config.unit.ts",
"postinstall": "husky install", "postinstall": "husky install",
"notify": "node --experimental-modules scripts/notify.mjs", "notify": "node --experimental-modules scripts/notify.mjs",
"check:ci": "pnpm lint & pnpm test" "check:ci": "pnpm lint & pnpm test"
@@ -25,7 +26,6 @@
"*.{ts,tsx,js,jsx}": "npx eslint --cache --fix" "*.{ts,tsx,js,jsx}": "npx eslint --cache --fix"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "^29.3.1",
"@playwright/test": "^1.29.1", "@playwright/test": "^1.29.1",
"@typescript-eslint/eslint-plugin": "^5.47.0", "@typescript-eslint/eslint-plugin": "^5.47.0",
"@typescript-eslint/parser": "^5.47.0", "@typescript-eslint/parser": "^5.47.0",
@@ -36,9 +36,7 @@
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1", "eslint-plugin-prettier": "^4.2.1",
"got": "^12.5.3", "got": "^12.5.3",
"jest": "^29.3.1",
"prettier": "^2.7.1", "prettier": "^2.7.1",
"ts-jest": "^29.0.3",
"typescript": "^4.9.3", "typescript": "^4.9.3",
"lint-staged": "^13.1.0", "lint-staged": "^13.1.0",
"husky": "^8.0.2", "husky": "^8.0.2",
@@ -1,7 +1,7 @@
import { describe, test, expect } from '@jest/globals'; import { test, expect } from '@playwright/test';
import { printer } from './../printer'; import { printer } from './../printer';
const chalk = require('chalk'); const chalk = require('chalk');
describe('printer', () => { test.describe('printer', () => {
test('test debug', () => { test('test debug', () => {
expect(printer.debug('test debug')).toBe( expect(printer.debug('test debug')).toBe(
chalk.green`debug` + chalk.white(' - test debug') 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'; import { isMobile } from '../get-is-mobile';
describe('get-is-mobile', () => { test.describe('get-is-mobile', () => {
test('get-is-mobile', () => { test('get-is-mobile', () => {
expect( expect(
isMobile( isMobile(
+2 -2
View File
@@ -10,8 +10,8 @@
".": "./dist/src/index.js" ".": "./dist/src/index.js"
}, },
"scripts": { "scripts": {
"build": "tsc --project ./tsconfig.json", "dev": "tsc --project ./tsconfig.json -w",
"test": "playwright test" "build": "tsc --project ./tsconfig.json"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",
@@ -1,7 +1,10 @@
/**
* For unit tests.
*/
import type { PlaywrightTestConfig } from '@playwright/test'; import type { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = { const config: PlaywrightTestConfig = {
testDir: './tests', testDir: './packages/',
timeout: 30 * 1000, timeout: 30 * 1000,
expect: { expect: {
/** /**
+1 -1214
View File
File diff suppressed because it is too large Load Diff