Skip to content

Commit ee89a4c

Browse files
committed
chore: migrate to vitest
1 parent 2dfbd04 commit ee89a4c

19 files changed

+395
-2501
lines changed

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_size = 2
6+
indent_style = space
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

.eslintrc.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"env": {
3-
"node": true,
4-
"jest": true
3+
"node": true
54
},
65
"extends": "@antfu",
76
"rules": {

.github/workflows/test.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ jobs:
3434

3535
- run: pnpm install
3636

37+
- name: Run linter
38+
run: pnpm run lint
39+
3740
- name: Build
3841
run: pnpm run build
3942

@@ -53,7 +56,5 @@ jobs:
5356
- name: Install nuxt3-webpack dependencies
5457
run: cd playground/nuxt3-webpack && pnpm install
5558

56-
- name: Run linter
57-
run: pnpm run lint
5859
- name: Run tests
5960
run: pnpm run test

.npmrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ignore-workspace-root-check=true
2+
shamefully-hoist=true

jest.config.js

-13
This file was deleted.

package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
"build": "pnpm -r --parallel --filter ./packages run build",
1010
"prepack": "cp README.md packages/nuxt-windicss && cd packages/nuxt-windicss && yarn prepack",
1111
"changelog": "npx auto-changelog --stdout --commit-limit false -u --template https://raw.githubusercontent.com/release-it/release-it/master/templates/changelog-compact.hbs",
12-
"lint": "eslint --fix --ext .ts,.js,.vue .",
12+
"lint": "eslint \"{packages,test}/**/*.{ts,vue,json,yml}\"",
13+
"lint:fix": "npm run lint -- --fix",
1314
"release": "cp README.md packages/nuxt-windicss && cd packages/nuxt-windicss && pnpm run release",
1415
"release:beta": "dotenv release-it --preReleaseId=beta --npm.tag=beta --github.preRelease",
15-
"test": "pnpm run build && jest --verbose --maxWorkers=5"
16+
"test": "vitest"
1617
},
1718
"devDependencies": {
1819
"@antfu/eslint-config": "^0.14.0",
@@ -22,11 +23,10 @@
2223
"@typescript-eslint/visitor-keys": "^5.8.0",
2324
"cheerio": "^1.0.0-rc.10",
2425
"dotenv-cli": "^4.1.1",
25-
"esbuild": "^0.14.7",
26-
"esbuild-jest": "^0.5.0",
2726
"eslint": "^8.5.0",
28-
"jest": "27.3.0",
2927
"unbuild": "^0.6.7",
28+
"vite": "^2.7.13",
29+
"vitest": "^0.2.5",
3030
"windicss": "^3.4.0"
3131
}
3232
}

packages/nuxt-windicss/package.json

