Skip to content

Commit

Permalink
chore: rename test packages (vitejs#11172)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red authored and futurGH committed Feb 26, 2023
1 parent e9faba6 commit 21facca
Show file tree
Hide file tree
Showing 179 changed files with 588 additions and 564 deletions.
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ test('?raw import', async () => {

In many test cases, we need to mock dependencies using `link:` and `file:` protocols. `pnpm` treats `link:` as symlinks and `file:` as hardlinks. To test dependencies as if they were copied into `node_modules`, use the `file:` protocol. Otherwise, use the `link:` protocol.

For a mock dependency, make sure you add a `@vitejs/test-` prefix to the package name. This will avoid possible issues like false-positive alerts.

## Debug Logging

You can set the `DEBUG` environment variable to turn on debugging logs (e.g. `DEBUG="vite:resolve"`). To see all debug logs, you can set `DEBUG="vite:*"`, but be warned that it will be quite noisy. You can run `grep -r "createDebugger('vite:" packages/vite/src/` to see a list of available debug scopes.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "vite-monorepo",
"name": "@vitejs/vite-monorepo",
"private": true,
"engines": {
"node": "^14.18.0 || >=16.0.0"
Expand Down
2 changes: 1 addition & 1 deletion playground/alias/dir/module/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@vite/aliased-module",
"name": "@vitejs/test-aliased-module",
"private": true,
"type": "module",
"version": "0.0.0"
Expand Down
4 changes: 2 additions & 2 deletions playground/alias/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test-alias",
"name": "@vitejs/test-alias",
"private": true,
"version": "0.0.0",
"scripts": {
Expand All @@ -14,6 +14,6 @@
"@vue/shared": "^3.2.45"
},
"devDependencies": {
"resolve-linked": "workspace:*"
"@vitejs/test-resolve-linked": "workspace:*"
}
}
2 changes: 1 addition & 1 deletion playground/alias/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
alias: [
{ find: 'fs', replacement: path.resolve(__dirname, 'test.js') },
{ find: 'fs-dir', replacement: path.resolve(__dirname, 'dir') },
{ find: 'dep', replacement: 'resolve-linked' },
{ find: 'dep', replacement: '@vitejs/test-resolve-linked' },
{
find: /^regex\/(.*)/,
replacement: `${path.resolve(__dirname, 'dir')}/$1`,
Expand Down
2 changes: 1 addition & 1 deletion playground/assets-sanitize/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test-assets-sanitize",
"name": "@vitejs/test-assets-sanitize",
"private": true,
"version": "0.0.0",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion playground/assets/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test-assets",
"name": "@vitejs/test-assets",
"private": true,
"version": "0.0.0",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion playground/backend-integration/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test-backend-integration",
"name": "@vitejs/test-backend-integration",
"private": true,
"version": "0.0.0",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion playground/build-old/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test-build-old",
"name": "@vitejs/test-build-old",
"private": true,
"version": "0.0.0",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion playground/cli-module/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test-cli-module",
"name": "@vitejs/test-cli-module",
"private": true,
"version": "0.0.0",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion playground/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test-cli",
"name": "@vitejs/test-cli",
"private": true,
"version": "0.0.0",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion playground/css-codesplit-cjs/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test-css-codesplit-cjs",
"name": "@vitejs/test-css-codesplit-cjs",
"private": true,
"version": "0.0.0",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion playground/css-codesplit/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test-css-codesplit",
"name": "@vitejs/test-css-codesplit",
"private": true,
"version": "0.0.0",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion playground/css-sourcemap/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test-css-sourcemap",
"name": "@vitejs/test-css-sourcemap",
"private": true,
"version": "0.0.0",
"scripts": {
Expand Down
4 changes: 0 additions & 4 deletions playground/css/__tests__/css.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,6 @@ test('@import dependency w/ sass entry', async () => {
expect(await getColor('.css-dep-sass')).toBe('orange')
})

test('@import dependency w/ stylus entry', async () => {
expect(await getColor('.css-dep-stylus')).toBe('red')
})

test('@import dependency w/out package scss', async () => {
expect(await getColor('.sass-dep')).toBe('lavender')
})
Expand Down
2 changes: 1 addition & 1 deletion playground/css/css-dep/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "css-dep",
"name": "@vitejs/test-css-dep",
"private": true,
"version": "1.0.0",
"main": "index.js",
Expand Down
2 changes: 1 addition & 1 deletion playground/css/css-js-dep/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "css-js-dep",
"name": "@vitejs/test-css-js-dep",
"private": true,
"type": "module",
"version": "1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion playground/css/dep.css
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@import 'css-dep';
@import '@vitejs/test-css-dep';
3 changes: 0 additions & 3 deletions playground/css/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,6 @@ <h1>CSS</h1>
<p class="css-dep-sass">
@import dependency w/ sass entrypoints: this should be orange
</p>
<p class="css-dep-stylus">
@import dependency w/ styl entrypoints: this should be red
</p>

<p class="dir-dep">PostCSS dir-dependency: this should be grey</p>
<p class="dir-dep-2">
Expand Down
2 changes: 1 addition & 1 deletion playground/css/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import './dep.css'
import './glob-dep.css'

// eslint-disable-next-line import/order
import { barModuleClasses } from 'css-js-dep'
import { barModuleClasses } from '@vitejs/test-css-js-dep'
document
.querySelector('.css-js-dep-module')
.classList.add(barModuleClasses.cssJsDepModule)
Expand Down
6 changes: 3 additions & 3 deletions playground/css/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test-css",
"name": "@vitejs/test-css",
"private": true,
"version": "0.0.0",
"scripts": {
Expand All @@ -12,8 +12,8 @@
"preview:relative-base": "vite --config ./vite.config-relative-base.js preview"
},
"devDependencies": {
"css-dep": "link:./css-dep",
"css-js-dep": "file:./css-js-dep",
"@vitejs/test-css-dep": "link:./css-dep",
"@vitejs/test-css-js-dep": "file:./css-js-dep",
"fast-glob": "^3.2.12",
"less": "^4.1.3",
"postcss-nested": "^5.0.6",
Expand Down
2 changes: 1 addition & 1 deletion playground/css/sass.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import '=/nested'; // alias + custom index resolving -> /nested/_index.scss
@import '=/nested/partial'; // sass convention: omitting leading _ for partials
@import 'css-dep'; // package w/ sass entry points
@import '@vitejs/test-css-dep'; // package w/ sass entry points
@import 'virtual-dep'; // virtual file added through importer
@import '=/pkg-dep'; // package w/out sass field
@import '=/weapp.wxss'; // wxss file
Expand Down
1 change: 0 additions & 1 deletion playground/css/stylus.styl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@import './nested/nested'
@import 'css-dep'; // package w/ styl entry points

$color ?= blue

Expand Down
2 changes: 1 addition & 1 deletion playground/data-uri/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test-data-uri",
"name": "@vitejs/test-data-uri",
"private": true,
"version": "0.0.0",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion playground/define/commonjs-dep/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "commonjs-dep",
"name": "@vitejs/test-commonjs-dep",
"private": true,
"version": "1.0.0",
"type": "commonjs"
Expand Down
6 changes: 5 additions & 1 deletion playground/define/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ <h1>Define</h1>
document.querySelector(el).textContent = text
}

import { defined, importMetaEnvUndefined, processEnvUndefined } from 'dep'
import {
defined,
importMetaEnvUndefined,
processEnvUndefined,
} from '@vitejs/test-commonjs-dep'
text('.define-in-dep', JSON.stringify(defined))
text('.import-meta-env-undefined', importMetaEnvUndefined)
text('.process-env-undefined', processEnvUndefined)
Expand Down
4 changes: 2 additions & 2 deletions playground/define/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test-define",
"name": "@vitejs/test-define",
"private": true,
"version": "0.0.0",
"scripts": {
Expand All @@ -9,6 +9,6 @@
"preview": "vite preview"
},
"dependencies": {
"dep": "file:./commonjs-dep"
"@vitejs/test-commonjs-dep": "file:./commonjs-dep"
}
}
2 changes: 1 addition & 1 deletion playground/dynamic-import/nested/deps.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/* don't include dynamic import inside this file */

import 'pkg'
import '@vitejs/test-pkg'
4 changes: 2 additions & 2 deletions playground/dynamic-import/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test-dynamic-import",
"name": "@vitejs/test-dynamic-import",
"private": true,
"version": "0.0.0",
"scripts": {
Expand All @@ -9,6 +9,6 @@
"preview": "vite preview"
},
"dependencies": {
"pkg": "file:./pkg"
"@vitejs/test-pkg": "file:./pkg"
}
}
2 changes: 1 addition & 1 deletion playground/dynamic-import/pkg/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "pkg",
"name": "@vitejs/test-pkg",
"type": "module",
"private": true,
"version": "1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion playground/env-nested/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test-env-nested",
"name": "@vitejs/test-env-nested",
"private": true,
"version": "0.0.0",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion playground/env/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test-env",
"name": "@vitejs/test-env",
"private": true,
"version": "0.0.0",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion playground/extensions/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test-extensions",
"name": "@vitejs/test-extensions",
"private": true,
"version": "0.0.0",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion playground/external/dep-that-imports/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@vitejs/dep-that-imports",
"name": "@vitejs/test-dep-that-imports",
"private": true,
"version": "0.0.0",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion playground/external/dep-that-requires/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@vitejs/dep-that-requires",
"name": "@vitejs/test-dep-that-requires",
"private": true,
"version": "0.0.0",
"dependencies": {
Expand Down
6 changes: 3 additions & 3 deletions playground/external/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "external-test",
"name": "@vitejs/test-external",
"private": true,
"version": "0.0.0",
"scripts": {
Expand All @@ -9,8 +9,8 @@
"preview": "vite preview"
},
"dependencies": {
"@vitejs/dep-that-imports": "file:./dep-that-imports",
"@vitejs/dep-that-requires": "file:./dep-that-requires"
"@vitejs/test-dep-that-imports": "file:./dep-that-imports",
"@vitejs/test-dep-that-requires": "file:./dep-that-requires"
},
"devDependencies": {
"slash3": "npm:slash@^3.0.0",
Expand Down
4 changes: 2 additions & 2 deletions playground/external/src/main.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import '@vitejs/dep-that-imports'
import '@vitejs/dep-that-requires'
import '@vitejs/test-dep-that-imports'
import '@vitejs/test-dep-that-requires'
2 changes: 1 addition & 1 deletion playground/file-delete-restore/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test-file-delete-restore",
"name": "@vitejs/test-file-delete-restore",
"private": true,
"version": "0.0.0",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion playground/fs-serve/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test-fs-serve",
"name": "@vitejs/test-fs-serve",
"private": true,
"version": "0.0.0",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion playground/glob-import/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test-import-context",
"name": "@vitejs/test-import-context",
"private": true,
"version": "0.0.0",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion playground/hmr/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test-hmr",
"name": "@vitejs/test-hmr",
"private": true,
"version": "0.0.0",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion playground/html/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test-html",
"name": "@vitejs/test-html",
"private": true,
"version": "0.0.0",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@vitejs/import-assertion-dep",
"name": "@vitejs/test-import-assertion-dep",
"private": true,
"version": "0.0.0",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion playground/import-assertion/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h2>From dependency</h2>
import * as data from './data.json' assert { type: 'json' }
text('.src', data.foo)

import * as depData from '@vitejs/import-assertion-dep'
import * as depData from '@vitejs/test-import-assertion-dep'
text('.dep', depData.hello)

function text(el, text) {
Expand Down
4 changes: 2 additions & 2 deletions playground/import-assertion/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test-import-assertion",
"name": "@vitejs/test-import-assertion",
"private": true,
"version": "0.0.0",
"scripts": {
Expand All @@ -9,6 +9,6 @@
"preview": "vite preview"
},
"dependencies": {
"@vitejs/import-assertion-dep": "file:./import-assertion-dep"
"@vitejs/test-import-assertion-dep": "file:./import-assertion-dep"
}
}
2 changes: 1 addition & 1 deletion playground/js-sourcemap/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test-js-sourcemap",
"name": "@vitejs/test-js-sourcemap",
"private": true,
"version": "0.0.0",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion playground/json/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ <h2>HMR</h2>
import raw from './test.json?raw'
text('.raw', raw)

import moduleJSON from 'json-module'
import moduleJSON from '@vitejs/test-json-module'
text('.module', JSON.stringify(moduleJSON))

import hasBomJson from './json-bom/has-bom.json'
Expand Down
Loading

0 comments on commit 21facca

Please sign in to comment.