Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update vitest to 1.0.0-beta.6 #15194

Merged
merged 4 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"unbuild": "^2.0.0",
"vite": "workspace:*",
"vitepress": "1.0.0-rc.31",
"vitest": "^0.34.6",
"vitest": "^1.0.0-beta.6",
"vue": "^3.3.9"
},
"simple-git-hooks": {
Expand Down
24 changes: 12 additions & 12 deletions packages/vite/src/node/__tests__/plugins/css.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,15 @@ describe('hoist @ rules', () => {
@import "baz";`
const result = await hoistAtRules(css)
expect(result).toMatchInlineSnapshot(`
"@charset \\"utf-8\\";@import \\"baz\\";
"@charset "utf-8";@import "baz";
.foo{color:red;}
/*
@import \\"bla\\";
@import "bla";
*/

/*
@charset \\"utf-8\\";
@import \\"bar\\";
@charset "utf-8";
@import "bar";
*/
"
`)
Expand Down Expand Up @@ -271,9 +271,9 @@ import "other-module";`
const replaced = replacer(code)
expect(replaced.length).toBe(code.length)
expect(replaced).toMatchInlineSnapshot(`
"import \\"some-module\\";
"import "some-module";
/* empty css */
import \\"other-module\\";"
import "other-module";"
`)
})

Expand All @@ -284,7 +284,7 @@ import "other-module";`
const replaced = replacer(code)
expect(replaced.length).toBe(code.length)
expect(replaced).toMatchInlineSnapshot(
'"import \\"some-module\\";/* empty css */import \\"other-module\\";"',
`"import "some-module";/* empty css */import "other-module";"`,
)
})

Expand All @@ -298,9 +298,9 @@ require("other-module");`
const replaced = replacer(code)
expect(replaced.length).toBe(code.length)
expect(replaced).toMatchInlineSnapshot(`
"require(\\"some-module\\");
"require("some-module");
;/* empty css */
require(\\"other-module\\");"
require("other-module");"
`)
})

Expand All @@ -311,7 +311,7 @@ require("other-module");`
const replaced = replacer(code)
expect(replaced.length).toBe(code.length)
expect(replaced).toMatchInlineSnapshot(
'"require(\\"some-module\\");;/* empty css */require(\\"other-module\\");"',
`"require("some-module");;/* empty css */require("other-module");"`,
)
})

Expand All @@ -322,7 +322,7 @@ require("other-module");`
const replacer = getEmptyChunkReplacer(['pure_css_chunk.js'], 'cjs')
const newCode = replacer(code)
expect(newCode).toMatchInlineSnapshot(
'"require(\\"some-module\\"),/* empty css */require(\\"other-module\\");"',
`"require("some-module"),/* empty css */require("other-module");"`,
)
// So there should be no pure css chunk anymore
expect(newCode.match(/pure_css_chunk\.js/)).toBeNull()
Expand All @@ -334,7 +334,7 @@ require("other-module");`

const replacer = getEmptyChunkReplacer(['pure_css_chunk.js'], 'cjs')
expect(replacer(code)).toMatchInlineSnapshot(
'"require(\\"some-module\\");/* empty css */const v=require(\\"other-module\\");"',
`"require("some-module");/* empty css */const v=require("other-module");"`,
)
})
})
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`parse positives > ? in url 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob(\\"./mo\\\\\\\\?ds/*.js\\", {\\"as\\":\\"url\\",\\"import\\":\\"*\\"})), \`./mo?ds/\${base ?? foo}.js\`)"`;
exports[`parse positives > ? in url 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob("./mo\\\\?ds/*.js", {"as":"url","import":"*"})), \`./mo?ds/\${base ?? foo}.js\`)"`;

exports[`parse positives > ? in variables 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob(\\"./mods/*.js\\", {\\"as\\":\\"raw\\",\\"import\\":\\"*\\"})), \`./mods/\${base ?? foo}.js\`)"`;
exports[`parse positives > ? in variables 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob("./mods/*.js", {"as":"raw","import":"*"})), \`./mods/\${base ?? foo}.js\`)"`;

exports[`parse positives > ? in worker 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob(\\"./mo\\\\\\\\?ds/*.js\\", {\\"as\\":\\"worker\\",\\"import\\":\\"*\\"})), \`./mo?ds/\${base ?? foo}.js\`)"`;
exports[`parse positives > ? in worker 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob("./mo\\\\?ds/*.js", {"as":"worker","import":"*"})), \`./mo?ds/\${base ?? foo}.js\`)"`;

exports[`parse positives > alias path 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob(\\"./mods/*.js\\")), \`./mods/\${base}.js\`)"`;
exports[`parse positives > alias path 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob("./mods/*.js")), \`./mods/\${base}.js\`)"`;

exports[`parse positives > basic 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob(\\"./mods/*.js\\")), \`./mods/\${base}.js\`)"`;
exports[`parse positives > basic 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob("./mods/*.js")), \`./mods/\${base}.js\`)"`;

exports[`parse positives > with ../ and itself 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob(\\"../dynamicImportVar/*.js\\")), \`./\${name}.js\`)"`;
exports[`parse positives > with ../ and itself 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob("../dynamicImportVar/*.js")), \`./\${name}.js\`)"`;

exports[`parse positives > with multi ../ and itself 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob(\\"../../plugins/dynamicImportVar/*.js\\")), \`./\${name}.js\`)"`;
exports[`parse positives > with multi ../ and itself 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob("../../plugins/dynamicImportVar/*.js")), \`./\${name}.js\`)"`;

exports[`parse positives > with query 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob(\\"./mods/*.js\\", {\\"query\\":{\\"foo\\":\\"bar\\"}})), \`./mods/\${base}.js\`)"`;
exports[`parse positives > with query 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob("./mods/*.js", {"query":{"foo":"bar"}})), \`./mods/\${base}.js\`)"`;

exports[`parse positives > with query raw 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob(\\"./mods/*.js\\", {\\"as\\":\\"raw\\",\\"import\\":\\"*\\"})), \`./mods/\${base}.js\`)"`;
exports[`parse positives > with query raw 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob("./mods/*.js", {"as":"raw","import":"*"})), \`./mods/\${base}.js\`)"`;

exports[`parse positives > with query url 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob(\\"./mods/*.js\\", {\\"as\\":\\"url\\",\\"import\\":\\"*\\"})), \`./mods/\${base}.js\`)"`;
exports[`parse positives > with query url 1`] = `"__variableDynamicImportRuntimeHelper((import.meta.glob("./mods/*.js", {"as":"url","import":"*"})), \`./mods/\${base}.js\`)"`;