+13-13
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,11 @@
88
"windicss",
99
"tailwindcss"
1010
],
11-
"exports": {
12-
".": {
13-
"require": "./index.cjs",
14-
"import": "./dist/index.mjs"
15-
}
16-
},
17-
"sideEffects": false,
18-
"main": "./index.cjs",
19-
"module": "./dist/index.mjs",
20-
"types": "./dist/index.d.ts",
21-
"homepage": "https://github.com/windicss/nuxt-windicss",
22-
"bugs": "https://github.com/windicss/nuxt-windicss/issues",
11+
"license": "MIT",
2312
"repository": {
2413
"type": "git",
2514
"url": "https://github.com/windicss/nuxt-windicss"
2615
},
27-
"license": "MIT",
2816
"author": {
2917
"name": "Harlan Wilton",
3018
"email": "[email protected]"
@@ -33,6 +21,18 @@
3321
"dist",
3422
"index.cjs"
3523
],
24+
"exports": {
25+
".": {
26+
"require": "./index.cjs",
27+
"import": "./dist/index.mjs"
28+
}
29+
},
30+
"sideEffects": false,
31+
"main": "./index.cjs",
32+
"module": "./dist/index.mjs",
33+
"types": "./dist/index.d.ts",
34+
"homepage": "https://github.com/windicss/nuxt-windicss",
35+
"bugs": "https://github.com/windicss/nuxt-windicss/issues",
3636
"scripts": {
3737
"dev": "unbuild --stub",
3838
"build": "unbuild",

playground/nuxt-bridge/module.test.js playground/nuxt-bridge/module.test.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
const cheerio = require('cheerio')
1+
import { describe, test, expect } from 'vitest'
2+
import cheerio from 'cheerio'
3+
24
const execa = require('execa');
35
const fs = require('fs')
46
const path = require('pathe')
@@ -7,7 +9,7 @@ describe('nuxt-bridge', () => {
79

810
test('index html transformed correctly', async() => {
911
// Note: this is a hacky solution
10-
await execa('yarn', ['run', 'nuxt', 'generate'], { cwd: __dirname });
12+
await execa('pnpm', ['generate'], { cwd: __dirname });
1113
const html = fs.readFileSync(path.join(__dirname, '.output', 'public', 'index.html'), 'utf-8')
1214
const $ = cheerio.load(html)
1315
$('style').each((i, $s) => {

playground/nuxt-bridge/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"name": "nuxt2-webpack",
33
"private": true,
44
"scripts": {
5-
"dev": "nuxt dev",
6-
"build": "nuxt build",
7-
"start": "nuxt start",
8-
"generate": "nuxt generate"
5+
"dev": "nuxi dev",
6+
"build": "nuxi build",
7+
"start": "nuxi start",
8+
"generate": "nuxi generate"
99
},
1010
"dependencies": {
1111
"nuxt-edge": "latest"

playground/nuxt-bridge/tsconfig.json

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"extends": "./.nuxt/tsconfig.json",
32
"compilerOptions": {
43
"target": "es2018",
54
"module": "esnext",

playground/nuxt2-vite/module.test.js playground/nuxt2-vite/module.test.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
const cheerio = require('cheerio')
1+
import { describe, test, expect } from 'vitest'
2+
import cheerio from 'cheerio'
23
const execa = require('execa');
34
const fs = require('fs')
45
const path = require('pathe')
@@ -7,7 +8,7 @@ describe('nuxt2-webpack', () => {
78

89
test('index html transformed correctly', async() => {
910
// Note: this is a hacky solution
10-
await execa('yarn', ['run', 'nuxt', 'generate'], { cwd: __dirname });
11+
await execa('pnpm', ['generate'], { cwd: __dirname });
1112

1213
const html = fs.readFileSync(path.join(__dirname, 'dist', 'index.html'), 'utf-8')
1314

playground/nuxt2-webpack/jest.config.js

-13
This file was deleted.

playground/nuxt2-webpack/module.test.js playground/nuxt2-webpack/module.test.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
const cheerio = require('cheerio')
1+
import { describe, test, expect } from 'vitest'
2+
import cheerio from 'cheerio'
3+
24
const execa = require('execa');
35
const fs = require('fs')
46
const path = require('pathe')
@@ -7,12 +9,12 @@ describe('nuxt2-webpack', () => {
79

810
test('index html transformed correctly', async() => {
911
// Note: this is a hacky solution
10-
await execa('yarn', ['run', 'nuxt', 'generate'], { cwd: __dirname });
12+
await execa('pnpm', ['generate'], { cwd: __dirname });
1113

1214
const html = fs.readFileSync(path.join(__dirname, 'dist', 'index.html'), 'utf-8')
1315

1416
const $ = cheerio.load(html)
15-
$('style').each((i, $s) => {
17+
$('style').each((i , $s) => {
1618
const html = $($s).html()
1719
expect(html).not.toContain('@apply')
1820
})

playground/nuxt3-webpack/module.test.js playground/nuxt3-webpack/module.test.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { describe, test, expect } from 'vitest'
2+
13
const cheerio = require('cheerio')
24
const execa = require('execa');
35
const fs = require('fs')
@@ -8,7 +10,7 @@ describe('nuxt3-webpack', () => {
810

911
test('renders css files without @apply', async() => {
1012
// Note: this is a hacky solution
11-
await execa('yarn', ['run', 'nuxt', 'build'], { cwd: __dirname });
13+
await execa('pnpm', ['build'], { cwd: __dirname });
1214

1315
const globDir = path.join(__dirname, '.output', 'public', '_nuxt', 'assets')
1416

playground/nuxt3-webpack/tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"extends": "./.nuxt/tsconfig.json",
23
"compilerOptions": {
34
"target": "ESNext",
45
"module": "ESNext",

playground/nuxt3/module.test.js playground/nuxt3/module.test.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { describe, test, expect } from 'vitest'
2+
13
const cheerio = require('cheerio')
24
const execa = require('execa');
35
const fs = require('fs')
@@ -8,7 +10,7 @@ describe('nuxt3', () => {
810

911
test('renders css files without @apply', async() => {
1012
// Note: this is a hacky solution
11-
await execa('yarn', ['run', 'nuxt', 'build'], { cwd: __dirname });
13+
await execa('pnpm', ['build'], { cwd: __dirname });
1214

1315
const globDir = path.join(__dirname, '.output', 'public', '_nuxt', 'assets')
1416

playground/nuxt3/tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"extends": "./.nuxt/tsconfig.json",
23
"compilerOptions": {
34
"target": "ESNext",
45
"module": "ESNext",

0 commit comments

Comments
 (0)